fix: add worker title
This commit is contained in:
@@ -308,6 +308,9 @@ const ClusterCreate: React.FC<{
|
||||
cluster_id: res.id
|
||||
});
|
||||
checkDefaultCluster();
|
||||
if (extraData.provider === ProviderValueMap.DigitalOcean) {
|
||||
onClose?.();
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@ import type { PageActionType } from '@/config/types';
|
||||
import useExpandedRowKeys from '@/hooks/use-expanded-row-keys';
|
||||
import useTableFetch from '@/hooks/use-table-fetch';
|
||||
import useWatchList from '@/hooks/use-watch-list';
|
||||
import { useIntl, useNavigate } from '@umijs/max';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { message } from 'antd';
|
||||
import { useAtom } from 'jotai';
|
||||
@@ -75,7 +75,6 @@ const Clusters: React.FC = () => {
|
||||
const [clusterSession, setClusterSession] = useAtom(clusterSessionAtom);
|
||||
const { handleExpandChange, handleExpandAll, expandedRowKeys } =
|
||||
useExpandedRowKeys(expandAtom);
|
||||
const navigate = useNavigate();
|
||||
const intl = useIntl();
|
||||
const { handleAddWorker, checkDefaultCluster, AddWorkerModal, setStepList } =
|
||||
useAddWorker({});
|
||||
|
||||
@@ -1,16 +1,10 @@
|
||||
import { useIntl, useNavigate } from '@umijs/max';
|
||||
import { useMemoizedFn } from 'ahooks';
|
||||
import { useIntl } from '@umijs/max';
|
||||
import { useMemo } from 'react';
|
||||
import { ProviderType, ProviderValueMap } from '../config';
|
||||
import { moduleMap } from './module-registry';
|
||||
|
||||
export default function useStepList() {
|
||||
const intl = useIntl();
|
||||
const navigate = useNavigate();
|
||||
|
||||
const handleBack = useMemoizedFn(() => {
|
||||
navigate(-1);
|
||||
});
|
||||
|
||||
return useMemo(
|
||||
() => [
|
||||
@@ -70,8 +64,7 @@ export default function useStepList() {
|
||||
defaultShow: false,
|
||||
showForms: [moduleMap.WorkerPoolForm],
|
||||
showModules: [],
|
||||
providers: [ProviderValueMap.DigitalOcean],
|
||||
beforeNext: handleBack
|
||||
providers: [ProviderValueMap.DigitalOcean]
|
||||
},
|
||||
{
|
||||
title: intl.formatMessage({ id: 'clusters.create.steps.complete' }),
|
||||
@@ -130,6 +123,6 @@ export default function useStepList() {
|
||||
providers: [ProviderValueMap.Kubernetes]
|
||||
}
|
||||
],
|
||||
[handleBack, intl]
|
||||
[intl]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import useTableFetch from '@/hooks/use-table-fetch';
|
||||
import PageBox from '@/pages/_components/page-box';
|
||||
import { queryClusterList } from '@/pages/cluster-management/apis';
|
||||
import { DockerStepsFromWorker } from '@/pages/cluster-management/components/add-worker/config';
|
||||
import { ProviderValueMap } from '@/pages/cluster-management/config';
|
||||
import { ClusterListItem } from '@/pages/cluster-management/config/types';
|
||||
import useAddWorker from '@/pages/cluster-management/hooks/use-add-worker';
|
||||
import useNoResourceResult from '@/pages/llmodels/hooks/use-no-resource-result';
|
||||
@@ -191,8 +192,12 @@ const Workers: React.FC = () => {
|
||||
});
|
||||
|
||||
const handleOnAddWorker = () => {
|
||||
const targetCluster = checkDefaultCluster(clusterData.list);
|
||||
if (targetCluster) {
|
||||
if (clusterData.list.length > 0) {
|
||||
// filter only docker clusters for add worker
|
||||
const list = clusterData.list.filter(
|
||||
(item) => item.provider === ProviderValueMap.Docker
|
||||
);
|
||||
const targetCluster = checkDefaultCluster(list);
|
||||
handleAddWorker(targetCluster as ClusterListItem);
|
||||
} else {
|
||||
message.info(intl.formatMessage({ id: 'noresult.resources.cluster' }));
|
||||
|
||||
Reference in New Issue
Block a user