diff --git a/apps/deepsirius-ui/src/components/workboard/create-new-workspace.tsx b/apps/deepsirius-ui/src/components/workboard/create-new-workspace.tsx index 8d7c57a..785b974 100644 --- a/apps/deepsirius-ui/src/components/workboard/create-new-workspace.tsx +++ b/apps/deepsirius-ui/src/components/workboard/create-new-workspace.tsx @@ -8,10 +8,7 @@ import { z } from 'zod'; import { Button } from '~/components/ui/button'; import { env } from '~/env.mjs'; import { useStoreActions } from '~/hooks/use-store'; -import { - checkStatusRefetchInterval, - slurmPartitionOptions, -} from '~/lib/constants'; +import { checkStatusRefetchInterval } from '~/lib/constants'; import { api } from '~/utils/api'; import { NautilusDialog } from '../nautilus'; @@ -41,6 +38,7 @@ interface NewWorkspaceState { } export function CreateNewWorkspace({ userRoute }: { userRoute: string }) { + const userPartitions = api.job.userPartitions.useQuery(); const router = useRouter(); const { resetStore, setWorkspaceInfo } = useStoreActions(); const [basePath, setBasePath] = useState(env.NEXT_PUBLIC_STORAGE_PATH); @@ -149,7 +147,7 @@ export function CreateNewWorkspace({ userRoute }: { userRoute: string }) { .object({ workspaceBasePath: z.string().endsWith('/'), workspaceName: z.string().min(1), - slurmPartition: z.enum(slurmPartitionOptions), + slurmPartition: z.string(), }) .superRefine(({ workspaceName }, ctx) => { if (basePathLsQuery.error) { @@ -284,25 +282,50 @@ export function CreateNewWorkspace({ userRoute }: { userRoute: string }) { render={({ field }) => ( Slurm Partition - - {slurmPartitionOptions.map((item) => ( - - {item} + {userPartitions.data?.partitions.map((option) => ( + + + {option.partition} + + + + {option.cpus.free} + + /{option.cpus.max} cpus,{' '} + + {option.gpus.free} + + /{option.gpus.max} gpus + ))} - - This is the slurm partition to use for the workspace - creation job. + + Please select a slurm partition assigned for your user for + submitting this job. - + + {userPartitions.isError && + `Error loading partitions: ${userPartitions.error.message}`} + {userPartitions.isLoading && `Searching user partitions...`} + )} />