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.
57 lines
1.3 KiB
TypeScript
57 lines
1.3 KiB
TypeScript
import { PageAction } from '@/config';
|
|
import { GSDrawer } from '@gpustack/core-ui';
|
|
import React from 'react';
|
|
import ClusterCreate from './cluster-create';
|
|
|
|
interface ClusterModalProps {
|
|
open: boolean;
|
|
title: string;
|
|
// When set, ClusterCreate preselects this provider and skips the
|
|
// provider-catalog step. Used by feature pages (e.g. GPU Service)
|
|
// whose empty state already implies which kind of cluster is needed.
|
|
providerHint?: string;
|
|
onClose: () => void;
|
|
}
|
|
|
|
const ClusterModal: React.FC<ClusterModalProps> = ({
|
|
open,
|
|
onClose,
|
|
title,
|
|
providerHint
|
|
}) => {
|
|
const [currentTitle, setCurrentTitle] = React.useState<string>(title);
|
|
const handleCancel = () => {
|
|
onClose();
|
|
};
|
|
|
|
return (
|
|
<GSDrawer
|
|
title={currentTitle}
|
|
open={open}
|
|
onClose={handleCancel}
|
|
destroyOnHidden={true}
|
|
closeIcon={false}
|
|
mask={{
|
|
closable: false
|
|
}}
|
|
keyboard={false}
|
|
styles={{
|
|
body: {
|
|
paddingBlock: 0
|
|
},
|
|
wrapper: { width: 710 }
|
|
}}
|
|
footer={false}
|
|
>
|
|
<ClusterCreate
|
|
onClose={handleCancel}
|
|
action={PageAction.CREATE}
|
|
providerHint={providerHint}
|
|
setCurrentTitle={setCurrentTitle}
|
|
></ClusterCreate>
|
|
</GSDrawer>
|
|
);
|
|
};
|
|
|
|
export default ClusterModal;
|