@milabench/bujang 0.1.6 → 0.1.8
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/README.md +1 -1
- package/dist/api.d.ts +29 -1
- package/dist/components/LinkableCard.d.ts +27 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3813 -3006
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +8 -3
- package/dist/routes.d.ts +1 -1
- package/dist/types.d.ts +150 -0
- package/dist/views/JanitorView.d.ts +5 -0
- package/package.json +1 -1
- package/src/api.ts +70 -0
- package/src/components/LinkableCard.tsx +120 -0
- package/src/index.ts +2 -0
- package/src/paths.ts +13 -4
- package/src/routes.tsx +3 -1
- package/src/types.ts +158 -0
- package/src/views/JanitorView.tsx +690 -0
- package/src/views/JobLogs.tsx +2 -1
- package/src/views/JobSubmit.tsx +132 -11
- package/src/views/PipelineGraph.tsx +33 -3
- package/src/views/SettingsView.tsx +112 -48
package/dist/paths.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IconType } from 'react-icons';
|
|
2
2
|
/** Names of the bujang views. */
|
|
3
|
-
export type BujangView = 'jobs' | 'submitJob' | 'jobDetails' | 'jobLogs' | 'pipelines' | 'pipelineDetails' | 'scheduled' | 'agent' | 'settings';
|
|
3
|
+
export type BujangView = 'jobs' | 'submitJob' | 'jobDetails' | 'jobLogs' | 'pipelines' | 'pipelineDetails' | 'scheduled' | 'agent' | 'janitor' | 'settings';
|
|
4
4
|
/** URL builders the views use to link to each other. */
|
|
5
5
|
export interface BujangPaths {
|
|
6
6
|
jobs: () => string;
|
|
@@ -13,8 +13,13 @@ export interface BujangPaths {
|
|
|
13
13
|
scheduled: () => string;
|
|
14
14
|
/** Agent activity, optionally filtered on one session. */
|
|
15
15
|
agent: (session?: string) => string;
|
|
16
|
-
/**
|
|
17
|
-
|
|
16
|
+
/** Janitor: background tasks (running, periodic, history), sync queue, cleanups. `section`: a card id. */
|
|
17
|
+
janitor: (section?: string) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Settings: folders, database, SSH, secrets (read-only unless the server allows edits).
|
|
20
|
+
* `section` links to one card: general, folders, database, ssh, secrets.
|
|
21
|
+
*/
|
|
22
|
+
settings: (section?: string) => string;
|
|
18
23
|
}
|
|
19
24
|
/** Default URL layout (react-router patterns), relative to the host's basePath. */
|
|
20
25
|
export declare const defaultRoutePatterns: Record<BujangView, string>;
|
package/dist/routes.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export interface BujangRouteObject {
|
|
|
15
15
|
/**
|
|
16
16
|
* Route objects for the default bujang URL layout under `basePath`:
|
|
17
17
|
* /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
|
|
18
|
-
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /settings.
|
|
18
|
+
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /settings.
|
|
19
19
|
*/
|
|
20
20
|
export declare function bujangRoutes(options?: BujangRoutesOptions): BujangRouteObject[];
|
|
21
21
|
/** The same routes as <Route> elements, to drop inside a host's <Routes>. */
|
package/dist/types.d.ts
CHANGED
|
@@ -128,6 +128,13 @@ export interface SlurmJobSubmitRequest {
|
|
|
128
128
|
nodelist?: string;
|
|
129
129
|
dependency?: [string, string][];
|
|
130
130
|
}
|
|
131
|
+
/** A file attached to a submission: lands in <job folder>/input/<name> ($JR_INPUT_DIR). */
|
|
132
|
+
export interface JobAttachment {
|
|
133
|
+
/** Relative path, sub folders allowed (data/train.csv). */
|
|
134
|
+
name: string;
|
|
135
|
+
/** base64 */
|
|
136
|
+
content: string;
|
|
137
|
+
}
|
|
131
138
|
export interface SlurmJobSubmitResponse {
|
|
132
139
|
success: boolean;
|
|
133
140
|
job_id?: string;
|
|
@@ -420,6 +427,8 @@ export interface PushFolderResponse {
|
|
|
420
427
|
}
|
|
421
428
|
export interface EarlySyncResponse {
|
|
422
429
|
status: "ok" | "notok";
|
|
430
|
+
/** Why the rsync from the compute node failed (its stderr), when it ran */
|
|
431
|
+
error?: string | null;
|
|
423
432
|
}
|
|
424
433
|
export interface ScheduledJob {
|
|
425
434
|
_id: number;
|
|
@@ -534,6 +543,19 @@ export interface SettingsDatabaseTable {
|
|
|
534
543
|
name: string;
|
|
535
544
|
exists: boolean;
|
|
536
545
|
rows: number | null;
|
|
546
|
+
/** What the table holds (known tables only). */
|
|
547
|
+
description?: string | null;
|
|
548
|
+
}
|
|
549
|
+
/** A SQLite file of the local cache (state.db, fakeslurm.db). */
|
|
550
|
+
export interface SettingsLocalDatabase {
|
|
551
|
+
name: string;
|
|
552
|
+
path: string;
|
|
553
|
+
description: string;
|
|
554
|
+
exists: boolean;
|
|
555
|
+
/** Bytes, with the -wal / -shm files. */
|
|
556
|
+
size: number | null;
|
|
557
|
+
tables: SettingsDatabaseTable[];
|
|
558
|
+
error: string | null;
|
|
537
559
|
}
|
|
538
560
|
export interface SettingsDatabase {
|
|
539
561
|
host_provided: boolean;
|
|
@@ -548,6 +570,8 @@ export interface SettingsDatabase {
|
|
|
548
570
|
enabled: boolean;
|
|
549
571
|
tables: SettingsDatabaseTable[];
|
|
550
572
|
error: string | null;
|
|
573
|
+
/** The SQLite files of the local cache, whatever the database above is. */
|
|
574
|
+
local?: SettingsLocalDatabase[];
|
|
551
575
|
}
|
|
552
576
|
export interface SettingsMcp {
|
|
553
577
|
/** Served by this app itself (bujang serve), at `path`. */
|
|
@@ -804,3 +828,129 @@ export interface SyncStatus {
|
|
|
804
828
|
synced?: Record<string, boolean>;
|
|
805
829
|
skipped?: string;
|
|
806
830
|
}
|
|
831
|
+
export type JanitorStatus = 'ok' | 'failed' | 'timeout' | 'skipped';
|
|
832
|
+
/** A background task running now. */
|
|
833
|
+
export interface JanitorTask {
|
|
834
|
+
id: string;
|
|
835
|
+
name: string;
|
|
836
|
+
/** rsync | scp | ssh | periodic | cleanup | request | task */
|
|
837
|
+
kind: string;
|
|
838
|
+
cluster: string | null;
|
|
839
|
+
started: number;
|
|
840
|
+
pid: number | null;
|
|
841
|
+
detail: Record<string, unknown>;
|
|
842
|
+
}
|
|
843
|
+
/** One finished task. */
|
|
844
|
+
export interface JanitorRun {
|
|
845
|
+
id: string;
|
|
846
|
+
name: string;
|
|
847
|
+
kind: string;
|
|
848
|
+
cluster: string | null;
|
|
849
|
+
/** rsync / scp: pull (cluster -> here) or push */
|
|
850
|
+
direction: 'pull' | 'push' | null;
|
|
851
|
+
started: number;
|
|
852
|
+
ended: number;
|
|
853
|
+
duration: number;
|
|
854
|
+
/** Seconds spent waiting for the cluster's sync queue. */
|
|
855
|
+
waited: number | null;
|
|
856
|
+
status: JanitorStatus;
|
|
857
|
+
error: string | null;
|
|
858
|
+
detail: Record<string, unknown>;
|
|
859
|
+
/** Bytes received / sent (rsync --stats, scp, ssh output); a sync or book keeping adds up its rsyncs. */
|
|
860
|
+
bytes_in: number | null;
|
|
861
|
+
bytes_out: number | null;
|
|
862
|
+
}
|
|
863
|
+
export interface JanitorStat {
|
|
864
|
+
name: string;
|
|
865
|
+
kind: string;
|
|
866
|
+
cluster: string | null;
|
|
867
|
+
runs: number;
|
|
868
|
+
failures: number;
|
|
869
|
+
total: number;
|
|
870
|
+
mean: number;
|
|
871
|
+
p95: number | null;
|
|
872
|
+
max: number;
|
|
873
|
+
waited: number;
|
|
874
|
+
last: number;
|
|
875
|
+
last_status: JanitorStatus | null;
|
|
876
|
+
bytes_in: number | null;
|
|
877
|
+
bytes_out: number | null;
|
|
878
|
+
}
|
|
879
|
+
export interface JanitorQueueTicket {
|
|
880
|
+
id: string;
|
|
881
|
+
cluster: string;
|
|
882
|
+
what: string | null;
|
|
883
|
+
queued: number;
|
|
884
|
+
pid: number | null;
|
|
885
|
+
/** null: waiting its turn */
|
|
886
|
+
started: number | null;
|
|
887
|
+
expires: number;
|
|
888
|
+
}
|
|
889
|
+
export interface JanitorPeriodic {
|
|
890
|
+
/** APScheduler job id, null when only its history is known */
|
|
891
|
+
id: string | null;
|
|
892
|
+
name: string;
|
|
893
|
+
interval: number | null;
|
|
894
|
+
next_run: number | null;
|
|
895
|
+
last: JanitorRun | null;
|
|
896
|
+
}
|
|
897
|
+
export interface JanitorOverview {
|
|
898
|
+
now: number;
|
|
899
|
+
history_days: number;
|
|
900
|
+
active: JanitorTask[];
|
|
901
|
+
queue: JanitorQueueTicket[];
|
|
902
|
+
periodic: JanitorPeriodic[];
|
|
903
|
+
stats: {
|
|
904
|
+
day: JanitorStat[];
|
|
905
|
+
week: JanitorStat[];
|
|
906
|
+
};
|
|
907
|
+
/** Calls to each cluster over the last day (rsync, scp, ssh). */
|
|
908
|
+
clusters: Record<string, {
|
|
909
|
+
calls: number;
|
|
910
|
+
rsyncs: number;
|
|
911
|
+
seconds: number;
|
|
912
|
+
failures: number;
|
|
913
|
+
waited: number;
|
|
914
|
+
bytes_in: number;
|
|
915
|
+
bytes_out: number;
|
|
916
|
+
}>;
|
|
917
|
+
archive_roots: string[];
|
|
918
|
+
}
|
|
919
|
+
export interface JanitorCleanupInfo {
|
|
920
|
+
organizers: {
|
|
921
|
+
name: string;
|
|
922
|
+
values: {
|
|
923
|
+
value: string;
|
|
924
|
+
jobs: number;
|
|
925
|
+
}[];
|
|
926
|
+
}[];
|
|
927
|
+
}
|
|
928
|
+
export interface JanitorSkipped {
|
|
929
|
+
jr_job_id: string;
|
|
930
|
+
value?: string;
|
|
931
|
+
reason: string;
|
|
932
|
+
}
|
|
933
|
+
export interface JanitorArchiveItem {
|
|
934
|
+
jr_job_id: string;
|
|
935
|
+
value: string;
|
|
936
|
+
cluster: string | null;
|
|
937
|
+
from: string;
|
|
938
|
+
to: string;
|
|
939
|
+
}
|
|
940
|
+
export interface JanitorArchiveResult {
|
|
941
|
+
would_move?: JanitorArchiveItem[];
|
|
942
|
+
moved?: JanitorArchiveItem[];
|
|
943
|
+
skipped: JanitorSkipped[];
|
|
944
|
+
}
|
|
945
|
+
export interface JanitorStaleItem {
|
|
946
|
+
jr_job_id: string;
|
|
947
|
+
cluster: string | null;
|
|
948
|
+
folder: string;
|
|
949
|
+
modified: number | null;
|
|
950
|
+
state: string | string[] | null;
|
|
951
|
+
}
|
|
952
|
+
export interface JanitorStaleResult {
|
|
953
|
+
would_remove?: JanitorStaleItem[];
|
|
954
|
+
removed?: JanitorStaleItem[];
|
|
955
|
+
skipped: JanitorSkipped[];
|
|
956
|
+
}
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -41,6 +41,12 @@ import type {
|
|
|
41
41
|
SshPlan,
|
|
42
42
|
SshPlanRequest,
|
|
43
43
|
SshTestResponse,
|
|
44
|
+
JobAttachment,
|
|
45
|
+
JanitorOverview,
|
|
46
|
+
JanitorRun,
|
|
47
|
+
JanitorCleanupInfo,
|
|
48
|
+
JanitorArchiveResult,
|
|
49
|
+
JanitorStaleResult,
|
|
44
50
|
} from './types';
|
|
45
51
|
|
|
46
52
|
export const DEFAULT_API_BASE = '/api/slurm';
|
|
@@ -369,6 +375,8 @@ export const submitSlurmJob = async (request: {
|
|
|
369
375
|
export?: string;
|
|
370
376
|
nodelist?: string;
|
|
371
377
|
dependency?: [string, string][];
|
|
378
|
+
/** Files for the job: <job folder>/input/<name> on the cluster before it starts ($JR_INPUT_DIR). */
|
|
379
|
+
files?: JobAttachment[];
|
|
372
380
|
}): Promise<SlurmJobSubmitResponse> => {
|
|
373
381
|
try {
|
|
374
382
|
const response = await api.post('/submit', request);
|
|
@@ -806,3 +814,65 @@ export const getAgentActivity = async (
|
|
|
806
814
|
return response.data;
|
|
807
815
|
} catch (error) { return handleError(error); }
|
|
808
816
|
};
|
|
817
|
+
|
|
818
|
+
/** A browser File as a submission attachment (base64). */
|
|
819
|
+
export const fileToAttachment = (file: File, name: string = file.name): Promise<JobAttachment> =>
|
|
820
|
+
new Promise((resolve, reject) => {
|
|
821
|
+
const reader = new FileReader();
|
|
822
|
+
reader.onerror = () => reject(reader.error);
|
|
823
|
+
reader.onload = () => {
|
|
824
|
+
const url = String(reader.result);
|
|
825
|
+
resolve({ name, content: url.slice(url.indexOf(',') + 1) });
|
|
826
|
+
};
|
|
827
|
+
reader.readAsDataURL(file);
|
|
828
|
+
});
|
|
829
|
+
|
|
830
|
+
// ─── Janitor ───────────────────────────────────────────────────────
|
|
831
|
+
|
|
832
|
+
export const getJanitor = async (): Promise<JanitorOverview> => {
|
|
833
|
+
try {
|
|
834
|
+
const response = await api.get('/janitor');
|
|
835
|
+
return response.data;
|
|
836
|
+
} catch (error) { return handleError(error); }
|
|
837
|
+
};
|
|
838
|
+
|
|
839
|
+
export const getJanitorHistory = async (
|
|
840
|
+
params: { name?: string; kind?: string; cluster?: string; status?: string; since?: number; limit?: number } = {},
|
|
841
|
+
): Promise<{ runs: JanitorRun[] }> => {
|
|
842
|
+
try {
|
|
843
|
+
const response = await api.get('/janitor/history', { params });
|
|
844
|
+
return response.data;
|
|
845
|
+
} catch (error) { return handleError(error); }
|
|
846
|
+
};
|
|
847
|
+
|
|
848
|
+
export const getJanitorCleanup = async (): Promise<JanitorCleanupInfo> => {
|
|
849
|
+
try {
|
|
850
|
+
const response = await api.get('/janitor/cleanup');
|
|
851
|
+
return response.data;
|
|
852
|
+
} catch (error) { return handleError(error); }
|
|
853
|
+
};
|
|
854
|
+
|
|
855
|
+
export const janitorArchive = async (
|
|
856
|
+
body: { organizer: string; value?: string | null; dry_run: boolean },
|
|
857
|
+
): Promise<JanitorArchiveResult> => {
|
|
858
|
+
try {
|
|
859
|
+
const response = await api.post('/janitor/archive', body);
|
|
860
|
+
return response.data;
|
|
861
|
+
} catch (error) { return handleError(error); }
|
|
862
|
+
};
|
|
863
|
+
|
|
864
|
+
export const janitorRemoveStale = async (
|
|
865
|
+
body: { older_than_days: number; dry_run: boolean },
|
|
866
|
+
): Promise<JanitorStaleResult> => {
|
|
867
|
+
try {
|
|
868
|
+
const response = await api.post('/janitor/remove-stale', body);
|
|
869
|
+
return response.data;
|
|
870
|
+
} catch (error) { return handleError(error); }
|
|
871
|
+
};
|
|
872
|
+
|
|
873
|
+
export const janitorPrune = async (): Promise<{ removed: number }> => {
|
|
874
|
+
try {
|
|
875
|
+
const response = await api.post('/janitor/prune');
|
|
876
|
+
return response.data;
|
|
877
|
+
} catch (error) { return handleError(error); }
|
|
878
|
+
};
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import React, { useEffect } from 'react';
|
|
2
|
+
import { Box, Card, Heading, HStack, IconButton, Text, VStack } from '@chakra-ui/react';
|
|
3
|
+
import { useLocation, useNavigate } from 'react-router-dom';
|
|
4
|
+
import { LuLink } from 'react-icons/lu';
|
|
5
|
+
import { toaster } from '../toast';
|
|
6
|
+
import { Tooltip } from './tooltip';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Scroll to the card named by the URL hash (/settings#ssh) once the page has its content
|
|
10
|
+
* (`ready`), and again when the hash changes.
|
|
11
|
+
*/
|
|
12
|
+
export function useHashScroll(ready: boolean = true) {
|
|
13
|
+
const { hash } = useLocation();
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (!ready || !hash) return;
|
|
16
|
+
const id = decodeURIComponent(hash.slice(1));
|
|
17
|
+
// after the cards have rendered
|
|
18
|
+
const timer = window.setTimeout(() => {
|
|
19
|
+
document.getElementById(id)?.scrollIntoView({ behavior: 'smooth', block: 'start' });
|
|
20
|
+
}, 50);
|
|
21
|
+
return () => window.clearTimeout(timer);
|
|
22
|
+
}, [hash, ready]);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* A card with an anchor: `id` is its URL hash (/settings#ssh). The link button next to the title
|
|
27
|
+
* goes there and copies the full link, to give someone the card itself. The card the URL names is
|
|
28
|
+
* outlined.
|
|
29
|
+
*/
|
|
30
|
+
export const LinkableCard: React.FC<{
|
|
31
|
+
id: string;
|
|
32
|
+
icon?: React.ReactNode;
|
|
33
|
+
title: string;
|
|
34
|
+
subtitle?: React.ReactNode;
|
|
35
|
+
actions?: React.ReactNode;
|
|
36
|
+
children: React.ReactNode;
|
|
37
|
+
}> = ({ id, icon, title, subtitle, actions, children }) => {
|
|
38
|
+
const location = useLocation();
|
|
39
|
+
const navigate = useNavigate();
|
|
40
|
+
const targeted = decodeURIComponent(location.hash.slice(1)) === id;
|
|
41
|
+
|
|
42
|
+
const copyLink = () => {
|
|
43
|
+
navigate({ pathname: location.pathname, search: location.search, hash: id }, { replace: true });
|
|
44
|
+
const url = `${window.location.origin}${location.pathname}${location.search}#${encodeURIComponent(id)}`;
|
|
45
|
+
navigator.clipboard?.writeText(url).then(
|
|
46
|
+
() => toaster.create({ title: 'Link copied', description: url, type: 'success', duration: 2500 }),
|
|
47
|
+
() => undefined,
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<Card.Root
|
|
53
|
+
id={id}
|
|
54
|
+
bg="var(--color-bg-card)"
|
|
55
|
+
border="1px solid"
|
|
56
|
+
borderColor={targeted ? 'var(--color-primary)' : 'var(--color-border)'}
|
|
57
|
+
boxShadow={targeted ? '0 0 0 1px var(--color-primary)' : undefined}
|
|
58
|
+
scrollMarginTop="16px"
|
|
59
|
+
className="bujang-linkable-card"
|
|
60
|
+
>
|
|
61
|
+
<Card.Header pb={2}>
|
|
62
|
+
<HStack justify="space-between" align="start" gap={4} wrap="wrap">
|
|
63
|
+
<VStack align="start" gap={1}>
|
|
64
|
+
<HStack gap={2} color="var(--color-text)">
|
|
65
|
+
{icon}
|
|
66
|
+
<Heading size="md">{title}</Heading>
|
|
67
|
+
<Tooltip content="Link to this card (copied)" showArrow>
|
|
68
|
+
<IconButton
|
|
69
|
+
aria-label={`Link to ${title}`}
|
|
70
|
+
size="2xs"
|
|
71
|
+
variant="ghost"
|
|
72
|
+
color="var(--color-text-muted)"
|
|
73
|
+
onClick={copyLink}
|
|
74
|
+
>
|
|
75
|
+
<LuLink />
|
|
76
|
+
</IconButton>
|
|
77
|
+
</Tooltip>
|
|
78
|
+
</HStack>
|
|
79
|
+
{subtitle && <Text fontSize="sm" color="var(--color-text-muted)">{subtitle}</Text>}
|
|
80
|
+
</VStack>
|
|
81
|
+
{actions}
|
|
82
|
+
</HStack>
|
|
83
|
+
</Card.Header>
|
|
84
|
+
<Card.Body pt={2}>
|
|
85
|
+
<VStack align="stretch" gap={4}>{children}</VStack>
|
|
86
|
+
</Card.Body>
|
|
87
|
+
</Card.Root>
|
|
88
|
+
);
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/** Numbered steps of a how-to (a card that walks someone through a setup). */
|
|
92
|
+
export const Steps: React.FC<{ steps: { title: React.ReactNode; body?: React.ReactNode }[] }> = ({ steps }) => (
|
|
93
|
+
<VStack align="stretch" gap={2}>
|
|
94
|
+
{steps.map((step, i) => (
|
|
95
|
+
<HStack key={i} align="start" gap={3}>
|
|
96
|
+
<Box
|
|
97
|
+
flexShrink={0}
|
|
98
|
+
w="22px"
|
|
99
|
+
h="22px"
|
|
100
|
+
borderRadius="full"
|
|
101
|
+
bg="var(--color-primary)"
|
|
102
|
+
color="white"
|
|
103
|
+
fontSize="xs"
|
|
104
|
+
fontWeight="bold"
|
|
105
|
+
display="flex"
|
|
106
|
+
alignItems="center"
|
|
107
|
+
justifyContent="center"
|
|
108
|
+
>
|
|
109
|
+
{i + 1}
|
|
110
|
+
</Box>
|
|
111
|
+
<Box minW={0}>
|
|
112
|
+
<Text fontSize="sm" fontWeight="semibold" color="var(--color-text)">{step.title}</Text>
|
|
113
|
+
{step.body && <Box fontSize="sm" color="var(--color-text-muted)">{step.body}</Box>}
|
|
114
|
+
</Box>
|
|
115
|
+
</HStack>
|
|
116
|
+
))}
|
|
117
|
+
</VStack>
|
|
118
|
+
);
|
|
119
|
+
|
|
120
|
+
export default LinkableCard;
|
package/src/index.ts
CHANGED
|
@@ -9,6 +9,8 @@ export type { GraphStep } from './views/PipelineGraph';
|
|
|
9
9
|
export { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
10
10
|
export { AgentActivityView, AgentBadge, McpHelp } from './views/AgentActivityView';
|
|
11
11
|
export { SettingsView } from './views/SettingsView';
|
|
12
|
+
export { JanitorView } from './views/JanitorView';
|
|
13
|
+
export { LinkableCard, useHashScroll } from './components/LinkableCard';
|
|
12
14
|
export { JobSubmissionForm } from './views/JobSubmit';
|
|
13
15
|
export type { JobSubmissionInitialData } from './views/JobSubmit';
|
|
14
16
|
export { LogDisplay } from './views/LogDisplay';
|
package/src/paths.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { IconType } from 'react-icons';
|
|
2
|
-
import { LuBot, LuCalendarClock, LuList, LuSend, LuSettings, LuWorkflow } from 'react-icons/lu';
|
|
2
|
+
import { LuBot, LuBrush, LuCalendarClock, LuList, LuSend, LuSettings, LuWorkflow } from 'react-icons/lu';
|
|
3
3
|
|
|
4
4
|
/** Names of the bujang views. */
|
|
5
5
|
export type BujangView =
|
|
@@ -11,6 +11,7 @@ export type BujangView =
|
|
|
11
11
|
| 'pipelineDetails'
|
|
12
12
|
| 'scheduled'
|
|
13
13
|
| 'agent'
|
|
14
|
+
| 'janitor'
|
|
14
15
|
| 'settings';
|
|
15
16
|
|
|
16
17
|
/** URL builders the views use to link to each other. */
|
|
@@ -25,8 +26,13 @@ export interface BujangPaths {
|
|
|
25
26
|
scheduled: () => string;
|
|
26
27
|
/** Agent activity, optionally filtered on one session. */
|
|
27
28
|
agent: (session?: string) => string;
|
|
28
|
-
/**
|
|
29
|
-
|
|
29
|
+
/** Janitor: background tasks (running, periodic, history), sync queue, cleanups. `section`: a card id. */
|
|
30
|
+
janitor: (section?: string) => string;
|
|
31
|
+
/**
|
|
32
|
+
* Settings: folders, database, SSH, secrets (read-only unless the server allows edits).
|
|
33
|
+
* `section` links to one card: general, folders, database, ssh, secrets.
|
|
34
|
+
*/
|
|
35
|
+
settings: (section?: string) => string;
|
|
30
36
|
}
|
|
31
37
|
|
|
32
38
|
/** Default URL layout (react-router patterns), relative to the host's basePath. */
|
|
@@ -39,6 +45,7 @@ export const defaultRoutePatterns: Record<BujangView, string> = {
|
|
|
39
45
|
pipelineDetails: '/pipelines/:pipelineName',
|
|
40
46
|
scheduled: '/scheduled',
|
|
41
47
|
agent: '/agent',
|
|
48
|
+
janitor: '/janitor',
|
|
42
49
|
settings: '/settings',
|
|
43
50
|
};
|
|
44
51
|
|
|
@@ -62,7 +69,8 @@ export function createBujangPaths(basePath: string = ''): BujangPaths {
|
|
|
62
69
|
pipelineDetails: (name, runId) => `${b}/pipelines/${seg(name)}${runId ? `?run=${encodeURIComponent(runId)}` : ''}`,
|
|
63
70
|
scheduled: () => `${b}/scheduled`,
|
|
64
71
|
agent: (session) => (session ? `${b}/agent?session=${encodeURIComponent(session)}` : `${b}/agent`),
|
|
65
|
-
|
|
72
|
+
janitor: (section) => `${b}/janitor${section ? `#${encodeURIComponent(section)}` : ''}`,
|
|
73
|
+
settings: (section) => `${b}/settings${section ? `#${encodeURIComponent(section)}` : ''}`,
|
|
66
74
|
};
|
|
67
75
|
}
|
|
68
76
|
|
|
@@ -82,6 +90,7 @@ export function bujangNavItems(paths: BujangPaths = createBujangPaths()): Bujang
|
|
|
82
90
|
{ view: 'scheduled', label: 'Scheduled Jobs', path: paths.scheduled(), icon: LuCalendarClock },
|
|
83
91
|
{ view: 'pipelines', label: 'Pipelines', path: paths.pipelines(), icon: LuWorkflow },
|
|
84
92
|
{ view: 'agent', label: 'Agent Activity', path: paths.agent(), icon: LuBot },
|
|
93
|
+
{ view: 'janitor', label: 'Janitor', path: paths.janitor(), icon: LuBrush },
|
|
85
94
|
{ view: 'settings', label: 'Settings', path: paths.settings(), icon: LuSettings },
|
|
86
95
|
];
|
|
87
96
|
}
|
package/src/routes.tsx
CHANGED
|
@@ -10,6 +10,7 @@ import { PipelineDetailsView, PipelinesView } from './views/PipelinesView';
|
|
|
10
10
|
import { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
11
11
|
import { AgentActivityView } from './views/AgentActivityView';
|
|
12
12
|
import { SettingsView } from './views/SettingsView';
|
|
13
|
+
import { JanitorView } from './views/JanitorView';
|
|
13
14
|
|
|
14
15
|
export interface BujangRoutesOptions {
|
|
15
16
|
/** Prefix the routes are mounted under, e.g. "/slurm". Must match BujangProvider's basePath. Default "". */
|
|
@@ -34,13 +35,14 @@ const elements: Record<BujangView, () => React.ReactElement> = {
|
|
|
34
35
|
pipelineDetails: () => <PipelineDetailsView />,
|
|
35
36
|
scheduled: () => <ScheduledJobsView />,
|
|
36
37
|
agent: () => <AgentActivityView />,
|
|
38
|
+
janitor: () => <JanitorView />,
|
|
37
39
|
settings: () => <SettingsView />,
|
|
38
40
|
};
|
|
39
41
|
|
|
40
42
|
/**
|
|
41
43
|
* Route objects for the default bujang URL layout under `basePath`:
|
|
42
44
|
* /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
|
|
43
|
-
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /settings.
|
|
45
|
+
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /janitor, /settings.
|
|
44
46
|
*/
|
|
45
47
|
export function bujangRoutes(options: BujangRoutesOptions = {}): BujangRouteObject[] {
|
|
46
48
|
const base = normalizeBasePath(options.basePath);
|