@milabench/bujang 0.1.15 → 0.1.16
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 +8009 -7362
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +52 -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 +38 -9
- package/dist/views/SettingsView.d.ts +4 -0
- package/dist/views/dataCharts.d.ts +11 -7
- package/package.json +1 -1
- package/src/api.ts +9 -2
- package/src/types.ts +40 -6
- package/src/views/JobArtifacts.tsx +1 -1
- package/src/views/JobDataOverview.tsx +125 -138
- package/src/views/JobLogs.tsx +17 -7
- 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 +940 -88
- package/src/views/SettingsView.tsx +80 -18
- package/src/views/dataCharts.tsx +21 -11
package/dist/types.d.ts
CHANGED
|
@@ -564,6 +564,8 @@ export interface SettingsField<T = string> {
|
|
|
564
564
|
export type SettingsFieldName = 'local_cache' | 'workdir' | 'database_url';
|
|
565
565
|
export type SettingsFields = Record<SettingsFieldName, SettingsField> & {
|
|
566
566
|
show_examples: SettingsField<boolean>;
|
|
567
|
+
/** Jobs page: the active and the persisted jobs in one table (false: one table each). */
|
|
568
|
+
jobs_merged: SettingsField<boolean>;
|
|
567
569
|
/** What the MCP server tells the agents when they connect (null: general.mcp.default_instructions). */
|
|
568
570
|
mcp_instructions: SettingsField;
|
|
569
571
|
/** The default layout of the Overview tab (null: the built-in one). */
|
|
@@ -712,12 +714,18 @@ export interface SshPluginStatus {
|
|
|
712
714
|
values: Record<string, string>;
|
|
713
715
|
line: number | null;
|
|
714
716
|
duplicates: number;
|
|
715
|
-
/**
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
717
|
+
/** Placeholder values read in the user's own entries. */
|
|
718
|
+
inferred: Record<string, string>;
|
|
719
|
+
/** How each host merges with the user's entries. */
|
|
720
|
+
hosts: SshHostMerge[];
|
|
721
|
+
}
|
|
722
|
+
/** Where the options of a host come from: the user's own entries win */
|
|
723
|
+
export interface SshHostMerge {
|
|
724
|
+
alias: string;
|
|
725
|
+
/** the alias of the user it is merged with (the same, or another one of the same machine), null: none */
|
|
726
|
+
source: string | null;
|
|
727
|
+
yours: Record<string, string>;
|
|
728
|
+
plugin: Record<string, string>;
|
|
721
729
|
}
|
|
722
730
|
export interface SshSettings {
|
|
723
731
|
file: string;
|
|
@@ -747,6 +755,7 @@ export interface SshPlan {
|
|
|
747
755
|
messages: string[];
|
|
748
756
|
warnings: string[];
|
|
749
757
|
aliases: string[];
|
|
758
|
+
hosts: SshHostMerge[];
|
|
750
759
|
base: string;
|
|
751
760
|
backup?: string | null;
|
|
752
761
|
written?: boolean;
|
|
@@ -872,8 +881,25 @@ export interface JobDataField {
|
|
|
872
881
|
/** distinct values of a string field, null when there are too many */
|
|
873
882
|
values?: string[] | null;
|
|
874
883
|
}
|
|
875
|
-
/** A
|
|
876
|
-
export
|
|
884
|
+
/** A row of a stats block: a number field of an event */
|
|
885
|
+
export interface StatsMetric {
|
|
886
|
+
event: string;
|
|
887
|
+
field: string;
|
|
888
|
+
title?: string;
|
|
889
|
+
}
|
|
890
|
+
/** A block of the Overview tab: the log view, the media of the artifact folders, or a chart (Vega-Lite) of one or several events */
|
|
891
|
+
export type OverviewBlock = {
|
|
892
|
+
kind: 'artifacts';
|
|
893
|
+
title?: string;
|
|
894
|
+
files?: string;
|
|
895
|
+
} | {
|
|
896
|
+
kind: 'files';
|
|
897
|
+
title?: string;
|
|
898
|
+
} | {
|
|
899
|
+
kind: 'stats';
|
|
900
|
+
title?: string;
|
|
901
|
+
metrics?: StatsMetric[];
|
|
902
|
+
} | {
|
|
877
903
|
kind: 'logs';
|
|
878
904
|
title?: string;
|
|
879
905
|
levels?: string[];
|
|
@@ -881,6 +907,7 @@ export type OverviewPanel = {
|
|
|
881
907
|
} | {
|
|
882
908
|
kind: 'chart';
|
|
883
909
|
title?: string;
|
|
910
|
+
/** comma separated events; the rows have theirs as `type` */
|
|
884
911
|
event?: string;
|
|
885
912
|
/** comma separated paths or globs, relative to the job folder */
|
|
886
913
|
files?: string;
|
|
@@ -897,6 +924,11 @@ export type OverviewPanel = {
|
|
|
897
924
|
log_y?: boolean;
|
|
898
925
|
zero?: boolean;
|
|
899
926
|
};
|
|
927
|
+
/** A panel of the Overview tab: a block, or columns of blocks side by side */
|
|
928
|
+
export type OverviewPanel = OverviewBlock | {
|
|
929
|
+
kind: 'columns';
|
|
930
|
+
columns: OverviewBlock[][];
|
|
931
|
+
};
|
|
900
932
|
export interface OverviewLayout {
|
|
901
933
|
panels: OverviewPanel[];
|
|
902
934
|
}
|
|
@@ -904,11 +936,21 @@ export type OverviewScope = 'experiment' | 'script';
|
|
|
904
936
|
/** GET /jobs/<jr>/overview/layout */
|
|
905
937
|
export interface JobOverviewLayout {
|
|
906
938
|
layout: OverviewLayout;
|
|
907
|
-
/**
|
|
939
|
+
/** every layout the page can show, the one of the job first */
|
|
940
|
+
layouts: {
|
|
941
|
+
layout: OverviewLayout;
|
|
942
|
+
source: JobOverviewLayout['source'];
|
|
943
|
+
label: string | null;
|
|
944
|
+
}[];
|
|
945
|
+
/** the name its layout file gives it */
|
|
946
|
+
label: string | null;
|
|
947
|
+
/** where it comes from: saved for the experiment / script, a layout file, a plugin, the setting, the built-in one */
|
|
908
948
|
source: {
|
|
909
|
-
kind: OverviewScope | 'plugin' | 'setting' | 'default';
|
|
949
|
+
kind: OverviewScope | 'file' | 'plugin' | 'setting' | 'default';
|
|
910
950
|
name: string | null;
|
|
911
951
|
};
|
|
952
|
+
/** the charts of the built-in layout, to add to this one */
|
|
953
|
+
blocks: OverviewBlock[];
|
|
912
954
|
/** what a layout can be saved for */
|
|
913
955
|
keys: {
|
|
914
956
|
experiment: string | null;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
export declare const formatSize: (bytes: number) => string;
|
|
2
3
|
/**
|
|
3
4
|
* The reports and other files of a job's results/ and output/ folders, delivered by the server:
|
|
4
5
|
* an HTML report opens in a new tab (its images and scripts load next to it), the rest downloads.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
/**
|
|
3
3
|
* The Overview tab of a job: the panels of its layout (the log view, charts: GET
|
|
4
|
-
* /jobs/<jr>/overview/layout),
|
|
5
|
-
* runs/, results/) plotted with
|
|
6
|
-
* is shown with the rows URL as an Altair snippet, and can be added to the layout.
|
|
4
|
+
* /jobs/<jr>/overview/layout), or the "explore data" layout: the JSONL files of its artifact folders
|
|
5
|
+
* (output/, runs/, results/) plotted with a chart builder, whose charts can be added to the layout of the job.
|
|
7
6
|
*/
|
|
8
7
|
export declare const JobDataOverview: React.FC<{
|
|
9
8
|
jrJobId: string;
|
|
9
|
+
/** the job is running (or waiting): its data is followed */
|
|
10
|
+
live?: boolean;
|
|
10
11
|
}>;
|
|
@@ -43,10 +43,13 @@ interface JobsTableProps {
|
|
|
43
43
|
} | null;
|
|
44
44
|
empty: string;
|
|
45
45
|
emptyHint: string;
|
|
46
|
-
|
|
46
|
+
/** caps the rows' height; without it they fill the card (give the card a height, e.g. flex: 1) */
|
|
47
|
+
maxH?: string;
|
|
47
48
|
onCancel: (jobId: string) => void;
|
|
48
49
|
onRerun: (jrJobId: string) => void;
|
|
49
50
|
onGroup: (group: string) => void;
|
|
51
|
+
/** quick filters (important, organizers), in the header next to the title */
|
|
52
|
+
quickFilters?: React.ReactNode;
|
|
50
53
|
}
|
|
51
54
|
export declare const JobsTable: React.FC<JobsTableProps & {
|
|
52
55
|
cardProps?: React.ComponentProps<typeof Card.Root>;
|
|
@@ -1,23 +1,49 @@
|
|
|
1
1
|
/** The panels of a job's Overview layout: the log view and the charts, and the bar saying where the layout comes from. */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { JobData, JobOverviewLayout,
|
|
4
|
-
|
|
3
|
+
import type { JobData, JobOverviewLayout, OverviewBlock, OverviewLayout } from '../types';
|
|
4
|
+
/** What can be done with a block of the layout; the moves are absent where they lead nowhere */
|
|
5
|
+
interface BlockActions {
|
|
6
|
+
editing: boolean;
|
|
7
|
+
onMove: (by: number) => void;
|
|
8
|
+
onRemove: () => void;
|
|
9
|
+
/** to the column on the left / right */
|
|
10
|
+
onShift?: (by: number) => void;
|
|
11
|
+
/** put the block in the first of two columns */
|
|
12
|
+
onSplit?: () => void;
|
|
13
|
+
onChange: (block: OverviewBlock) => void;
|
|
14
|
+
/** an editor of the block opens or closes */
|
|
15
|
+
onEditor: (open: boolean) => void;
|
|
16
|
+
}
|
|
17
|
+
type PanelProps<K extends OverviewBlock['kind']> = {
|
|
5
18
|
jrJobId: string;
|
|
6
19
|
files: JobData['files'];
|
|
7
|
-
panel: Extract<
|
|
20
|
+
panel: Extract<OverviewBlock, {
|
|
8
21
|
kind: K;
|
|
9
22
|
}>;
|
|
10
|
-
|
|
11
|
-
onMove: (by: number) => void;
|
|
12
|
-
onRemove: () => void;
|
|
23
|
+
actions: BlockActions;
|
|
13
24
|
};
|
|
14
|
-
/** The log view: the rows of role `log` (the `logging` records of the job) */
|
|
25
|
+
/** The log view: the rows of role `log` (the `logging` records of the job), and its events when asked */
|
|
15
26
|
export declare const LogPanel: React.FC<PanelProps<'logs'>>;
|
|
16
|
-
/**
|
|
27
|
+
/** The images, sounds and videos of the artifact folders (output/, results/, ...) */
|
|
28
|
+
export declare const ArtifactPanel: React.FC<PanelProps<'artifacts'>>;
|
|
29
|
+
/** The tree of the artifact folders (output/, results/, ...), its files to download */
|
|
30
|
+
export declare const FilesPanel: React.FC<PanelProps<'files'>>;
|
|
31
|
+
/** A table of the statistics of number fields, picked with its gear */
|
|
32
|
+
export declare const StatsPanel: React.FC<PanelProps<'stats'>>;
|
|
33
|
+
/** A chart of one or several events */
|
|
17
34
|
export declare const ChartPanel: React.FC<PanelProps<'chart'>>;
|
|
18
|
-
/**
|
|
35
|
+
/** The layout shown: the one of the job, or the built-in explorer of its data */
|
|
36
|
+
export type OverviewView = 'job' | 'explore';
|
|
37
|
+
type LayoutSource = JobOverviewLayout['source'];
|
|
38
|
+
export declare const layoutKeyOf: (source: LayoutSource) => string;
|
|
39
|
+
/** The choice of the layout, where it comes from, and the buttons to edit, save and reset it */
|
|
19
40
|
export declare const LayoutBar: React.FC<{
|
|
20
41
|
found: JobOverviewLayout;
|
|
42
|
+
/** where the layout shown comes from */
|
|
43
|
+
source: LayoutSource;
|
|
44
|
+
view: OverviewView;
|
|
45
|
+
/** `layout`: the key of the layout to show */
|
|
46
|
+
onView: (view: OverviewView, layout?: string) => void;
|
|
21
47
|
dirty: boolean;
|
|
22
48
|
editing: boolean;
|
|
23
49
|
saving: boolean;
|
|
@@ -31,7 +57,10 @@ export declare const LayoutPanels: React.FC<{
|
|
|
31
57
|
jrJobId: string;
|
|
32
58
|
files: JobData['files'];
|
|
33
59
|
layout: OverviewLayout;
|
|
60
|
+
/** the charts of the built-in layout */
|
|
61
|
+
available: OverviewBlock[];
|
|
34
62
|
editing: boolean;
|
|
35
63
|
onChange: (layout: OverviewLayout) => void;
|
|
64
|
+
onEditor: (open: boolean) => void;
|
|
36
65
|
}>;
|
|
37
66
|
export {};
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import type { SettingsInfo } from '../types';
|
|
3
3
|
export declare const SETTINGS_KEY: string[];
|
|
4
|
+
/** jobs_merged: one table for the active and the persisted jobs on the Jobs page; saved at once */
|
|
5
|
+
export declare const DisplayCard: React.FC<{
|
|
6
|
+
info: SettingsInfo;
|
|
7
|
+
}>;
|
|
4
8
|
export declare const FoldersCard: React.FC<{
|
|
5
9
|
info: SettingsInfo;
|
|
6
10
|
}>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/** Charts of the JSONL data of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import type { JobData, JobDataField, JobDataRole,
|
|
3
|
+
import type { JobData, JobDataField, JobDataRole, OverviewBlock } from '../types';
|
|
4
4
|
/** Rows fetched for a chart (the server caps at 500k) */
|
|
5
5
|
export declare const ROW_LIMIT = 50000;
|
|
6
6
|
/** Fields every row has: the file it comes from */
|
|
@@ -9,7 +9,7 @@ export declare const MARKS: readonly ["point", "line", "bar", "tick", "boxplot",
|
|
|
9
9
|
export declare const AGGREGATES: readonly ["", "mean", "median", "sum", "min", "max", "count"];
|
|
10
10
|
/** Events listed first: the plotted ones (the server gives each event its role) */
|
|
11
11
|
export declare const ROLE_ORDER: Record<JobDataRole, number>;
|
|
12
|
-
/** The keys of a `bujang.
|
|
12
|
+
/** The keys of a `bujang.instrumentation` line around its data: never a category of a chart */
|
|
13
13
|
export declare const ENVELOPE_FIELDS: Set<string>;
|
|
14
14
|
export interface Builder {
|
|
15
15
|
mark: (typeof MARKS)[number];
|
|
@@ -42,15 +42,19 @@ export declare const VegaChart: React.FC<{
|
|
|
42
42
|
spec: Record<string, unknown>;
|
|
43
43
|
rows: Record<string, unknown>[];
|
|
44
44
|
}>;
|
|
45
|
-
/** The
|
|
45
|
+
/** The events of a panel (`event`: comma separated, "" for the records without event) */
|
|
46
|
+
export declare const panelEvents: (event?: string) => string[];
|
|
47
|
+
/** The files that have rows of `event` (comma separated events) */
|
|
46
48
|
export declare const filesWithEvent: (files: JobData["files"], event: string) => JobData["files"];
|
|
47
|
-
/** The fields of `event` in `files`, merged (counts added, ranges widened, values joined) */
|
|
49
|
+
/** The fields of `event` (comma separated events) in `files`, merged (counts added, ranges widened, values joined) */
|
|
48
50
|
export declare const mergeFields: (files: JobData["files"], event: string) => JobDataField[];
|
|
49
51
|
/** The files a panel reads (`files`: comma separated paths or globs, all when empty) */
|
|
50
|
-
export declare const panelFiles:
|
|
52
|
+
export declare const panelFiles: <T extends {
|
|
53
|
+
path: string;
|
|
54
|
+
}>(files: T[], patterns?: string) => T[];
|
|
51
55
|
/** A chart panel of a layout from the builder (only what differs from the defaults) */
|
|
52
|
-
export declare const panelOfBuilder: (b: Builder, event: string, title?: string) =>
|
|
56
|
+
export declare const panelOfBuilder: (b: Builder, event: string, title?: string) => OverviewBlock;
|
|
53
57
|
/** The builder of a chart panel; null when the panel gives no field (the page guesses them) */
|
|
54
|
-
export declare const builderOfPanel: (p: Extract<
|
|
58
|
+
export declare const builderOfPanel: (p: Extract<OverviewBlock, {
|
|
55
59
|
kind: "chart";
|
|
56
60
|
}>) => Builder | null;
|
package/package.json
CHANGED
package/src/api.ts
CHANGED
|
@@ -95,6 +95,12 @@ export function getBujangApiConfig(): { apiBase: string; axios: BujangHttpClient
|
|
|
95
95
|
return { apiBase: currentBase, axios: currentInstance };
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
+
/** The prefix of a URL the browser opens itself (a link, an image): apiBase after the baseURL of the axios instance, as axios joins them. */
|
|
99
|
+
const urlBase = (): string => {
|
|
100
|
+
const baseURL = (currentInstance as { defaults?: { baseURL?: string } }).defaults?.baseURL;
|
|
101
|
+
return baseURL && !/^([a-z][a-z\d+.-]*:)?\/\//i.test(currentBase) ? `${trimSlash(baseURL)}/${currentBase.replace(/^\/+/, '')}` : currentBase;
|
|
102
|
+
};
|
|
103
|
+
|
|
98
104
|
const api = {
|
|
99
105
|
get: <T = any>(path: string, config?: AxiosRequestConfig) => currentInstance.get<T>(currentBase + path, config),
|
|
100
106
|
post: <T = any>(path: string, data?: unknown, config?: AxiosRequestConfig) => currentInstance.post<T>(currentBase + path, data, config),
|
|
@@ -514,6 +520,7 @@ export const updateSettings = async (
|
|
|
514
520
|
values: Partial<
|
|
515
521
|
Record<'local_cache' | 'workdir' | 'database_url' | 'mcp_instructions', string | null> & {
|
|
516
522
|
show_examples: boolean;
|
|
523
|
+
jobs_merged: boolean;
|
|
517
524
|
overview_layout: OverviewLayout | null;
|
|
518
525
|
}
|
|
519
526
|
>,
|
|
@@ -534,7 +541,7 @@ export const getJobArtifacts = async (jrJobId: string): Promise<JobArtifacts> =>
|
|
|
534
541
|
|
|
535
542
|
/** URL of an artifact, to open in a tab: its relative links (images, scripts) resolve next to it. */
|
|
536
543
|
export const jobArtifactUrl = (jrJobId: string, path: string): string =>
|
|
537
|
-
`${
|
|
544
|
+
`${urlBase()}/jobs/${encodeURIComponent(jrJobId)}/artifacts/${path.split('/').map(encodeURIComponent).join('/')}`;
|
|
538
545
|
|
|
539
546
|
/** The layout of a job's Overview tab and where it comes from. */
|
|
540
547
|
export const getJobOverviewLayout = async (jrJobId: string): Promise<JobOverviewLayout> => {
|
|
@@ -603,7 +610,7 @@ export const getJobDataRows = async (jrJobId: string, query: JobDataRowsQuery):
|
|
|
603
610
|
|
|
604
611
|
/** URL of the rows of a job: a Vega-Lite / Altair data url (relative to the page when apiBase is). */
|
|
605
612
|
export const jobDataRowsUrl = (jrJobId: string, query: JobDataRowsQuery): string =>
|
|
606
|
-
`${
|
|
613
|
+
`${urlBase()}/jobs/${encodeURIComponent(jrJobId)}/data/rows?${rowsParams(query)}`;
|
|
607
614
|
|
|
608
615
|
/** When the job index was last synced with the clusters. */
|
|
609
616
|
export const getSyncStatus = async (): Promise<SyncStatus> => {
|
package/src/types.ts
CHANGED
|
@@ -638,6 +638,8 @@ export type SettingsFieldName = 'local_cache' | 'workdir' | 'database_url';
|
|
|
638
638
|
|
|
639
639
|
export type SettingsFields = Record<SettingsFieldName, SettingsField> & {
|
|
640
640
|
show_examples: SettingsField<boolean>;
|
|
641
|
+
/** Jobs page: the active and the persisted jobs in one table (false: one table each). */
|
|
642
|
+
jobs_merged: SettingsField<boolean>;
|
|
641
643
|
/** What the MCP server tells the agents when they connect (null: general.mcp.default_instructions). */
|
|
642
644
|
mcp_instructions: SettingsField;
|
|
643
645
|
/** The default layout of the Overview tab (null: the built-in one). */
|
|
@@ -768,8 +770,19 @@ export interface SshPluginStatus {
|
|
|
768
770
|
values: Record<string, string>;
|
|
769
771
|
line: number | null;
|
|
770
772
|
duplicates: number;
|
|
771
|
-
/**
|
|
772
|
-
|
|
773
|
+
/** Placeholder values read in the user's own entries. */
|
|
774
|
+
inferred: Record<string, string>;
|
|
775
|
+
/** How each host merges with the user's entries. */
|
|
776
|
+
hosts: SshHostMerge[];
|
|
777
|
+
}
|
|
778
|
+
|
|
779
|
+
/** Where the options of a host come from: the user's own entries win */
|
|
780
|
+
export interface SshHostMerge {
|
|
781
|
+
alias: string;
|
|
782
|
+
/** the alias of the user it is merged with (the same, or another one of the same machine), null: none */
|
|
783
|
+
source: string | null;
|
|
784
|
+
yours: Record<string, string>;
|
|
785
|
+
plugin: Record<string, string>;
|
|
773
786
|
}
|
|
774
787
|
|
|
775
788
|
export interface SshSettings {
|
|
@@ -799,6 +812,7 @@ export interface SshPlan {
|
|
|
799
812
|
messages: string[];
|
|
800
813
|
warnings: string[];
|
|
801
814
|
aliases: string[];
|
|
815
|
+
hosts: SshHostMerge[];
|
|
802
816
|
base: string;
|
|
803
817
|
// install / remove only
|
|
804
818
|
backup?: string | null;
|
|
@@ -924,12 +938,23 @@ export interface JobDataField {
|
|
|
924
938
|
values?: string[] | null;
|
|
925
939
|
}
|
|
926
940
|
|
|
927
|
-
/** A
|
|
928
|
-
export
|
|
941
|
+
/** A row of a stats block: a number field of an event */
|
|
942
|
+
export interface StatsMetric {
|
|
943
|
+
event: string;
|
|
944
|
+
field: string;
|
|
945
|
+
title?: string;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
/** A block of the Overview tab: the log view, the media of the artifact folders, or a chart (Vega-Lite) of one or several events */
|
|
949
|
+
export type OverviewBlock =
|
|
950
|
+
| { kind: 'artifacts'; title?: string; files?: string }
|
|
951
|
+
| { kind: 'files'; title?: string }
|
|
952
|
+
| { kind: 'stats'; title?: string; metrics?: StatsMetric[] }
|
|
929
953
|
| { kind: 'logs'; title?: string; levels?: string[]; files?: string }
|
|
930
954
|
| {
|
|
931
955
|
kind: 'chart';
|
|
932
956
|
title?: string;
|
|
957
|
+
/** comma separated events; the rows have theirs as `type` */
|
|
933
958
|
event?: string;
|
|
934
959
|
/** comma separated paths or globs, relative to the job folder */
|
|
935
960
|
files?: string;
|
|
@@ -947,6 +972,9 @@ export type OverviewPanel =
|
|
|
947
972
|
zero?: boolean;
|
|
948
973
|
};
|
|
949
974
|
|
|
975
|
+
/** A panel of the Overview tab: a block, or columns of blocks side by side */
|
|
976
|
+
export type OverviewPanel = OverviewBlock | { kind: 'columns'; columns: OverviewBlock[][] };
|
|
977
|
+
|
|
950
978
|
export interface OverviewLayout {
|
|
951
979
|
panels: OverviewPanel[];
|
|
952
980
|
}
|
|
@@ -956,8 +984,14 @@ export type OverviewScope = 'experiment' | 'script';
|
|
|
956
984
|
/** GET /jobs/<jr>/overview/layout */
|
|
957
985
|
export interface JobOverviewLayout {
|
|
958
986
|
layout: OverviewLayout;
|
|
959
|
-
/**
|
|
960
|
-
|
|
987
|
+
/** every layout the page can show, the one of the job first */
|
|
988
|
+
layouts: { layout: OverviewLayout; source: JobOverviewLayout['source']; label: string | null }[];
|
|
989
|
+
/** the name its layout file gives it */
|
|
990
|
+
label: string | null;
|
|
991
|
+
/** where it comes from: saved for the experiment / script, a layout file, a plugin, the setting, the built-in one */
|
|
992
|
+
source: { kind: OverviewScope | 'file' | 'plugin' | 'setting' | 'default'; name: string | null };
|
|
993
|
+
/** the charts of the built-in layout, to add to this one */
|
|
994
|
+
blocks: OverviewBlock[];
|
|
961
995
|
/** what a layout can be saved for */
|
|
962
996
|
keys: { experiment: string | null; script: string };
|
|
963
997
|
}
|
|
@@ -5,7 +5,7 @@ import { LuDownload, LuExternalLink, LuFileText } from 'react-icons/lu';
|
|
|
5
5
|
import { getJobArtifacts, jobArtifactUrl } from '../api';
|
|
6
6
|
import type { ApiError, JobArtifacts } from '../types';
|
|
7
7
|
|
|
8
|
-
const formatSize = (bytes: number) => {
|
|
8
|
+
export const formatSize = (bytes: number) => {
|
|
9
9
|
if (bytes < 1024) return `${bytes} B`;
|
|
10
10
|
const units = ['KB', 'MB', 'GB', 'TB'];
|
|
11
11
|
let value = bytes / 1024;
|