fix: provder disabled click in k8s

This commit is contained in:
jialin
2025-09-16 11:26:17 +08:00
parent 913f2f5077
commit c9c9401b0b
8 changed files with 31 additions and 412 deletions
@@ -6,7 +6,7 @@ import styled from 'styled-components';
import { ProviderType, ProviderValueMap } from '../config';
import AddWorkerCommand from './add-worker-command';
import RegisterClusterInner from './register-cluster-inner';
import SupportedHardware from './support-hardware';
import SupportedGPUs from './support-gpus';
const Title = styled.div`
font-size: 16px;
@@ -63,7 +63,8 @@ const AddWorkerStep: React.FC<AddModalProps> = ({
registrationInfo
}) => {
const intl = useIntl();
const [currentProvider, setCurrentProvider] = React.useState<string>('cuda');
const [currentSelection, setCurrentSelection] =
React.useState<string>('cuda');
const [workerCommand, setWorkerCommand] = React.useState<Record<string, any>>(
{
label: 'NVIDIA',
@@ -71,8 +72,9 @@ const AddWorkerStep: React.FC<AddModalProps> = ({
}
);
const handleSelectProvider = (provider: string, item: any) => {
setCurrentProvider(provider);
const handleSelectProvider = (value: string, item: any) => {
if (provider !== ProviderValueMap.Docker) return;
setCurrentSelection(value);
setWorkerCommand(item);
};
@@ -81,9 +83,10 @@ const AddWorkerStep: React.FC<AddModalProps> = ({
<Title>
{intl.formatMessage({ id: 'clusters.create.supportedGpu' })}
</Title>
<SupportedHardware
<SupportedGPUs
onSelect={handleSelectProvider}
currentProvider={currentProvider}
current={provider === ProviderValueMap.Docker ? currentSelection : ''}
clickable={provider === ProviderValueMap.Docker}
/>
{provider === ProviderValueMap.Docker && (
<Content>