@milabench/bujang 0.1.2 → 0.1.4
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 +3 -2
- package/dist/api.d.ts +65 -1
- package/dist/context.d.ts +5 -10
- package/dist/index.d.ts +8 -3
- package/dist/index.js +4750 -2910
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +8 -1
- package/dist/routes.d.ts +1 -1
- package/dist/types.d.ts +332 -0
- package/dist/views/AgentActivityView.d.ts +2 -0
- package/dist/views/JobArtifacts.d.ts +9 -0
- package/dist/views/JobDataOverview.d.ts +9 -0
- package/dist/views/JobMarks.d.ts +17 -0
- package/dist/views/PipelineEditor.d.ts +24 -0
- package/dist/views/PipelineGraph.d.ts +49 -0
- package/dist/views/PipelinesView.d.ts +3 -0
- package/dist/views/SettingsView.d.ts +3 -0
- package/package.json +7 -1
- package/src/api.ts +206 -0
- package/src/context.tsx +7 -13
- package/src/index.ts +8 -3
- package/src/paths.ts +22 -6
- package/src/routes.tsx +5 -2
- package/src/types.ts +307 -0
- package/src/views/AgentActivityView.tsx +115 -5
- package/src/views/JobArtifacts.tsx +89 -0
- package/src/views/JobDataOverview.tsx +594 -0
- package/src/views/JobDetails.tsx +3 -0
- package/src/views/JobLogs.tsx +47 -162
- package/src/views/JobMarks.tsx +233 -0
- package/src/views/JobSubmit.tsx +4 -4
- package/src/views/JobsView.tsx +245 -54
- package/src/views/PipelineEditor.tsx +779 -0
- package/src/views/PipelineGraph.tsx +197 -0
- package/src/views/PipelinesView.tsx +363 -1087
- package/src/views/SettingsView.tsx +910 -0
package/src/api.ts
CHANGED
|
@@ -27,6 +27,20 @@ import type {
|
|
|
27
27
|
ScheduledJobTemplateDiff,
|
|
28
28
|
AgentEvent,
|
|
29
29
|
AgentSession,
|
|
30
|
+
SettingsInfo,
|
|
31
|
+
SettingsUpdateResponse,
|
|
32
|
+
UpdateCheck,
|
|
33
|
+
OrganizerGroups,
|
|
34
|
+
SyncStatus,
|
|
35
|
+
JobArtifacts,
|
|
36
|
+
JobData,
|
|
37
|
+
JobMarks,
|
|
38
|
+
UpdateResult,
|
|
39
|
+
SettingsSecrets,
|
|
40
|
+
SshSettings,
|
|
41
|
+
SshPlan,
|
|
42
|
+
SshPlanRequest,
|
|
43
|
+
SshTestResponse,
|
|
30
44
|
} from './types';
|
|
31
45
|
|
|
32
46
|
export const DEFAULT_API_BASE = '/api/slurm';
|
|
@@ -399,6 +413,23 @@ export const rerunSlurmJob = async (jrJobId: string): Promise<SlurmJobSubmitResp
|
|
|
399
413
|
}
|
|
400
414
|
};
|
|
401
415
|
|
|
416
|
+
/** Whether a job is important, its groups, every group known, and whether it can be committed. */
|
|
417
|
+
export const getJobMarks = async (jrJobId: string): Promise<JobMarks> => {
|
|
418
|
+
try {
|
|
419
|
+
const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/marks`);
|
|
420
|
+
return response.data;
|
|
421
|
+
} catch (error) { return handleError(error); }
|
|
422
|
+
};
|
|
423
|
+
|
|
424
|
+
/** Mark a job important, set its groups (existing or new names); a field left out is kept. */
|
|
425
|
+
export const setJobMarks = async (jrJobId: string, marks: { important?: boolean; groups?: string[] }): Promise<JobMarks> => {
|
|
426
|
+
try {
|
|
427
|
+
const response = await api.post(`/jobs/${encodeURIComponent(jrJobId)}/marks`, marks);
|
|
428
|
+
return response.data;
|
|
429
|
+
} catch (error) { return handleError(error); }
|
|
430
|
+
};
|
|
431
|
+
|
|
432
|
+
/** Commit the job folder to the git repository of the local cache (only when there is one). */
|
|
402
433
|
export const saveSlurmJob = async (jrJobId: string, message: string): Promise<{ success?: boolean; error?: string }> => {
|
|
403
434
|
try {
|
|
404
435
|
const response = await api.get(`/job/save/${jrJobId}/${encodeURIComponent(message)}`);
|
|
@@ -428,6 +459,181 @@ export const listSlurmSecrets = async (): Promise<string[]> => {
|
|
|
428
459
|
};
|
|
429
460
|
|
|
430
461
|
|
|
462
|
+
/** Add or replace a secret of the .secrets file. The value is sent once and never returned. */
|
|
463
|
+
export const setSlurmSecret = async (key: string, value: string): Promise<{ success: boolean; message?: string }> => {
|
|
464
|
+
try {
|
|
465
|
+
const response = await api.post('/secrets/set', { key, value });
|
|
466
|
+
return response.data;
|
|
467
|
+
} catch (error) { return handleError(error); }
|
|
468
|
+
};
|
|
469
|
+
|
|
470
|
+
export const deleteSlurmSecret = async (name: string): Promise<{ success: boolean; message?: string }> => {
|
|
471
|
+
try {
|
|
472
|
+
const response = await api.delete(`/secrets/delete/${encodeURIComponent(name)}`);
|
|
473
|
+
return response.data;
|
|
474
|
+
} catch (error) { return handleError(error); }
|
|
475
|
+
};
|
|
476
|
+
|
|
477
|
+
|
|
478
|
+
// Settings (writes answer 403 when the server is read-only)
|
|
479
|
+
export const getSettings = async (): Promise<SettingsInfo> => {
|
|
480
|
+
try {
|
|
481
|
+
const response = await api.get('/settings');
|
|
482
|
+
return response.data;
|
|
483
|
+
} catch (error) { return handleError(error); }
|
|
484
|
+
};
|
|
485
|
+
|
|
486
|
+
/** Write local_cache / workdir / database_url (null: remove it) to the user file. */
|
|
487
|
+
export const updateSettings = async (
|
|
488
|
+
values: Partial<Record<'local_cache' | 'workdir' | 'database_url', string | null>>,
|
|
489
|
+
): Promise<SettingsUpdateResponse> => {
|
|
490
|
+
try {
|
|
491
|
+
const response = await api.put('/settings', values);
|
|
492
|
+
return response.data;
|
|
493
|
+
} catch (error) { return handleError(error); }
|
|
494
|
+
};
|
|
495
|
+
|
|
496
|
+
/** The files of results/ and output/ of a job folder (reports first). */
|
|
497
|
+
export const getJobArtifacts = async (jrJobId: string): Promise<JobArtifacts> => {
|
|
498
|
+
try {
|
|
499
|
+
const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/artifacts`, { timeout: 30000 });
|
|
500
|
+
return response.data;
|
|
501
|
+
} catch (error) { return handleError(error); }
|
|
502
|
+
};
|
|
503
|
+
|
|
504
|
+
/** URL of an artifact, to open in a tab: its relative links (images, scripts) resolve next to it. */
|
|
505
|
+
export const jobArtifactUrl = (jrJobId: string, path: string): string =>
|
|
506
|
+
`${currentBase}/jobs/${encodeURIComponent(jrJobId)}/artifacts/${path.split('/').map(encodeURIComponent).join('/')}`;
|
|
507
|
+
|
|
508
|
+
/** The JSONL files of the artifact folders of a job, with their events and fields (cached server side). */
|
|
509
|
+
export const getJobData = async (jrJobId: string): Promise<JobData> => {
|
|
510
|
+
try {
|
|
511
|
+
const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/data`, { timeout: 60000 });
|
|
512
|
+
return response.data;
|
|
513
|
+
} catch (error) { return handleError(error); }
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
/** Query of GET /jobs/<jr>/data/rows: comma separated files (or globs), events, dotted fields. */
|
|
517
|
+
export interface JobDataRowsQuery {
|
|
518
|
+
files?: string[];
|
|
519
|
+
events?: string[];
|
|
520
|
+
fields?: string[];
|
|
521
|
+
/** only the rows having these fields */
|
|
522
|
+
require?: string[];
|
|
523
|
+
limit?: number;
|
|
524
|
+
}
|
|
525
|
+
|
|
526
|
+
const rowsParams = (query: JobDataRowsQuery): URLSearchParams => {
|
|
527
|
+
const params = new URLSearchParams();
|
|
528
|
+
if (query.files?.length) params.set('files', query.files.join(','));
|
|
529
|
+
if (query.events?.length) params.set('event', query.events.join(','));
|
|
530
|
+
if (query.fields?.length) params.set('fields', query.fields.join(','));
|
|
531
|
+
if (query.require?.length) params.set('require', query.require.join(','));
|
|
532
|
+
if (query.limit) params.set('limit', String(query.limit));
|
|
533
|
+
return params;
|
|
534
|
+
};
|
|
535
|
+
|
|
536
|
+
/** The rows of the JSONL files of a job (each with `_file` and `_name`), for plots. */
|
|
537
|
+
export const getJobDataRows = async (jrJobId: string, query: JobDataRowsQuery): Promise<Record<string, unknown>[]> => {
|
|
538
|
+
try {
|
|
539
|
+
const response = await api.get(`/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`, { timeout: 120000 });
|
|
540
|
+
return response.data;
|
|
541
|
+
} catch (error) { return handleError(error); }
|
|
542
|
+
};
|
|
543
|
+
|
|
544
|
+
/** URL of the rows of a job: a Vega-Lite / Altair data url (relative to the page when apiBase is). */
|
|
545
|
+
export const jobDataRowsUrl = (jrJobId: string, query: JobDataRowsQuery): string =>
|
|
546
|
+
`${currentBase}/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`;
|
|
547
|
+
|
|
548
|
+
/** When the job index was last synced with the clusters. */
|
|
549
|
+
export const getSyncStatus = async (): Promise<SyncStatus> => {
|
|
550
|
+
try {
|
|
551
|
+
const response = await api.get('/sync');
|
|
552
|
+
return response.data;
|
|
553
|
+
} catch (error) { return handleError(error); }
|
|
554
|
+
};
|
|
555
|
+
|
|
556
|
+
/** rsync the clusters with active jobs now and index what changed (can take a few seconds). */
|
|
557
|
+
export const syncNow = async (): Promise<SyncStatus> => {
|
|
558
|
+
try {
|
|
559
|
+
const response = await api.post('/sync', {}, { timeout: 120_000 });
|
|
560
|
+
return response.data;
|
|
561
|
+
} catch (error) { return handleError(error); }
|
|
562
|
+
};
|
|
563
|
+
|
|
564
|
+
/** The organizer folders (clusters/, experiments/, ...): their values and the job ids under each. */
|
|
565
|
+
export const getOrganizers = async (): Promise<OrganizerGroups[]> => {
|
|
566
|
+
try {
|
|
567
|
+
const response = await api.get('/organizers');
|
|
568
|
+
return response.data;
|
|
569
|
+
} catch (error) { return handleError(error); }
|
|
570
|
+
};
|
|
571
|
+
|
|
572
|
+
/** The running version against PyPI; the server asks PyPI once a day, `force` asks now. */
|
|
573
|
+
export const getUpdateCheck = async (force = false): Promise<UpdateCheck> => {
|
|
574
|
+
try {
|
|
575
|
+
const response = await api.get('/update', { params: { force: force ? 1 : undefined } });
|
|
576
|
+
return response.data;
|
|
577
|
+
} catch (error) { return handleError(error); }
|
|
578
|
+
};
|
|
579
|
+
|
|
580
|
+
/** Upgrade bujang on the server, which then restarts (403 when read-only, 409 for a source checkout). */
|
|
581
|
+
export const installUpdate = async (): Promise<UpdateResult> => {
|
|
582
|
+
try {
|
|
583
|
+
const response = await api.post('/update', {}, { timeout: 660_000 });
|
|
584
|
+
return response.data;
|
|
585
|
+
} catch (error) { return handleError(error); }
|
|
586
|
+
};
|
|
587
|
+
|
|
588
|
+
/** Secret names, their source and env shadowing (never the values). */
|
|
589
|
+
export const getSettingsSecrets = async (): Promise<SettingsSecrets> => {
|
|
590
|
+
try {
|
|
591
|
+
const response = await api.get('/settings/secrets');
|
|
592
|
+
return response.data;
|
|
593
|
+
} catch (error) { return handleError(error); }
|
|
594
|
+
};
|
|
595
|
+
|
|
596
|
+
export const getSshSettings = async (file?: string): Promise<SshSettings> => {
|
|
597
|
+
try {
|
|
598
|
+
const response = await api.get('/settings/ssh', { params: { file: file || undefined } });
|
|
599
|
+
return response.data;
|
|
600
|
+
} catch (error) { return handleError(error); }
|
|
601
|
+
};
|
|
602
|
+
|
|
603
|
+
/** The diff of an install (default) or remove, nothing written. */
|
|
604
|
+
export const planSshConfig = async (request: SshPlanRequest & { action?: 'install' | 'remove' }): Promise<SshPlan> => {
|
|
605
|
+
try {
|
|
606
|
+
const response = await api.post('/settings/ssh/plan', request);
|
|
607
|
+
return response.data;
|
|
608
|
+
} catch (error) { return handleError(error); }
|
|
609
|
+
};
|
|
610
|
+
|
|
611
|
+
export const installSshConfig = async (request: SshPlanRequest): Promise<SshPlan> => {
|
|
612
|
+
try {
|
|
613
|
+
const response = await api.post('/settings/ssh/install', request);
|
|
614
|
+
return response.data;
|
|
615
|
+
} catch (error) { return handleError(error); }
|
|
616
|
+
};
|
|
617
|
+
|
|
618
|
+
export const removeSshConfig = async (request: SshPlanRequest): Promise<SshPlan> => {
|
|
619
|
+
try {
|
|
620
|
+
const response = await api.post('/settings/ssh/remove', request);
|
|
621
|
+
return response.data;
|
|
622
|
+
} catch (error) { return handleError(error); }
|
|
623
|
+
};
|
|
624
|
+
|
|
625
|
+
/** `bujang ssh test`: read only, never prompts; can take up to ~3 x (timeout + 5) s. */
|
|
626
|
+
export const testSshConnections = async (
|
|
627
|
+
request: { clusters?: string[]; timeout?: number; file?: string } = {},
|
|
628
|
+
): Promise<SshTestResponse> => {
|
|
629
|
+
const timeout = request.timeout ?? 10;
|
|
630
|
+
try {
|
|
631
|
+
const response = await api.post('/settings/ssh/test', request, { timeout: (3 * (timeout + 5) + 10) * 1000 });
|
|
632
|
+
return response.data;
|
|
633
|
+
} catch (error) { return handleError(error); }
|
|
634
|
+
};
|
|
635
|
+
|
|
636
|
+
|
|
431
637
|
// Pipeline template file management (matching server endpoints)
|
|
432
638
|
export const getPipelineTemplatesList = async (): Promise<string[]> => {
|
|
433
639
|
try {
|
package/src/context.tsx
CHANGED
|
@@ -7,12 +7,6 @@ import { setBujangToastHandler } from './toast';
|
|
|
7
7
|
import type { BujangToastHandler } from './toast';
|
|
8
8
|
import { BujangToaster } from './components/toaster';
|
|
9
9
|
|
|
10
|
-
/** Result of the optional host "push job data" action shown on the job logs page. */
|
|
11
|
-
export interface PushJobDataResult {
|
|
12
|
-
status: string;
|
|
13
|
-
[key: string]: unknown;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
10
|
export interface BujangProviderProps {
|
|
17
11
|
/** Prefix of the bujang HTTP routes. Default "/api/slurm". */
|
|
18
12
|
apiBase?: string;
|
|
@@ -31,10 +25,10 @@ export interface BujangProviderProps {
|
|
|
31
25
|
/** Force the Monaco editor theme. Default follows the `dark` class / data-theme on <html>. */
|
|
32
26
|
colorMode?: 'light' | 'dark';
|
|
33
27
|
/**
|
|
34
|
-
*
|
|
35
|
-
*
|
|
28
|
+
* URL of the MCP endpoint shown on the Agent Activity page (e.g. when the host serves it on
|
|
29
|
+
* its own port). Default: what the server reports, else `<origin>/mcp` when it mounts it.
|
|
36
30
|
*/
|
|
37
|
-
|
|
31
|
+
mcpUrl?: string;
|
|
38
32
|
children?: React.ReactNode;
|
|
39
33
|
}
|
|
40
34
|
|
|
@@ -44,7 +38,7 @@ export interface BujangContextValue {
|
|
|
44
38
|
usePageTitle?: (title: string) => void;
|
|
45
39
|
titleSuffix: string;
|
|
46
40
|
colorMode?: 'light' | 'dark';
|
|
47
|
-
|
|
41
|
+
mcpUrl?: string;
|
|
48
42
|
}
|
|
49
43
|
|
|
50
44
|
const defaultContext: BujangContextValue = {
|
|
@@ -64,7 +58,7 @@ export function BujangProvider({
|
|
|
64
58
|
usePageTitle,
|
|
65
59
|
titleSuffix = 'bujang',
|
|
66
60
|
colorMode,
|
|
67
|
-
|
|
61
|
+
mcpUrl,
|
|
68
62
|
children,
|
|
69
63
|
}: BujangProviderProps): React.ReactElement {
|
|
70
64
|
// Configure synchronously so the children's first queries use it.
|
|
@@ -86,8 +80,8 @@ export function BujangProvider({
|
|
|
86
80
|
usePageTitle,
|
|
87
81
|
titleSuffix,
|
|
88
82
|
colorMode,
|
|
89
|
-
|
|
90
|
-
}), [apiBase, basePath, paths, usePageTitle, titleSuffix, colorMode,
|
|
83
|
+
mcpUrl,
|
|
84
|
+
}), [apiBase, basePath, paths, usePageTitle, titleSuffix, colorMode, mcpUrl]);
|
|
91
85
|
|
|
92
86
|
return (
|
|
93
87
|
<BujangContext.Provider value={value}>
|
package/src/index.ts
CHANGED
|
@@ -3,16 +3,21 @@ export { JobsView } from './views/JobsView';
|
|
|
3
3
|
export { JobSubmitView } from './views/JobSubmitView';
|
|
4
4
|
export { JobDetailsView } from './views/JobDetails';
|
|
5
5
|
export { JobLogsView } from './views/JobLogs';
|
|
6
|
-
export { PipelinesView } from './views/PipelinesView';
|
|
6
|
+
export { PipelinesView, PipelineDetailsView } from './views/PipelinesView';
|
|
7
|
+
export { PipelineGraph, pipelineMermaid, pipelineSteps } from './views/PipelineGraph';
|
|
8
|
+
export type { GraphStep } from './views/PipelineGraph';
|
|
7
9
|
export { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
8
|
-
export { AgentActivityView, AgentBadge } from './views/AgentActivityView';
|
|
10
|
+
export { AgentActivityView, AgentBadge, McpHelp } from './views/AgentActivityView';
|
|
11
|
+
export { SettingsView } from './views/SettingsView';
|
|
9
12
|
export { JobSubmissionForm } from './views/JobSubmit';
|
|
10
13
|
export type { JobSubmissionInitialData } from './views/JobSubmit';
|
|
11
14
|
export { LogDisplay } from './views/LogDisplay';
|
|
15
|
+
export { JobArtifactsCard } from './views/JobArtifacts';
|
|
16
|
+
export { JobImportantButton, JobGroupsButton, JobImportantStar } from './views/JobMarks';
|
|
12
17
|
|
|
13
18
|
// Provider, paths, routes
|
|
14
19
|
export { BujangProvider, useBujang, useBujangPaths } from './context';
|
|
15
|
-
export type { BujangProviderProps, BujangContextValue
|
|
20
|
+
export type { BujangProviderProps, BujangContextValue } from './context';
|
|
16
21
|
export { createBujangPaths, defaultRoutePatterns, normalizeBasePath, bujangNavItems } from './paths';
|
|
17
22
|
export type { BujangPaths, BujangView, BujangNavItem } from './paths';
|
|
18
23
|
export { bujangRoutes, bujangRouteElements } from './routes';
|
package/src/paths.ts
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { IconType } from 'react-icons';
|
|
2
|
+
import { LuBot, LuCalendarClock, LuList, LuSend, LuSettings, LuWorkflow } from 'react-icons/lu';
|
|
3
|
+
|
|
1
4
|
/** Names of the bujang views. */
|
|
2
5
|
export type BujangView =
|
|
3
6
|
| 'jobs'
|
|
@@ -5,8 +8,10 @@ export type BujangView =
|
|
|
5
8
|
| 'jobDetails'
|
|
6
9
|
| 'jobLogs'
|
|
7
10
|
| 'pipelines'
|
|
11
|
+
| 'pipelineDetails'
|
|
8
12
|
| 'scheduled'
|
|
9
|
-
| 'agent'
|
|
13
|
+
| 'agent'
|
|
14
|
+
| 'settings';
|
|
10
15
|
|
|
11
16
|
/** URL builders the views use to link to each other. */
|
|
12
17
|
export interface BujangPaths {
|
|
@@ -15,9 +20,13 @@ export interface BujangPaths {
|
|
|
15
20
|
jobDetails: (slurmJobId: string | number, jrJobId: string) => string;
|
|
16
21
|
jobLogs: (slurmJobId: string | number, jrJobId: string) => string;
|
|
17
22
|
pipelines: () => string;
|
|
23
|
+
/** One saved pipeline: its graph and its runs, `runId` shows that run. */
|
|
24
|
+
pipelineDetails: (name: string, runId?: string) => string;
|
|
18
25
|
scheduled: () => string;
|
|
19
26
|
/** Agent activity, optionally filtered on one session. */
|
|
20
27
|
agent: (session?: string) => string;
|
|
28
|
+
/** Settings: folders, database, SSH, secrets (read-only unless the server allows edits). */
|
|
29
|
+
settings: () => string;
|
|
21
30
|
}
|
|
22
31
|
|
|
23
32
|
/** Default URL layout (react-router patterns), relative to the host's basePath. */
|
|
@@ -27,8 +36,10 @@ export const defaultRoutePatterns: Record<BujangView, string> = {
|
|
|
27
36
|
jobDetails: '/jobrunner/:slurmJobId/:jrJobId',
|
|
28
37
|
jobLogs: '/joblogs/:slurmJobId/:jrJobId',
|
|
29
38
|
pipelines: '/pipelines',
|
|
39
|
+
pipelineDetails: '/pipelines/:pipelineName',
|
|
30
40
|
scheduled: '/scheduled',
|
|
31
41
|
agent: '/agent',
|
|
42
|
+
settings: '/settings',
|
|
32
43
|
};
|
|
33
44
|
|
|
34
45
|
/** Normalise "", "/", "/x/" to "", "", "/x". */
|
|
@@ -48,8 +59,10 @@ export function createBujangPaths(basePath: string = ''): BujangPaths {
|
|
|
48
59
|
jobDetails: (slurmJobId, jrJobId) => `${b}/jobrunner/${seg(slurmJobId)}/${seg(jrJobId)}`,
|
|
49
60
|
jobLogs: (slurmJobId, jrJobId) => `${b}/joblogs/${seg(slurmJobId)}/${seg(jrJobId)}`,
|
|
50
61
|
pipelines: () => `${b}/pipelines`,
|
|
62
|
+
pipelineDetails: (name, runId) => `${b}/pipelines/${seg(name)}${runId ? `?run=${encodeURIComponent(runId)}` : ''}`,
|
|
51
63
|
scheduled: () => `${b}/scheduled`,
|
|
52
64
|
agent: (session) => (session ? `${b}/agent?session=${encodeURIComponent(session)}` : `${b}/agent`),
|
|
65
|
+
settings: () => `${b}/settings`,
|
|
53
66
|
};
|
|
54
67
|
}
|
|
55
68
|
|
|
@@ -57,15 +70,18 @@ export interface BujangNavItem {
|
|
|
57
70
|
view: BujangView;
|
|
58
71
|
label: string;
|
|
59
72
|
path: string;
|
|
73
|
+
/** Icon of the entry (a react-icons component); optional, hosts can ignore it. */
|
|
74
|
+
icon?: IconType;
|
|
60
75
|
}
|
|
61
76
|
|
|
62
77
|
/** Sidebar entries for the top-level bujang views. */
|
|
63
78
|
export function bujangNavItems(paths: BujangPaths = createBujangPaths()): BujangNavItem[] {
|
|
64
79
|
return [
|
|
65
|
-
{ view: 'jobs', label: 'Jobs', path: paths.jobs() },
|
|
66
|
-
{ view: 'submitJob', label: 'Submit Job', path: paths.submitJob() },
|
|
67
|
-
{ view: 'scheduled', label: 'Scheduled Jobs', path: paths.scheduled() },
|
|
68
|
-
{ view: 'pipelines', label: 'Pipelines', path: paths.pipelines() },
|
|
69
|
-
{ view: 'agent', label: 'Agent Activity', path: paths.agent() },
|
|
80
|
+
{ view: 'jobs', label: 'Jobs', path: paths.jobs(), icon: LuList },
|
|
81
|
+
{ view: 'submitJob', label: 'Submit Job', path: paths.submitJob(), icon: LuSend },
|
|
82
|
+
{ view: 'scheduled', label: 'Scheduled Jobs', path: paths.scheduled(), icon: LuCalendarClock },
|
|
83
|
+
{ view: 'pipelines', label: 'Pipelines', path: paths.pipelines(), icon: LuWorkflow },
|
|
84
|
+
{ view: 'agent', label: 'Agent Activity', path: paths.agent(), icon: LuBot },
|
|
85
|
+
{ view: 'settings', label: 'Settings', path: paths.settings(), icon: LuSettings },
|
|
70
86
|
];
|
|
71
87
|
}
|
package/src/routes.tsx
CHANGED
|
@@ -6,9 +6,10 @@ import { JobsView } from './views/JobsView';
|
|
|
6
6
|
import { JobSubmitView } from './views/JobSubmitView';
|
|
7
7
|
import { JobDetailsView } from './views/JobDetails';
|
|
8
8
|
import { JobLogsView } from './views/JobLogs';
|
|
9
|
-
import { PipelinesView } from './views/PipelinesView';
|
|
9
|
+
import { PipelineDetailsView, PipelinesView } from './views/PipelinesView';
|
|
10
10
|
import { ScheduledJobsView } from './views/ScheduledJobsView';
|
|
11
11
|
import { AgentActivityView } from './views/AgentActivityView';
|
|
12
|
+
import { SettingsView } from './views/SettingsView';
|
|
12
13
|
|
|
13
14
|
export interface BujangRoutesOptions {
|
|
14
15
|
/** Prefix the routes are mounted under, e.g. "/slurm". Must match BujangProvider's basePath. Default "". */
|
|
@@ -30,14 +31,16 @@ const elements: Record<BujangView, () => React.ReactElement> = {
|
|
|
30
31
|
jobDetails: () => <JobDetailsView />,
|
|
31
32
|
jobLogs: () => <JobLogsView />,
|
|
32
33
|
pipelines: () => <PipelinesView />,
|
|
34
|
+
pipelineDetails: () => <PipelineDetailsView />,
|
|
33
35
|
scheduled: () => <ScheduledJobsView />,
|
|
34
36
|
agent: () => <AgentActivityView />,
|
|
37
|
+
settings: () => <SettingsView />,
|
|
35
38
|
};
|
|
36
39
|
|
|
37
40
|
/**
|
|
38
41
|
* Route objects for the default bujang URL layout under `basePath`:
|
|
39
42
|
* /jobs, /jobs/submit, /jobrunner/:slurmJobId/:jrJobId, /joblogs/:slurmJobId/:jrJobId,
|
|
40
|
-
* /pipelines, /scheduled, /agent.
|
|
43
|
+
* /pipelines, /pipelines/:pipelineName, /scheduled, /agent, /settings.
|
|
41
44
|
*/
|
|
42
45
|
export function bujangRoutes(options: BujangRoutesOptions = {}): BujangRouteObject[] {
|
|
43
46
|
const base = normalizeBasePath(options.basePath);
|