diff --git a/src/components/main-layout.tsx b/src/components/main-layout.tsx
index da81a6c..1c28310 100644
--- a/src/components/main-layout.tsx
+++ b/src/components/main-layout.tsx
@@ -7,8 +7,8 @@ import {
ReadOutlined,
UserOutlined,
} from '@ant-design/icons';
-import { Button, Dropdown, Grid, Layout, Menu, message } from 'antd';
import type { MenuProps } from 'antd';
+import { Button, Dropdown, Grid, Layout, Menu, message } from 'antd';
import type { ReactNode } from 'react';
import { useEffect, useState } from 'react';
import { Outlet } from 'react-router-dom';
@@ -57,7 +57,9 @@ const MainLayout = () => {
{
key: 'about',
icon: ,
- label: 关于我们,
+ label: (
+ 关于我们
+ ),
},
...(user
? [
@@ -103,9 +105,7 @@ const MainLayout = () => {
onClick={() => setMobileNavOpen(true)}
/>
)}
- {isMobile && (
-
- )}
+ {isMobile && }
{isMobile ? (
@@ -117,7 +117,11 @@ const MainLayout = () => {
} />
) : (
-
+
)}
diff --git a/src/components/sider.tsx b/src/components/sider.tsx
index cbb79f2..a960bb5 100644
--- a/src/components/sider.tsx
+++ b/src/components/sider.tsx
@@ -250,9 +250,7 @@ const SiderMenu = ({ selectedKeys, onNavigate }: SiderMenuProps) => {
{
key: 'realtime-metrics',
icon: ,
- label: (
- 实时数据
- ),
+ label: 实时数据,
},
{
key: 'apps',
diff --git a/src/pages/admin-apps.tsx b/src/pages/admin-apps.tsx
index e682f82..a622f8f 100644
--- a/src/pages/admin-apps.tsx
+++ b/src/pages/admin-apps.tsx
@@ -5,8 +5,8 @@ import {
Card,
Form,
Input,
- message,
Modal,
+ message,
Select,
Space,
Spin,
@@ -126,10 +126,15 @@ export const Component = () => {
key: 'platform',
width: 80,
render: (platform: string) => (
-
+
{platform}
),
@@ -231,7 +236,12 @@ export const Component = () => {
>
),
- dataIndex: "version",
- key: "version",
+ dataIndex: 'version',
+ key: 'version',
width: 200,
},
{
- title: "仅全量发布",
- dataIndex: "fullRelease",
- key: "fullRelease",
- align: "center",
+ title: '仅全量发布',
+ dataIndex: 'fullRelease',
+ key: 'fullRelease',
+ align: 'center',
render: (text: string) => {
return (
-
+
{text}
);
},
},
{
- title: "仅灰度发布",
- dataIndex: "grayRelease",
- key: "grayRelease",
- align: "center",
+ title: '仅灰度发布',
+ dataIndex: 'grayRelease',
+ key: 'grayRelease',
+ align: 'center',
render: (text: string) => {
return (
-
+
{text}
);
},
},
{
- title: "同时发布",
- dataIndex: "bothRelease",
- key: "bothRelease",
- align: "center",
+ title: '同时发布',
+ dataIndex: 'bothRelease',
+ key: 'bothRelease',
+ align: 'center',
render: (text: string) => {
- const color = text.includes("✓")
- ? "success"
- : text.includes("⚠")
- ? "warning"
- : "error";
+ const color = text.includes('✓')
+ ? 'success'
+ : text.includes('⚠')
+ ? 'warning'
+ : 'error';
return {text};
},
},
diff --git a/src/utils/helper.test.ts b/src/utils/helper.test.ts
index e4c6f88..8068340 100644
--- a/src/utils/helper.test.ts
+++ b/src/utils/helper.test.ts
@@ -1,38 +1,38 @@
-import { expect, test, describe } from "bun:test";
-import { isExpVersion } from "./helper";
+import { describe, expect, test } from 'bun:test';
+import { isExpVersion } from './helper';
-describe("isExpVersion", () => {
- test("should return false when config is null", () => {
- expect(isExpVersion(null, "1.0.0")).toBe(false);
+describe('isExpVersion', () => {
+ test('should return false when config is null', () => {
+ expect(isExpVersion(null, '1.0.0')).toBe(false);
});
- test("should return false when config is undefined", () => {
- expect(isExpVersion(undefined, "1.0.0")).toBe(false);
+ test('should return false when config is undefined', () => {
+ expect(isExpVersion(undefined, '1.0.0')).toBe(false);
});
- test("should return false when config.rollout is missing", () => {
- // @ts-ignore
- expect(isExpVersion({}, "1.0.0")).toBe(false);
+ test('should return false when config.rollout is missing', () => {
+ // @ts-expect-error
+ expect(isExpVersion({}, '1.0.0')).toBe(false);
});
- test("should return false when rollout config for version is missing", () => {
- expect(isExpVersion({ rollout: {} }, "1.0.0")).toBe(false);
+ test('should return false when rollout config for version is missing', () => {
+ expect(isExpVersion({ rollout: {} }, '1.0.0')).toBe(false);
});
- test("should return false when rollout config for version is null", () => {
- expect(isExpVersion({ rollout: { "1.0.0": null } }, "1.0.0")).toBe(false);
+ test('should return false when rollout config for version is null', () => {
+ expect(isExpVersion({ rollout: { '1.0.0': null } }, '1.0.0')).toBe(false);
});
- test("should return true when rollout is less than 100", () => {
- expect(isExpVersion({ rollout: { "1.0.0": 50 } }, "1.0.0")).toBe(true);
- expect(isExpVersion({ rollout: { "1.0.0": 0 } }, "1.0.0")).toBe(true);
+ test('should return true when rollout is less than 100', () => {
+ expect(isExpVersion({ rollout: { '1.0.0': 50 } }, '1.0.0')).toBe(true);
+ expect(isExpVersion({ rollout: { '1.0.0': 0 } }, '1.0.0')).toBe(true);
});
- test("should return false when rollout is 100", () => {
- expect(isExpVersion({ rollout: { "1.0.0": 100 } }, "1.0.0")).toBe(false);
+ test('should return false when rollout is 100', () => {
+ expect(isExpVersion({ rollout: { '1.0.0': 100 } }, '1.0.0')).toBe(false);
});
- test("should return false when rollout is greater than 100", () => {
- expect(isExpVersion({ rollout: { "1.0.0": 110 } }, "1.0.0")).toBe(false);
+ test('should return false when rollout is greater than 100', () => {
+ expect(isExpVersion({ rollout: { '1.0.0': 110 } }, '1.0.0')).toBe(false);
});
});
diff --git a/src/utils/notice.tsx b/src/utils/notice.tsx
index 097a2a1..cb07df2 100644
--- a/src/utils/notice.tsx
+++ b/src/utils/notice.tsx
@@ -25,9 +25,12 @@ const notices = {
},
};
-Object.entries(notices).forEach(([key, value]) => {
- const flag = localStorage.getItem(key);
- if (!flag) {
- confirm(value);
+for (const key in notices) {
+ if (Object.hasOwn(notices, key)) {
+ const value = notices[key as keyof typeof notices];
+ const flag = localStorage.getItem(key);
+ if (!flag) {
+ confirm(value);
+ }
}
-});
+}