fix(cluster-create): hide ProviderCatalog when entering via providerHint
The catalog was gated on ``currentStep === startStep`` so it would re-appear at step 1 whenever ``providerHint`` skipped the catalog (e.g. GPU Service's "Add a Kubernetes Cluster" empty-state CTA). Result: the configure step rendered the catalog *plus* the Name/Description/Advanced form together, with Kubernetes shown as already selected — confusing and ugly. Pin the catalog to step 0 explicitly. ``startStep`` was only used to seed ``currentStep``, so it's inlined into the ``useState`` initializer to keep the "skip the catalog when providerHint is set" intent in one place. Pre-selecting a provider now correctly lands the user straight on the configure form alone.
This commit is contained in:
@@ -62,16 +62,15 @@ const ClusterCreate: React.FC<{
|
|||||||
setCurrentTitle?: (title: string) => void;
|
setCurrentTitle?: (title: string) => void;
|
||||||
onClose?: () => void;
|
onClose?: () => void;
|
||||||
}> = ({ onClose, action, providerHint, setCurrentTitle }) => {
|
}> = ({ onClose, action, providerHint, setCurrentTitle }) => {
|
||||||
// When the caller already picked a provider for us, start one step
|
|
||||||
// in — provider catalog is step 0; configure is step 1.
|
|
||||||
const startStep = providerHint ? 1 : 0;
|
|
||||||
const stepList = useStepList();
|
const stepList = useStepList();
|
||||||
const [systemConfigState] = useAtom(systemConfigAtom);
|
const [systemConfigState] = useAtom(systemConfigAtom);
|
||||||
const intl = useIntl();
|
const intl = useIntl();
|
||||||
const [credentialList, setCredentialList] = useState<
|
const [credentialList, setCredentialList] = useState<
|
||||||
Global.BaseOption<number, { provider: ProviderType }>[]
|
Global.BaseOption<number, { provider: ProviderType }>[]
|
||||||
>([]);
|
>([]);
|
||||||
const [currentStep, setCurrentStep] = useState<number>(startStep);
|
// When the caller already picked a provider for us, start one step
|
||||||
|
// in — provider catalog is step 0; configure is step 1.
|
||||||
|
const [currentStep, setCurrentStep] = useState<number>(providerHint ? 1 : 0);
|
||||||
const [registrationInfo, setRegistrationInfo] = useState<{
|
const [registrationInfo, setRegistrationInfo] = useState<{
|
||||||
token: string;
|
token: string;
|
||||||
image: string;
|
image: string;
|
||||||
@@ -357,7 +356,12 @@ const ClusterCreate: React.FC<{
|
|||||||
}
|
}
|
||||||
>
|
>
|
||||||
<div style={{ flex: 1 }}>
|
<div style={{ flex: 1 }}>
|
||||||
{currentStep === startStep && (
|
{currentStep === 0 && (
|
||||||
|
// Catalog belongs to step 0 only. The previous gate used
|
||||||
|
// ``startStep`` which is 1 when ``providerHint`` skips the
|
||||||
|
// catalog — that wrongly re-rendered it on top of the
|
||||||
|
// configure form for entry points like "Add a Kubernetes
|
||||||
|
// Cluster".
|
||||||
<ProviderCatalog
|
<ProviderCatalog
|
||||||
cols={2}
|
cols={2}
|
||||||
dataList={providerList}
|
dataList={providerList}
|
||||||
|
|||||||
Reference in New Issue
Block a user