fix: collapse GPU Service menu in Personal Org; add K8s-direct CTA

Two follow-ups to the GPU Service gating:

- In Personal-Org view the access extension was stripping
  canSeeAdmin/canSeeOrgAdmin but leaving canSeeGpuService at its
  admin-shortcut value, so platform admins switched into Personal
  still saw the menu even though Personal scope can't host a K8s
  cluster. Mirror the probe result through sessionStorage so the
  extension can fall back to the strict cluster-availability signal
  in that branch.

- The empty-state CTA now reads 'Add a Kubernetes Cluster' and, on
  click, opens the cluster-create flow with Kubernetes preselected
  via clusterSession.providerHint. ClusterCreate consumes the hint
  on mount: it seeds extraData.provider and starts at the configure
  step instead of the provider catalog, so the user lands one click
  closer to the form they actually need.
This commit is contained in:
gitlawr
2026-05-27 13:41:32 +08:00
committed by jialin
parent 6b47bacfac
commit 96e6ddfe8a
11 changed files with 79 additions and 10 deletions
@@ -55,10 +55,16 @@ const MainWrapper = styled.div`
const ClusterCreate: React.FC<{
action: PageActionType;
// Preselect a provider and skip the provider-catalog step. Set by
// empty-state CTAs that already know which kind of cluster the user
// is heading for (e.g. GPU Service's "Add a Kubernetes Cluster").
providerHint?: string;
setCurrentTitle?: (title: string) => void;
onClose?: () => void;
}> = ({ onClose, action, setCurrentTitle }) => {
const startStep = 0;
}> = ({ 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 [systemConfigState] = useAtom(systemConfigAtom);
const intl = useIntl();
@@ -79,7 +85,7 @@ const ClusterCreate: React.FC<{
cluster_id: 0
});
const [extraData, setExtraData] = useState<ClusterFormData>({
provider: ProviderValueMap.Docker
provider: (providerHint as ProviderType) ?? ProviderValueMap.Docker
} as ClusterFormData);
const [formValues, setFormValues] = useState<Record<string, any>>({});
const [submitLoading, setSubmitLoading] = useState<boolean>(false);