@milabench/bujang 0.0.0-stage → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/README.md +108 -2
  2. package/dist/api.d.ts +151 -0
  3. package/dist/components/AutocompleteInput.d.ts +15 -0
  4. package/dist/components/MonacoEditor.d.ts +11 -0
  5. package/dist/components/toaster.d.ts +2 -0
  6. package/dist/components/tooltip.d.ts +11 -0
  7. package/dist/constants.d.ts +3 -0
  8. package/dist/context.d.ts +44 -0
  9. package/dist/hooks/useColorMode.d.ts +4 -0
  10. package/dist/hooks/usePageTitle.d.ts +2 -0
  11. package/dist/index.d.ts +26 -0
  12. package/dist/index.js +5036 -0
  13. package/dist/index.js.map +1 -0
  14. package/dist/paths.d.ts +26 -0
  15. package/dist/routes.d.ts +22 -0
  16. package/dist/theme.css +72 -0
  17. package/dist/toast.d.ts +18 -0
  18. package/dist/types.d.ts +474 -0
  19. package/dist/views/AgentActivityView.d.ts +8 -0
  20. package/dist/views/JobDetails.d.ts +2 -0
  21. package/dist/views/JobLogs.d.ts +4 -0
  22. package/dist/views/JobSubmit.d.ts +22 -0
  23. package/dist/views/JobSubmitView.d.ts +2 -0
  24. package/dist/views/JobsView.d.ts +4 -0
  25. package/dist/views/LogDisplay.d.ts +11 -0
  26. package/dist/views/PipelinesView.d.ts +2 -0
  27. package/dist/views/ScheduledJobsView.d.ts +2 -0
  28. package/package.json +70 -4
  29. package/src/api.ts +602 -0
  30. package/src/components/AutocompleteInput.tsx +253 -0
  31. package/src/components/MonacoEditor.tsx +163 -0
  32. package/src/components/toaster.tsx +38 -0
  33. package/src/components/tooltip.tsx +52 -0
  34. package/src/constants.ts +3 -0
  35. package/src/context.tsx +106 -0
  36. package/src/hooks/useColorMode.ts +31 -0
  37. package/src/hooks/usePageTitle.ts +21 -0
  38. package/src/index.ts +33 -0
  39. package/src/paths.ts +71 -0
  40. package/src/routes.tsx +55 -0
  41. package/src/theme.css +72 -0
  42. package/src/toast.ts +35 -0
  43. package/src/types.ts +542 -0
  44. package/src/views/AgentActivityView.tsx +262 -0
  45. package/src/views/JobDetails.tsx +675 -0
  46. package/src/views/JobLogs.tsx +987 -0
  47. package/src/views/JobSubmit.tsx +1272 -0
  48. package/src/views/JobSubmitView.tsx +69 -0
  49. package/src/views/JobsView.tsx +736 -0
  50. package/src/views/LogDisplay.tsx +171 -0
  51. package/src/views/PipelinesView.tsx +1318 -0
  52. package/src/views/ScheduledJobsView.tsx +735 -0
