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.
77 lines
1.8 KiB
TypeScript
77 lines
1.8 KiB
TypeScript
import { ClusterListItem } from '@/pages/cluster-management/config/types';
|
|
import { atom } from 'jotai';
|
|
|
|
// models expand keys: create, update , delete,
|
|
export const expandKeysAtom = atom<string[]>([]);
|
|
|
|
export const regionListAtom = atom<
|
|
{
|
|
datacenter: string;
|
|
label: string;
|
|
value: string;
|
|
icon: string;
|
|
sizes: string[];
|
|
}[]
|
|
>([]);
|
|
|
|
export const regionInstanceTypeListAtom = atom<
|
|
{
|
|
label: string;
|
|
value: string;
|
|
description: string;
|
|
specInfo: Record<string, any>;
|
|
vendor: string;
|
|
available: boolean;
|
|
regions: string[];
|
|
}[]
|
|
>([]);
|
|
|
|
export const regionOSImageListAtom = atom<
|
|
{
|
|
label: string;
|
|
value: string;
|
|
os_image: string;
|
|
name: string;
|
|
description: string;
|
|
vendor: string;
|
|
specInfo: Record<string, any>;
|
|
regions: string[];
|
|
}[]
|
|
>([]);
|
|
|
|
export const allRegionOSImageListAtom = atom<
|
|
{
|
|
label: string;
|
|
value: string;
|
|
regions: string[];
|
|
}[]
|
|
>([]);
|
|
|
|
export const allRegionInstanceTypeListAtom = atom<
|
|
{
|
|
label: string;
|
|
value: string;
|
|
regions: string[];
|
|
}[]
|
|
>([]);
|
|
|
|
export const fromClusterCreationAtom = atom(false);
|
|
|
|
/**
|
|
* for temporary cluster session storage during creation/editing
|
|
*/
|
|
export const clusterSessionAtom = atom<{
|
|
firstAddWorker: boolean;
|
|
firstAddCluster: boolean;
|
|
// Provider to preselect when the create flow opens — set by the
|
|
// empty-state CTA on feature pages that need a specific provider
|
|
// (e.g. GPU Service can only schedule on Kubernetes, so its
|
|
// "Add Cluster" button skips provider catalog and lands on the
|
|
// K8s configure step). Consumed once by ClusterCreate on mount.
|
|
providerHint?: string;
|
|
} | null>(null);
|
|
|
|
export const clusterDetailAtom = atom<ClusterListItem | null>(null);
|
|
|
|
export const workerAddedCountAtom = atom(0);
|