fix: update add worker command

This commit is contained in:
jialin
2025-12-10 15:50:53 +08:00
parent d8452e98f5
commit 7fdabd90a5
15 changed files with 56 additions and 48 deletions
@@ -5,6 +5,7 @@ import { SummaryDataKey } from './config';
interface AddWorkerContextProps {
clusterList?: Global.BaseOption<number, ClusterListItem>[];
clusterLoading?: boolean;
provider: ProviderType;
stepList: string[];
onClusterChange?: (value: number, row?: any) => void;
@@ -30,6 +30,7 @@ const Container = styled.div`
type AddWorkerProps = {
provider: ProviderType;
clusterList?: Global.BaseOption<number, ClusterListItem>[];
clusterLoading?: boolean;
stepList: StepName[];
onClusterChange?: (value: number, row?: any) => void;
registrationInfo: {
@@ -50,6 +51,7 @@ const AddWorkerSteps: React.FC<AddWorkerProps> = (props) => {
registrationInfo,
provider,
clusterList,
clusterLoading,
stepList = [],
onClusterChange
} = props || {};
@@ -77,6 +79,7 @@ const AddWorkerSteps: React.FC<AddWorkerProps> = (props) => {
<AddWorkerContext.Provider
value={{
clusterList,
clusterLoading,
provider,
stepList: stepList,
collapseKey,
@@ -1,27 +1,17 @@
import ScrollerModal from '@/components/scroller-modal';
import React, { useEffect } from 'react';
import styled from 'styled-components';
import { queryClusterToken } from '../../apis';
import { ProviderType } from '../../config';
import { ClusterListItem } from '../../config/types';
import AddWorkerStep from './add-worker-step';
import { StepName } from './config';
const Container = styled.div`
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 16px;
.command-info {
margin-bottom: 8px;
}
`;
type AddWorkerProps = {
open: boolean;
provider: ProviderType;
title: string;
clusterList?: Global.BaseOption<number, ClusterListItem>[];
clusterLoading?: boolean;
stepList: StepName[];
onClusterChange?: (value: number, row?: any) => void;
onCancel: () => void;
@@ -47,6 +37,7 @@ const AddWorker: React.FC<AddWorkerProps> = (props) => {
cluster_id,
title,
clusterList,
clusterLoading,
stepList = []
} = props || {};
const firstLoad = React.useRef(true);
@@ -103,6 +94,7 @@ const AddWorker: React.FC<AddWorkerProps> = (props) => {
stepList={stepList}
provider={provider}
clusterList={clusterList}
clusterLoading={clusterLoading}
onClusterChange={handleOnClusterChange}
registrationInfo={registrationInfo}
></AddWorkerStep>
@@ -1,5 +1,6 @@
import BaseSelect from '@/components/seal-form/base/select';
import { useIntl } from '@umijs/max';
import { Spin } from 'antd';
import { useEffect } from 'react';
import { useAddWorkerContext } from './add-worker-context';
import { StepNamesMap } from './config';
@@ -9,6 +10,7 @@ import StepCollapse from './step-collapse';
const SelectCluster = () => {
const {
clusterList,
clusterLoading,
registrationInfo,
stepList,
summary,
@@ -55,13 +57,15 @@ const SelectCluster = () => {
</div>
}
>
<BaseSelect
defaultValue={registrationInfo.cluster_id}
options={clusterList}
value={clusterId}
onChange={onClusterChange}
style={{ width: '100%' }}
/>
<Spin spinning={clusterLoading}>
<BaseSelect
defaultValue={registrationInfo.cluster_id}
options={clusterList}
value={clusterId}
onChange={onClusterChange}
style={{ width: '100%' }}
/>
</Spin>
</StepCollapse>
);
};
@@ -43,7 +43,7 @@ const FooterButtons: React.FC<FooterButtonsProps> = (props) => {
)}
{showButtons.skip && (
<Button type="primary" onClick={handleCancel}>
{intl.formatMessage({ id: 'clusters.create.skipfornow' })}
{intl.formatMessage({ id: 'common.button.done' })}
</Button>
)}
{showButtons.save && (