@milabench/bujang 0.1.15 → 0.1.17
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.
- package/dist/api.d.ts +1 -0
- package/dist/index.js +8554 -7723
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +60 -10
- package/dist/views/JobArtifacts.d.ts +1 -0
- package/dist/views/JobDataOverview.d.ts +4 -3
- package/dist/views/JobSubmit.d.ts +1 -0
- package/dist/views/JobsTable.d.ts +4 -1
- package/dist/views/OverviewPanels.d.ts +40 -9
- package/dist/views/SettingsView.d.ts +4 -0
- package/dist/views/dataCharts.d.ts +13 -7
- package/package.json +1 -1
- package/src/api.ts +9 -2
- package/src/types.ts +52 -6
- package/src/views/JobArtifacts.tsx +1 -1
- package/src/views/JobDataOverview.tsx +157 -138
- package/src/views/JobLogs.tsx +116 -17
- package/src/views/JobSubmit.tsx +27 -21
- package/src/views/JobsTable.tsx +86 -28
- package/src/views/JobsView.tsx +27 -59
- package/src/views/OverviewPanels.tsx +1053 -89
- package/src/views/SettingsView.tsx +80 -18
- package/src/views/dataCharts.tsx +43 -11
package/src/views/JobsView.tsx
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
NativeSelect,
|
|
13
13
|
} from '@chakra-ui/react';
|
|
14
14
|
import { toaster } from '../toast';
|
|
15
|
-
import { LuPlus, LuRefreshCw, LuStar, LuTimer
|
|
15
|
+
import { LuPlus, LuRefreshCw, LuStar, LuTimer } from 'react-icons/lu';
|
|
16
16
|
import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query';
|
|
17
17
|
import {
|
|
18
18
|
getSlurmJobs,
|
|
@@ -22,27 +22,18 @@ import {
|
|
|
22
22
|
getOrganizers,
|
|
23
23
|
getSyncStatus,
|
|
24
24
|
syncNow,
|
|
25
|
+
getSettings,
|
|
25
26
|
} from '../api';
|
|
26
|
-
import type { SlurmJob, PersitedJobInfo, ApiError, OrganizerGroups, SyncStatus } from '../types';
|
|
27
|
+
import type { SlurmJob, PersitedJobInfo, ApiError, OrganizerGroups, SyncStatus, SettingsInfo } from '../types';
|
|
27
28
|
import { usePageTitle } from '../hooks/usePageTitle';
|
|
28
29
|
import { SshConnectButton } from '../components/SshConnectDialog';
|
|
29
30
|
import { JobsTable, fromActive, fromPersisted, mergeRows } from './JobsTable';
|
|
31
|
+
import { SETTINGS_KEY } from './SettingsView';
|
|
30
32
|
|
|
31
33
|
type JobsViewProps = Record<string, never>;
|
|
32
34
|
|
|
33
35
|
const AUTO_REFRESH_KEY = 'bujang-jobs-auto-refresh';
|
|
34
36
|
const AUTO_REFRESH_MS = 30_000;
|
|
35
|
-
const MERGED_KEY = 'bujang-jobs-merged';
|
|
36
|
-
|
|
37
|
-
/** One table for the active and the persisted jobs unless split on this browser */
|
|
38
|
-
function readMerged(): boolean {
|
|
39
|
-
try {
|
|
40
|
-
return localStorage.getItem(MERGED_KEY) !== '0';
|
|
41
|
-
} catch {
|
|
42
|
-
return true;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
37
|
/** On unless turned off on this browser: the page follows the background sync of the server */
|
|
47
38
|
function readAutoRefresh(): boolean {
|
|
48
39
|
try {
|
|
@@ -81,11 +72,11 @@ const OrganizerFilters: React.FC<{
|
|
|
81
72
|
const shown = organizers.filter((o) => o.groups.length > 0 || selected[o.name]);
|
|
82
73
|
if (shown.length === 0) return null;
|
|
83
74
|
return (
|
|
84
|
-
<HStack gap={
|
|
75
|
+
<HStack gap={3} flexWrap="wrap">
|
|
85
76
|
{shown.map((o) => (
|
|
86
77
|
<HStack key={o.name} gap={2}>
|
|
87
78
|
<Text fontSize="sm" color="var(--color-text-muted)">{filterLabel(o.name)}:</Text>
|
|
88
|
-
<NativeSelect.Root size="
|
|
79
|
+
<NativeSelect.Root size="xs" w="auto" minW="120px">
|
|
89
80
|
<NativeSelect.Field
|
|
90
81
|
value={selected[o.name] ?? ''}
|
|
91
82
|
onChange={(e) => onChange(o.name, e.target.value)}
|
|
@@ -127,15 +118,9 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
127
118
|
}
|
|
128
119
|
setAutoRefresh(on);
|
|
129
120
|
};
|
|
130
|
-
|
|
131
|
-
const
|
|
132
|
-
|
|
133
|
-
localStorage.setItem(MERGED_KEY, on ? '1' : '0');
|
|
134
|
-
} catch {
|
|
135
|
-
// private mode: for this page only
|
|
136
|
-
}
|
|
137
|
-
setMerged(on);
|
|
138
|
-
};
|
|
121
|
+
// jobs_merged setting (Settings page, Display card): one table, or one for the active and one for the persisted jobs
|
|
122
|
+
const { data: settings } = useQuery<SettingsInfo>({ queryKey: SETTINGS_KEY, queryFn: getSettings, staleTime: 60_000 });
|
|
123
|
+
const merged = settings?.fields.jobs_merged?.value !== false;
|
|
139
124
|
// Queries
|
|
140
125
|
const { data: sync } = useQuery<SyncStatus>({
|
|
141
126
|
queryKey: ['bujang-sync'],
|
|
@@ -311,6 +296,21 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
311
296
|
onRerun: handleRerunJob,
|
|
312
297
|
onGroup: (g: string) => setFilter('groups', g),
|
|
313
298
|
};
|
|
299
|
+
// quick filters, in the header of the (first) table; they apply to both tables when split
|
|
300
|
+
const quickFilters = (
|
|
301
|
+
<>
|
|
302
|
+
<Button
|
|
303
|
+
size="xs"
|
|
304
|
+
variant={importantOnly ? 'solid' : 'outline'}
|
|
305
|
+
colorPalette="yellow"
|
|
306
|
+
onClick={() => setFilter('important', importantOnly ? '' : '1')}
|
|
307
|
+
title="Only the jobs marked important"
|
|
308
|
+
>
|
|
309
|
+
<LuStar fill={importantOnly ? 'currentColor' : 'none'} /> Important
|
|
310
|
+
</Button>
|
|
311
|
+
<OrganizerFilters organizers={organizers} selected={selected} onChange={setFilter} onClear={clearFilters} />
|
|
312
|
+
</>
|
|
313
|
+
);
|
|
314
314
|
|
|
315
315
|
|
|
316
316
|
|
|
@@ -396,50 +396,18 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
396
396
|
</HStack>
|
|
397
397
|
</Box>
|
|
398
398
|
|
|
399
|
-
<HStack gap={4} flexWrap="wrap">
|
|
400
|
-
<Button
|
|
401
|
-
size="sm"
|
|
402
|
-
variant={importantOnly ? 'solid' : 'outline'}
|
|
403
|
-
colorPalette="yellow"
|
|
404
|
-
onClick={() => setFilter('important', importantOnly ? '' : '1')}
|
|
405
|
-
title="Only the jobs marked important"
|
|
406
|
-
>
|
|
407
|
-
<LuStar fill={importantOnly ? 'currentColor' : 'none'} /> Important
|
|
408
|
-
</Button>
|
|
409
|
-
<OrganizerFilters organizers={organizers} selected={selected} onChange={setFilter} onClear={clearFilters} />
|
|
410
|
-
<Group attached ml="auto">
|
|
411
|
-
<Button
|
|
412
|
-
size="sm"
|
|
413
|
-
variant={merged ? 'solid' : 'outline'}
|
|
414
|
-
onClick={() => toggleMerged(true)}
|
|
415
|
-
aria-pressed={merged}
|
|
416
|
-
title="The active and the persisted jobs in one table"
|
|
417
|
-
>
|
|
418
|
-
<LuTable /> Merged
|
|
419
|
-
</Button>
|
|
420
|
-
<Button
|
|
421
|
-
size="sm"
|
|
422
|
-
variant={merged ? 'outline' : 'solid'}
|
|
423
|
-
onClick={() => toggleMerged(false)}
|
|
424
|
-
aria-pressed={!merged}
|
|
425
|
-
title="One table for the active jobs, one for the persisted jobs"
|
|
426
|
-
>
|
|
427
|
-
<LuRows2 /> Split
|
|
428
|
-
</Button>
|
|
429
|
-
</Group>
|
|
430
|
-
</HStack>
|
|
431
399
|
|
|
432
400
|
{merged ? (
|
|
433
401
|
<JobsTable
|
|
434
|
-
title="
|
|
402
|
+
title=""
|
|
435
403
|
rows={allRows}
|
|
436
404
|
total={allActiveJobs.length + allPersistedJobs.length - duplicates}
|
|
437
405
|
loading={activeJobsLoading || persistedJobsLoading}
|
|
438
406
|
error={activeJobsError || persistedJobsError}
|
|
439
407
|
empty="No jobs found"
|
|
440
408
|
emptyHint="Submit a new job to get started"
|
|
441
|
-
maxH="75vh"
|
|
442
409
|
cardProps={{ flex: '1', minH: '300px', display: 'flex', flexDirection: 'column' }}
|
|
410
|
+
quickFilters={quickFilters}
|
|
443
411
|
{...tableActions}
|
|
444
412
|
/>
|
|
445
413
|
) : (
|
|
@@ -453,6 +421,7 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
453
421
|
empty="No active jobs found"
|
|
454
422
|
emptyHint="Submit a new job to get started"
|
|
455
423
|
maxH="35vh"
|
|
424
|
+
quickFilters={quickFilters}
|
|
456
425
|
{...tableActions}
|
|
457
426
|
/>
|
|
458
427
|
<JobsTable
|
|
@@ -463,7 +432,6 @@ export const JobsView: React.FC<JobsViewProps> = () => {
|
|
|
463
432
|
error={persistedJobsError}
|
|
464
433
|
empty="No persisted jobs found"
|
|
465
434
|
emptyHint="Completed jobs will appear here"
|
|
466
|
-
maxH="70vh"
|
|
467
435
|
cardProps={{ flex: '1', minH: '300px', display: 'flex', flexDirection: 'column' }}
|
|
468
436
|
{...tableActions}
|
|
469
437
|
/>
|