feat: benchmark detail actions

This commit is contained in:
jialin
2026-02-01 22:56:36 +08:00
parent 0849a2f114
commit 9796233897
12 changed files with 268 additions and 103 deletions
+8 -20
View File
@@ -3,7 +3,6 @@ import SealSelect from '@/components/seal-form/seal-select';
import { PageAction } from '@/config';
import useAppUtils from '@/hooks/use-app-utils';
import { ClusterStatusValueMap } from '@/pages/cluster-management/config';
import { useQueryClusterList } from '@/pages/cluster-management/services/use-query-cluster-list';
import { useIntl } from '@umijs/max';
import { Form } from 'antd';
import React, { useEffect } from 'react';
@@ -15,13 +14,7 @@ const BasicForm: React.FC = () => {
const intl = useIntl();
const form = Form.useFormInstance();
const { getRuleMessage } = useAppUtils();
const { action, open } = useFormContext();
const {
loading: clusterLoading,
fetchClusterList,
cancelRequest: cancelClusterRequest,
clusterList
} = useQueryClusterList();
const { action, open, clusterList } = useFormContext();
useEffect(() => {
const initClusterId = (list: any[]) => {
@@ -37,18 +30,14 @@ const BasicForm: React.FC = () => {
return cluster_id;
};
fetchClusterList({ page: -1 }).then((list) => {
if (list.length > 0 && action === PageAction.CREATE) {
form.setFieldValue('cluster_id', initClusterId(list));
}
});
}, [form, action]);
useEffect(() => {
if (!open) {
cancelClusterRequest();
if (
clusterList &&
clusterList?.length > 0 &&
action === PageAction.CREATE
) {
form.setFieldValue('cluster_id', initClusterId(clusterList));
}
}, [open]);
}, [form, action, clusterList]);
return (
<>
@@ -78,7 +67,6 @@ const BasicForm: React.FC = () => {
>
<SealSelect
disabled={action === PageAction.EDIT}
loading={clusterLoading}
options={clusterList}
label={intl.formatMessage({ id: 'clusters.title' })}
required