diff --git a/chaosmeta-platform-frontend/Dockerfile b/chaosmeta-platform-frontend/Dockerfile
new file mode 100644
index 0000000..3343d7e
--- /dev/null
+++ b/chaosmeta-platform-frontend/Dockerfile
@@ -0,0 +1,13 @@
+# 设置 Node.js 版本
+FROM node:16-alpine
+
+# 设置工作目录
+WORKDIR /app
+
+# 将 package.json 和 package-lock.json 复制到工作目录中
+COPY . .
+
+RUN yarn install
+
+# 设置容器启动时的命令
+CMD ["yarn", "start"]
\ No newline at end of file
diff --git a/chaosmeta-platform-frontend/config/router.ts b/chaosmeta-platform-frontend/config/router.ts
index da570c6..a7cf7e7 100644
--- a/chaosmeta-platform-frontend/config/router.ts
+++ b/chaosmeta-platform-frontend/config/router.ts
@@ -1,7 +1,7 @@
export default [
{
path: '/',
- redirect: '/space/overview',
+ redirect: '/login',
},
{ path: '/*', component: '@/pages/404' },
{
diff --git a/chaosmeta-platform-frontend/src/app.tsx b/chaosmeta-platform-frontend/src/app.tsx
index d73569e..9c3f478 100644
--- a/chaosmeta-platform-frontend/src/app.tsx
+++ b/chaosmeta-platform-frontend/src/app.tsx
@@ -96,36 +96,10 @@ export const layout = () => {
},
siderWidth: 208,
layout: 'mix',
- // breakpoint: false,
splitMenus: true,
- // collapsedButtonRender: (porps) => {
- // return null;
- // },
- // collapsed: false,
rightContentRender: () => {
return ;
},
- // headerRender: (layoutProps: any) => {
- // const { title, logo } = layoutProps;
- // return (
- //
- //
- // {title}
- //
- //
- //
- //
- // {initialState?.name}
- //
- //
- // );
- // },
menuExtraRender: (props: any) => {
if (props?.matchMenuKeys[0] === '/setting') {
return null;
diff --git a/chaosmeta-platform-frontend/src/components/AddSpaceDrawer/index.tsx b/chaosmeta-platform-frontend/src/components/AddSpaceDrawer/index.tsx
index 4dd456f..d07da8f 100644
--- a/chaosmeta-platform-frontend/src/components/AddSpaceDrawer/index.tsx
+++ b/chaosmeta-platform-frontend/src/components/AddSpaceDrawer/index.tsx
@@ -49,7 +49,12 @@ const AddSpaceDrawer: React.FC = (props) => {
// 更新空间信息
handleUpdateSpaceId(res?.data?.id);
setOpen(false);
- history.push('/space/setting');
+ history.push({
+ pathname: '/space/setting',
+ query: {
+ spaceId: res?.data?.id,
+ },
+ });
}
},
});
@@ -58,9 +63,6 @@ const AddSpaceDrawer: React.FC = (props) => {
* 创建空间
*/
const handleCreate = () => {
- // setCurSpace()
- // handleUpdateSpaceId('20', 'ceshi')
- // return
form.validateFields().then((values) => {
create?.run(values);
});
diff --git a/chaosmeta-platform-frontend/src/components/Select/KubernetesNamespaceSelect/index.tsx b/chaosmeta-platform-frontend/src/components/Select/KubernetesNamespaceSelect/index.tsx
index 086dc47..e0f5ba3 100644
--- a/chaosmeta-platform-frontend/src/components/Select/KubernetesNamespaceSelect/index.tsx
+++ b/chaosmeta-platform-frontend/src/components/Select/KubernetesNamespaceSelect/index.tsx
@@ -24,7 +24,7 @@ const KubernetesNamespaceSelect = (props: IProps) => {
}
}, [list]);
- const getUser = useRequest(queryNamespaceList, {
+ const getNamespaceList = useRequest(queryNamespaceList, {
manual: true,
formatResult: (res: any) => res,
debounceInterval: 300,
@@ -37,15 +37,8 @@ const KubernetesNamespaceSelect = (props: IProps) => {
},
});
- // 输入有值时进行搜索
- // const handleUserSearch = (val: string) => {
- // if (val) {
- // getUser?.run({ identifier: val });
- // }
- // };
-
useEffect(() => {
- getUser?.run({ page: 1, page_size: 500 });
+ getNamespaceList?.run({ page: 1, page_size: 500 });
}, []);
return (
@@ -55,7 +48,7 @@ const KubernetesNamespaceSelect = (props: IProps) => {
showSearch
// onSearch={(val) => handleUserSearch(val)}
allowClear
- notFoundContent={getUser?.loading ? : null}
+ notFoundContent={getNamespaceList?.loading ? : null}
filterOption={false}
onChange={onChange}
placeholder={placeholder}
diff --git a/chaosmeta-platform-frontend/src/components/Select/KubernetesPodSelect/index.tsx b/chaosmeta-platform-frontend/src/components/Select/KubernetesPodSelect/index.tsx
index 2523720..31c827f 100644
--- a/chaosmeta-platform-frontend/src/components/Select/KubernetesPodSelect/index.tsx
+++ b/chaosmeta-platform-frontend/src/components/Select/KubernetesPodSelect/index.tsx
@@ -1,6 +1,6 @@
-import { queryNamespaceList, queryPodLIst } from '@/services/chaosmeta/KubernetesController';
+import { queryPodLIst } from '@/services/chaosmeta/KubernetesController';
import { useRequest } from '@umijs/max';
-import { Select, Spin, message } from 'antd';
+import { Empty, Select, Spin, message } from 'antd';
import { useEffect, useState } from 'react';
interface IProps {
@@ -11,10 +11,21 @@ interface IProps {
mode?: 'multiple' | 'tags';
placeholder?: string;
style?: any;
+ form?: any;
+ kubernetesNamespace?: any;
}
const KubernetesPodSelect = (props: IProps) => {
- const { value, onChange, list, mode, placeholder = '请选择', style } = props;
+ const {
+ value,
+ onChange,
+ list,
+ mode,
+ placeholder = '请选择',
+ style,
+ form,
+ kubernetesNamespace,
+ } = props;
const [namespaceList, setNamespaceList] = useState([]);
const { Option } = Select;
@@ -24,7 +35,7 @@ const KubernetesPodSelect = (props: IProps) => {
}
}, [list]);
- const getUser = useRequest(queryPodLIst, {
+ const getPodList = useRequest(queryPodLIst, {
manual: true,
formatResult: (res: any) => res,
debounceInterval: 300,
@@ -37,29 +48,40 @@ const KubernetesPodSelect = (props: IProps) => {
},
});
- // 输入有值时进行搜索
- // const handleUserSearch = (val: string) => {
- // if (val) {
- // getUser?.run({ identifier: val });
- // }
- // };
-
useEffect(() => {
- getUser?.run({ page: 1, page_size: 500 });
- }, []);
+ // 此项的展示是要依赖namespace的值进行检索,所以当namespace值改变时需要清空列表项和值
+ setNamespaceList([]);
+ form.setFieldValue(['exec_range', 'target_name'], undefined);
+ }, [kubernetesNamespace]);
return (