import { Job } from '@prisma/client'; import useGPUInfo from '@/hooks/useGPUInfo'; import GPUWidget from '@/components/GPUWidget'; import FilesWidget from '@/components/FilesWidget'; import { getJobConfig, getTotalSteps } from '@/utils/jobs'; import { Cpu, HardDrive, Info } from 'lucide-react'; import { useMemo } from 'react'; interface JobOverviewProps { job: Job; } export default function JobOverview({ job }: JobOverviewProps) { const gpuIds = useMemo(() => job.gpu_ids.split(',').map(id => parseInt(id)), [job.gpu_ids]); const { gpuList, isGPUInfoLoaded } = useGPUInfo(gpuIds, 5000); const totalSteps = getTotalSteps(job); const progress = (job.step / totalSteps) * 100; const isStopping = job.stop && job.status === 'running'; const getStatusColor = (status: string) => { switch (status.toLowerCase()) { case 'running': return 'bg-emerald-500/10 text-emerald-500'; case 'stopping': return 'bg-amber-500/10 text-amber-500'; case 'stopped': return 'bg-gray-500/10 text-gray-400'; case 'completed': return 'bg-blue-500/10 text-blue-500'; case 'error': return 'bg-rose-500/10 text-rose-500'; default: return 'bg-gray-500/10 text-gray-400'; } }; let status = job.status; if (isStopping) { status = 'stopping'; } return (
Job Name
{job.name}
Assigned GPUs
GPUs: {job.gpu_ids}
Additional Information
{job.info}