@@ -0,0 +1,675 @@
1
+ import React, { useState } from 'react';
2
+ import { useParams, useNavigate, Link } from 'react-router-dom';
3
+ import { useBujangPaths } from '../context';
4
+ import { usePageTitle } from '../hooks/usePageTitle';
5
+ import {
6
+ Box,
7
+ Heading,
8
+ Text,
9
+ VStack,
10
+ HStack,
11
+ Button,
12
+ Badge,
13
+ Tabs,
14
+ Card,
15
+ Accordion,
16
+ Code,
17
+ Spinner,
18
+ Alert,
19
+ Grid,
20
+ } from '@chakra-ui/react';
21
+ import {
22
+ LuArrowLeft,
23
+ LuEye,
24
+ LuCircleCheck,
25
+ LuTriangleAlert,
26
+ LuClock,
27
+ LuInfo,
28
+ } from 'react-icons/lu';
29
+ import { useQuery } from '@tanstack/react-query';
30
+ import {
31
+ getSlurmJobs,
32
+ getSlurmJobInfo,
33
+ getSlurmJobStdout,
34
+ getSlurmJobStderr,
35
+ } from '../api';
36
+ import type { SlurmJob, SlurmJobDetail } from '../types';
37
+
38
+ import { NO_JOB_ID, NO_JOB_STATE } from '../constants';
39
+
40
+ const getStatusColor = (status: string) => {
41
+ switch (status?.toLowerCase()) {
42
+ case 'running':
43
+ case 'r':
44
+ return 'green';
45
+ case 'pending':
46
+ case 'pd':
47
+ return 'yellow';
48
+ case 'completed':
49
+ case 'cd':
50
+ return 'blue';
51
+ case 'failed':
52
+ case 'f':
53
+ return 'red';
54
+ case 'cancelled':
55
+ case 'ca':
56
+ return 'gray';
57
+ default:
58
+ return 'gray';
59
+ }
60
+ };
61
+
62
+ const getStatusIcon = (status: string) => {
63
+ switch (status?.toLowerCase()) {
64
+ case 'running':
65
+ case 'r':
66
+ return <LuCircleCheck color="green" />;
67
+ case 'pending':
68
+ case 'pd':
69
+ return <LuClock color="yellow" />;
70
+ case 'completed':
71
+ case 'cd':
72
+ return <LuCircleCheck color="blue" />;
73
+ case 'failed':
74
+ case 'f':
75
+ return <LuTriangleAlert color="red" />;
76
+ default:
77
+ return <LuInfo color="gray" />;
78
+ }
79
+ };
80
+
81
+ const formatTimeLimit = (timeLimit: string | { number: number; set: boolean; infinite: boolean } | undefined): string => {
82
+ if (!timeLimit) return 'N/A';
83
+ if (typeof timeLimit === 'string') return timeLimit;
84
+ if (timeLimit.infinite) return 'Infinite';
85
+ if (timeLimit.number) return `${timeLimit.number} minutes`;
86
+ return 'N/A';
87
+ };
88
+
89
+ export const JobDetailsView: React.FC = () => {
90
+ const { slurmJobId, jrJobId } = useParams<{ slurmJobId: string; jrJobId: string }>();
91
+
92
+ const navigate = useNavigate();
93
+ const paths = useBujangPaths();
94
+ // Get all jobs to find the specific job
95
+ const { data: jobsData, isLoading: jobsLoading, error: jobsError } = useQuery({
96
+ queryKey: ['slurm-jobs'],
97
+ queryFn: getSlurmJobs,
98
+ refetchOnWindowFocus: false,
99
+ staleTime: 30000,
100
+ });
101
+
102
+ // Find the specific job by slurm job id
103
+ const job = jobsData?.find((j: SlurmJob) => j.job_id === slurmJobId);
104
+
105
+ // Get job info (automatically handles cache for persisted jobs)
106
+ const { data: jobInfo, isLoading: infoLoading, error: infoError } = useQuery({
107
+ queryKey: ['slurm-job-info', jrJobId, slurmJobId],
108
+ queryFn: () => getSlurmJobInfo(jrJobId!, slurmJobId),
109
+ enabled: !!jrJobId,
110
+ });
111
+
112
+ // Get job stdout
113
+ const { data: stdout, isLoading: stdoutLoading, error: stdoutError } = useQuery({
114
+ queryKey: ['slurm-job-stdout', jrJobId],
115
+ queryFn: () => getSlurmJobStdout(jrJobId!),
116
+ enabled: !!jrJobId,
117
+ });
118
+
119
+ // Get job stderr
120
+ const { data: stderr, isLoading: stderrLoading, error: stderrError } = useQuery({
121
+ queryKey: ['slurm-job-stderr', jrJobId],
122
+ queryFn: () => getSlurmJobStderr(jrJobId!),
123
+ enabled: !!jrJobId,
124
+ });
125
+
126
+ const handleBack = () => {
127
+ navigate(paths.jobs());
128
+ };
129
+
130
+ // Set page title with the best available job ID
131
+ const displayJobId = jobInfo?.job_id || job?.job_id || slurmJobId || NO_JOB_ID;
132
+ usePageTitle(`Job Details - ${displayJobId}`);
133
+
134
+ // Show loading if we're still loading initial jobs data or job info
135
+ const isLoading = jobsLoading || (!!jrJobId && infoLoading);
136
+
137
+ if (isLoading) {
138
+ return (
139
+ <Box p={6} textAlign="center">
140
+ <Spinner size="lg" />
141
+ <Text mt={4}>Loading job information...</Text>
142
+ </Box>
143
+ );
144
+ }
145
+
146
+ // Check if we have any displayable information
147
+ const canDisplayJob = job || jobInfo;
148
+ const hasParameters = slurmJobId || jrJobId; // Fixed: should work if we have either parameter
149
+
150
+ // Only show "Job Not Found" if we have no information AND we've tried all possible sources
151
+ if (!canDisplayJob && !hasParameters) {
152
+ return (
153
+ <Box p={6}>
154
+ <VStack align="stretch" gap={6}>
155
+ <HStack>
156
+ <Button onClick={handleBack} variant="ghost">
157
+ <LuArrowLeft />
158
+ Back to Jobs
159
+ </Button>
160
+ </HStack>
161
+ <Alert.Root status="warning">
162
+ <Alert.Indicator />
163
+ <Alert.Content>
164
+ <Alert.Title>Job Not Found</Alert.Title>
165
+ <Alert.Description>
166
+ Job with ID {slurmJobId} was not found and no additional parameters are available to retrieve detailed information.
167
+ </Alert.Description>
168
+ </Alert.Content>
169
+ </Alert.Root>
170
+ </VStack>
171
+ </Box>
172
+ );
173
+ }
174
+
175
+ return (
176
+ <Box p={6}>
177
+ <VStack align="stretch" gap={6}>
178
+ <HStack>
179
+ <Button onClick={handleBack} variant="ghost">
180
+ <LuArrowLeft />
181
+ Back to Jobs
182
+ </Button>
183
+ {jrJobId && (
184
+ <Button
185
+ asChild
186
+ variant="outline"
187
+ colorScheme="blue"
188
+ >
189
+ <Link to={paths.jobLogs(slurmJobId || NO_JOB_ID, jrJobId)}>
190
+ <HStack gap={2} as="span">
191
+ <LuEye />
192
+ <Text>View Logs</Text>
193
+ </HStack>
194
+ </Link>
195
+ </Button>
196
+ )}
197
+ </HStack>
198
+
199
+ <Box>
200
+ <Heading size="lg" mb={2}>Job Details</Heading>
201
+ <Text color="var(--color-text-muted)">
202
+ Slurm Job ID: {slurmJobId} | JR Job ID: {jrJobId}
203
+ </Text>
204
+ </Box>
205
+
206
+ {/* Show informational message for persisted jobs */}
207
+ {!job && jobInfo && (
208
+ <Alert.Root status="info">
209
+ <Alert.Indicator />
210
+ <Alert.Content>
211
+ <Alert.Title>Persisted Job</Alert.Title>
212
+ <Alert.Description>
213
+ This job is no longer active but stored information is being displayed.
214
+ </Alert.Description>
215
+ </Alert.Content>
216
+ </Alert.Root>
217
+ )}
218
+
219
+ {/* Show warnings for failed API calls */}
220
+ {(jobsError || infoError) && (
221
+ <Alert.Root status="warning">
222
+ <Alert.Indicator />
223
+ <Alert.Content>
224
+ <Alert.Title>Partial Information Available</Alert.Title>
225
+ <Alert.Description>
226
+ Some job information could not be loaded, but available data will be displayed.
227
+ </Alert.Description>
228
+ </Alert.Content>
229
+ </Alert.Root>
230
+ )}
231
+
232
+ {/* Job Summary Card */}
233
+ <Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)">
234
+ <Card.Header>
235
+ <HStack justify="space-between">
236
+ <Heading size="md">Job Summary</Heading>
237
+ <HStack>
238
+ {getStatusIcon(jobInfo?.job_state?.[0] || job?.job_state?.[0] || '')}
239
+ <Badge colorScheme={getStatusColor(jobInfo?.job_state?.[0] || job?.job_state?.[0] || '')}>
240
+ {jobInfo?.job_state?.[0] || job?.job_state?.[0] || NO_JOB_ID}
241
+ </Badge>
242
+ </HStack>
243
+ </HStack>
244
+ </Card.Header>
245
+ <Card.Body>
246
+ <Grid templateColumns="repeat(2, 1fr)" gap={4}>
247
+ <Box>
248
+ <Text fontWeight="bold">Slurm Job ID</Text>
249
+ <Text fontFamily="mono">{jobInfo?.job_id || job?.job_id || slurmJobId}</Text>
250
+ </Box>
251
+ <Box>
252
+ <Text fontWeight="bold">JR Job ID</Text>
253
+ <Text fontFamily="mono" fontSize="sm">
254
+ {typeof job?.jr_job_id === 'string' ? job.jr_job_id : jrJobId || 'N/A'}
255
+ </Text>
256
+ </Box>
257
+ <Box>
258
+ <Text fontWeight="bold">Name</Text>
259
+ <Text>{jobInfo?.name || job?.name || 'N/A'}</Text>
260
+ </Box>
261
+ <Box>
262
+ <Text fontWeight="bold">Partition</Text>
263
+ <Text>{jobInfo?.partition || job?.partition || 'N/A'}</Text>
264
+ </Box>
265
+ <Box>
266
+ <Text fontWeight="bold">User</Text>
267
+ <Text>{jobInfo?.user_name || job?.user_name || 'N/A'}</Text>
268
+ </Box>
269
+ <Box>
270
+ <Text fontWeight="bold">Account</Text>
271
+ <Text>{jobInfo?.account || 'N/A'}</Text>
272
+ </Box>
273
+ <Box>
274
+ <Text fontWeight="bold">Time Limit</Text>
275
+ <Text>{formatTimeLimit(jobInfo?.time_limit || job?.time_limit)}</Text>
276
+ </Box>
277
+ <Box>
278
+ <Text fontWeight="bold">Nodes</Text>
279
+ <Text>{jobInfo?.node_count?.number || job?.nodes || 'N/A'}</Text>
280
+ </Box>
281
+ <Box>
282
+ <Text fontWeight="bold">Tasks</Text>
283
+ <Text>{jobInfo?.tasks?.number || 'N/A'}</Text>
284
+ </Box>
285
+ <Box>
286
+ <Text fontWeight="bold">CPUs</Text>
287
+ <Text>{jobInfo?.cpus?.number || 'N/A'}</Text>
288
+ </Box>
289
+ <Box>
290
+ <Text fontWeight="bold">Exit Code</Text>
291
+ <Text>{jobInfo?.exit_code?.return_code?.number || 'N/A'}</Text>
292
+ </Box>
293
+ </Grid>
294
+ </Card.Body>
295
+ </Card.Root>
296
+
297
+ {/* Job Details Tabs */}
298
+ <Card.Root bg="var(--color-bg-card)" border="1px solid" borderColor="var(--color-border)">
299
+ <Card.Body>
300
+ <JobDetailsTabs
301
+ jobInfo={jobInfo}
302
+ infoLoading={infoLoading}
303
+ infoError={infoError}
304
+ stdout={stdout}
305
+ stdoutLoading={stdoutLoading}
306
+ stdoutError={stdoutError}
307
+ stderr={stderr}
308
+ stderrLoading={stderrLoading}
309
+ stderrError={stderrError}
310
+ />
311
+ </Card.Body>
312
+ </Card.Root>
313
+ </VStack>
314
+ </Box>
315
+ );
316
+ };
317
+
318
+ // Job Details Tabs Component
319
+ const JobDetailsTabs: React.FC<{
320
+ jobInfo?: SlurmJobDetail;
321
+ infoLoading: boolean;
322
+ infoError?: Error | null;
323
+ stdout?: string;
324
+ stdoutLoading: boolean;
325
+ stdoutError?: Error | null;
326
+ stderr?: string;
327
+ stderrLoading: boolean;
328
+ stderrError?: Error | null;
329
+ }> = ({ jobInfo, infoLoading, infoError, stdout, stdoutLoading, stdoutError, stderr, stderrLoading, stderrError }) => {
330
+ const [activeTab, setActiveTab] = useState("job-info");
331
+
332
+ return (
333
+ <Tabs.Root value={activeTab} onValueChange={(details) => setActiveTab(details.value)}>
334
+ <Tabs.List>
335
+ <Tabs.Trigger value="job-info">Job Info</Tabs.Trigger>
336
+ <Tabs.Trigger value="logs">Logs</Tabs.Trigger>
337
+ <Tabs.Trigger value="data">Data</Tabs.Trigger>
338
+ </Tabs.List>
339
+
340
+ <Tabs.Content value="job-info">
341
+ <VStack align="stretch" gap={4}>
342
+ {infoLoading ? (
343
+ <Box textAlign="center" py={8}>
344
+ <Spinner size="lg" />
345
+ <Text mt={4}>Loading job information...</Text>
346
+ </Box>
347
+ ) : jobInfo ? (
348
+ <Accordion.Root multiple>
349
+ <Accordion.Item value="basic-info">
350
+ <h3>
351
+ <Accordion.ItemTrigger>
352
+ <Box as="span" flex='1' textAlign='left'>
353
+ <Text fontWeight="bold">Basic Information</Text>
354
+ </Box>
355
+ <Accordion.ItemIndicator />
356
+ </Accordion.ItemTrigger>
357
+ </h3>
358
+ <Accordion.ItemContent pb={4}>
359
+ <Grid templateColumns="repeat(2, 1fr)" gap={4}>
360
+ <Box>
361
+ <Text fontWeight="bold">Job ID</Text>
362
+ <Text fontFamily="mono">{jobInfo.job_id}</Text>
363
+ </Box>
364
+ <Box>
365
+ <Text fontWeight="bold">Name</Text>
366
+ <Text>{jobInfo.name || 'N/A'}</Text>
367
+ </Box>
368
+ <Box>
369
+ <Text fontWeight="bold">Status</Text>
370
+ <Badge colorScheme={getStatusColor(jobInfo.job_state?.[0] || '')}>
371
+ {jobInfo.job_state?.[0] || NO_JOB_STATE}
372
+ </Badge>
373
+ </Box>
374
+ <Box>
375
+ <Text fontWeight="bold">Partition</Text>
376
+ <Text>{jobInfo.partition || 'N/A'}</Text>
377
+ </Box>
378
+ <Box>
379
+ <Text fontWeight="bold">User</Text>
380
+ <Text>{jobInfo.user_name || 'N/A'}</Text>
381
+ </Box>
382
+ <Box>
383
+ <Text fontWeight="bold">Account</Text>
384
+ <Text>{jobInfo.account || 'N/A'}</Text>
385
+ </Box>
386
+ <Box>
387
+ <Text fontWeight="bold">QoS</Text>
388
+ <Text>{jobInfo.qos || 'N/A'}</Text>
389
+ </Box>
390
+ <Box>
391
+ <Text fontWeight="bold">Priority</Text>
392
+ <Text>{jobInfo.priority?.number || 'N/A'}</Text>
393
+ </Box>
394
+ </Grid>
395
+ </Accordion.ItemContent>
396
+ </Accordion.Item>
397
+
398
+ <Accordion.Item value="resource-allocation">
399
+ <h3>
400
+ <Accordion.ItemTrigger>
401
+ <Box as="span" flex='1' textAlign='left'>
402
+ <Text fontWeight="bold">Resource Allocation</Text>
403
+ </Box>
404
+ <Accordion.ItemIndicator />
405
+ </Accordion.ItemTrigger>
406
+ </h3>
407
+ <Accordion.ItemContent pb={4}>
408
+ <Grid templateColumns="repeat(2, 1fr)" gap={4}>
409
+ <Box>
410
+ <Text fontWeight="bold">Nodes</Text>
411
+ <Text>{jobInfo.node_count?.number || 'N/A'}</Text>
412
+ </Box>
413
+ <Box>
414
+ <Text fontWeight="bold">Node List</Text>
415
+ <Text fontFamily="mono">{jobInfo.nodes || 'N/A'}</Text>
416
+ </Box>
417
+ <Box>
418
+ <Text fontWeight="bold">Tasks</Text>
419
+ <Text>{jobInfo.tasks?.number || 'N/A'}</Text>
420
+ </Box>
421
+ <Box>
422
+ <Text fontWeight="bold">CPUs</Text>
423
+ <Text>{jobInfo.cpus?.number || 'N/A'}</Text>
424
+ </Box>
425
+ <Box>
426
+ <Text fontWeight="bold">CPUs per Task</Text>
427
+ <Text>{jobInfo.cpus_per_task?.number || 'N/A'}</Text>
428
+ </Box>
429
+ <Box>
430
+ <Text fontWeight="bold">Tasks per Node</Text>
431
+ <Text>{jobInfo.tasks_per_node?.number || 'N/A'}</Text>
432
+ </Box>
433
+ <Box>
434
+ <Text fontWeight="bold">Memory per Node</Text>
435
+ <Text>{jobInfo.memory_per_node?.number ? `${jobInfo.memory_per_node.number}MB` : 'N/A'}</Text>
436
+ </Box>
437
+ <Box>
438
+ <Text fontWeight="bold">TRES Allocated</Text>
439
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.tres_alloc_str || 'N/A'}</Text>
440
+ </Box>
441
+ </Grid>
442
+ </Accordion.ItemContent>
443
+ </Accordion.Item>
444
+
445
+ <Accordion.Item value="timing-info">
446
+ <h3>
447
+ <Accordion.ItemTrigger>
448
+ <Box as="span" flex='1' textAlign='left'>
449
+ <Text fontWeight="bold">Timing Information</Text>
450
+ </Box>
451
+ <Accordion.ItemIndicator />
452
+ </Accordion.ItemTrigger>
453
+ </h3>
454
+ <Accordion.ItemContent pb={4}>
455
+ <Grid templateColumns="repeat(2, 1fr)" gap={4}>
456
+ <Box>
457
+ <Text fontWeight="bold">Submit Time</Text>
458
+ <Text>{jobInfo.submit_time?.number ? new Date(jobInfo.submit_time.number * 1000).toLocaleString() : 'N/A'}</Text>
459
+ </Box>
460
+ <Box>
461
+ <Text fontWeight="bold">Start Time</Text>
462
+ <Text>{jobInfo.start_time?.number ? new Date(jobInfo.start_time.number * 1000).toLocaleString() : 'N/A'}</Text>
463
+ </Box>
464
+ <Box>
465
+ <Text fontWeight="bold">End Time</Text>
466
+ <Text>{jobInfo.end_time?.number ? new Date(jobInfo.end_time.number * 1000).toLocaleString() : 'N/A'}</Text>
467
+ </Box>
468
+ <Box>
469
+ <Text fontWeight="bold">Time Limit</Text>
470
+ <Text>{formatTimeLimit(jobInfo.time_limit)}</Text>
471
+ </Box>
472
+ <Box>
473
+ <Text fontWeight="bold">Eligible Time</Text>
474
+ <Text>{jobInfo.eligible_time?.number ? new Date(jobInfo.eligible_time.number * 1000).toLocaleString() : 'N/A'}</Text>
475
+ </Box>
476
+ <Box>
477
+ <Text fontWeight="bold">Accrue Time</Text>
478
+ <Text>{jobInfo.accrue_time?.number ? new Date(jobInfo.accrue_time.number * 1000).toLocaleString() : 'N/A'}</Text>
479
+ </Box>
480
+ </Grid>
481
+ </Accordion.ItemContent>
482
+ </Accordion.Item>
483
+
484
+ <Accordion.Item value="job-details">
485
+ <h3>
486
+ <Accordion.ItemTrigger>
487
+ <Box as="span" flex='1' textAlign='left'>
488
+ <Text fontWeight="bold">Job Details</Text>
489
+ </Box>
490
+ <Accordion.ItemIndicator />
491
+ </Accordion.ItemTrigger>
492
+ </h3>
493
+ <Accordion.ItemContent pb={4}>
494
+ <Grid templateColumns="repeat(2, 1fr)" gap={4}>
495
+ <Box>
496
+ <Text fontWeight="bold">Command</Text>
497
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.command || 'N/A'}</Text>
498
+ </Box>
499
+ <Box>
500
+ <Text fontWeight="bold">Working Directory</Text>
501
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.current_working_directory || 'N/A'}</Text>
502
+ </Box>
503
+ <Box>
504
+ <Text fontWeight="bold">Standard Output</Text>
505
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.standard_output || 'N/A'}</Text>
506
+ </Box>
507
+ <Box>
508
+ <Text fontWeight="bold">Standard Error</Text>
509
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.standard_error || 'N/A'}</Text>
510
+ </Box>
511
+ <Box>
512
+ <Text fontWeight="bold">Comment</Text>
513
+ <Text fontFamily="mono" fontSize="sm">{jobInfo.comment || 'N/A'}</Text>
514
+ </Box>
515
+ <Box>
516
+ <Text fontWeight="bold">Exit Code</Text>
517
+ <Text>{jobInfo.exit_code?.return_code?.number || 'N/A'}</Text>
518
+ </Box>
519
+ <Box>
520
+ <Text fontWeight="bold">Restart Count</Text>
521
+ <Text>{jobInfo.restart_cnt || 'N/A'}</Text>
522
+ </Box>
523
+ <Box>
524
+ <Text fontWeight="bold">State Reason</Text>
525
+ <Text>{jobInfo.state_reason || 'N/A'}</Text>
526
+ </Box>
527
+ </Grid>
528
+ </Accordion.ItemContent>
529
+ </Accordion.Item>
530
+
531
+ <Accordion.Item value="raw-job-info">
532
+ <h3>
533
+ <Accordion.ItemTrigger>
534
+ <Box as="span" flex='1' textAlign='left'>
535
+ <Text fontWeight="bold">Raw Job Information</Text>
536
+ </Box>
537
+ <Accordion.ItemIndicator />
538
+ </Accordion.ItemTrigger>
539
+ </h3>
540
+ <Accordion.ItemContent pb={4}>
541
+ <Code display="block" whiteSpace="pre-wrap" p={4}>
542
+ {JSON.stringify(jobInfo, null, 2)}
543
+ </Code>
544
+ </Accordion.ItemContent>
545
+ </Accordion.Item>
546
+ </Accordion.Root>
547
+ ) : (
548
+ <Text color="var(--color-text-muted)">No job information available</Text>
549
+ )}
550
+ </VStack>
551
+ </Tabs.Content>
552
+
553
+ <Tabs.Content value="logs">
554
+ {(stdoutLoading || stderrLoading) ? (
555
+ <Box textAlign="center" py={8}>
556
+ <Spinner size="lg" />
557
+ <Text mt={4}>Loading logs...</Text>
558
+ </Box>
559
+ ) : (
560
+ <VStack align="stretch" gap={4}>
561
+ {/* Show errors if any */}
562
+ {(stdoutError || stderrError) && (
563
+ <Alert.Root status="warning">
564
+ <Alert.Indicator />
565
+ <Alert.Content>
566
+ <Alert.Title>Some logs could not be loaded</Alert.Title>
567
+ <Alert.Description>
568
+ Some log files may not be available or accessible.
569
+ </Alert.Description>
570
+ </Alert.Content>
571
+ </Alert.Root>
572
+ )}
573
+
574
+ <Accordion.Root multiple>
575
+ <Accordion.Item value="log-job-info">
576
+ <h3>
577
+ <Accordion.ItemTrigger>
578
+ <Box as="span" flex='1' textAlign='left'>
579
+ <Text fontWeight="bold">Job Information</Text>
580
+ </Box>
581
+ <Accordion.ItemIndicator />
582
+ </Accordion.ItemTrigger>
583
+ </h3>
584
+ <Accordion.ItemContent pb={4}>
585
+ {infoError ? (
586
+ <Alert.Root status="error">
587
+ <Alert.Indicator />
588
+ <Alert.Content>
589
+ <Alert.Title>Failed to load job information</Alert.Title>
590
+ <Alert.Description>
591
+ {infoError?.message || 'Unknown error occurred'}
592
+ </Alert.Description>
593
+ </Alert.Content>
594
+ </Alert.Root>
595
+ ) : (
596
+ <Code display="block" whiteSpace="pre-wrap" p={4}>
597
+ {jobInfo ? JSON.stringify(jobInfo, null, 2) : 'No job information available'}
598
+ </Code>
599
+ )}
600
+ </Accordion.ItemContent>
601
+ </Accordion.Item>
602
+
603
+ <Accordion.Item value="stdout">
604
+ <h3>
605
+ <Accordion.ItemTrigger>
606
+ <Box as="span" flex='1' textAlign='left'>
607
+ <Text fontWeight="bold">Standard Output</Text>
608
+ </Box>
609
+ <Accordion.ItemIndicator />
610
+ </Accordion.ItemTrigger>
611
+ </h3>
612
+ <Accordion.ItemContent pb={4}>
613
+ {stdoutError ? (
614
+ <Alert.Root status="error">
615
+ <Alert.Indicator />
616
+ <Alert.Content>
617
+ <Alert.Title>Failed to load stdout</Alert.Title>
618
+ <Alert.Description>
619
+ {stdoutError?.message || 'Unknown error occurred'}
620
+ </Alert.Description>
621
+ </Alert.Content>
622
+ </Alert.Root>
623
+ ) : (
624
+ <Code display="block" whiteSpace="pre-wrap" p={4}>
625
+ {stdout || 'N/A'}
626
+ </Code>
627
+ )}
628
+ </Accordion.ItemContent>
629
+ </Accordion.Item>
630
+
631
+ <Accordion.Item value="stderr">
632
+ <h3>
633
+ <Accordion.ItemTrigger>
634
+ <Box as="span" flex='1' textAlign='left'>
635
+ <Text fontWeight="bold">Standard Error</Text>
636
+ </Box>
637
+ <Accordion.ItemIndicator />
638
+ </Accordion.ItemTrigger>
639
+ </h3>
640
+ <Accordion.ItemContent pb={4}>
641
+ {stderrError ? (
642
+ <Alert.Root status="error">
643
+ <Alert.Indicator />
644
+ <Alert.Content>
645
+ <Alert.Title>Failed to load stderr</Alert.Title>
646
+ <Alert.Description>
647
+ {stderrError?.message || 'Unknown error occurred'}
648
+ </Alert.Description>
649
+ </Alert.Content>
650
+ </Alert.Root>
651
+ ) : (
652
+ <Code display="block" whiteSpace="pre-wrap" p={4}>
653
+ {stderr || 'N/A'}
654
+ </Code>
655
+ )}
656
+ </Accordion.ItemContent>
657
+ </Accordion.Item>
658
+ </Accordion.Root>
659
+ </VStack>
660
+ )}
661
+ </Tabs.Content>
662
+
663
+ <Tabs.Content value="data">
664
+ <VStack align="stretch" gap={4}>
665
+ <Box>
666
+ <Text fontWeight="bold" mb={2}>Job Information</Text>
667
+ <Text color="var(--color-text-muted)">
668
+ Use the Logs tab to view job information, stdout, and stderr output.
669
+ </Text>
670
+ </Box>
671
+ </VStack>
672
+ </Tabs.Content>
673
+ </Tabs.Root>
674
+ );
675
+ };