@milabench/bujang 0.1.18 → 0.1.20
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 +16 -0
- package/dist/api.d.ts +46 -4
- package/dist/components/OrganizerNav.d.ts +28 -0
- package/dist/components/ProjectsNav.d.ts +15 -0
- package/dist/index.d.ts +11 -2
- package/dist/index.js +6344 -4777
- package/dist/index.js.map +1 -1
- package/dist/paths.d.ts +27 -3
- package/dist/routes.d.ts +7 -2
- package/dist/types.d.ts +118 -4
- package/dist/views/CollectionView.d.ts +22 -0
- package/dist/views/JobDataOverview.d.ts +1 -1
- package/dist/views/JobsTable.d.ts +1 -0
- package/dist/views/JobsView.d.ts +12 -1
- package/dist/views/OrganizerValuesView.d.ts +13 -0
- package/dist/views/OverviewPanels.d.ts +13 -2
- package/dist/views/ProjectDetailsView.d.ts +3 -0
- package/dist/views/ProjectsView.d.ts +20 -0
- package/dist/views/dataCharts.d.ts +1 -1
- package/package.json +1 -1
- package/src/api.ts +90 -8
- package/src/components/OrganizerNav.tsx +121 -0
- package/src/components/ProjectsNav.tsx +101 -0
- package/src/index.ts +11 -2
- package/src/paths.ts +50 -3
- package/src/routes.tsx +21 -4
- package/src/types.ts +117 -5
- package/src/views/CollectionView.tsx +68 -0
- package/src/views/JanitorView.tsx +2 -1
- package/src/views/JobDataOverview.tsx +23 -6
- package/src/views/JobLogs.tsx +47 -2
- package/src/views/JobSubmit.tsx +25 -0
- package/src/views/JobsTable.tsx +81 -21
- package/src/views/JobsView.tsx +49 -9
- package/src/views/OrganizerValuesView.tsx +207 -0
- package/src/views/OverviewPanels.tsx +531 -7
- package/src/views/PipelineEditor.tsx +69 -2
- package/src/views/PipelinesView.tsx +145 -4
- package/src/views/ProjectDetailsView.tsx +112 -0
- package/src/views/ProjectsView.tsx +355 -0
- package/src/views/dataCharts.tsx +1 -1
|
@@ -0,0 +1,355 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
import { Link, useNavigate } from 'react-router-dom';
|
|
3
|
+
import { Badge, Box, Button, Code, Heading, HStack, Input, Spinner, Text, VStack } from '@chakra-ui/react';
|
|
4
|
+
import { useMutation, useQuery, useQueryClient } from '@tanstack/react-query';
|
|
5
|
+
import { LuArchive, LuBot, LuFolderGit2, LuLink, LuPlus, LuRefreshCw, LuTrash2 } from 'react-icons/lu';
|
|
6
|
+
import { getProjects, janitorArchive, registerProject, removeProject, syncProjects } from '../api';
|
|
7
|
+
import type { ApiError, JanitorArchiveResult, Project, ProjectsInfo } from '../types';
|
|
8
|
+
import { LinkableCard, useHashScroll } from '../components/LinkableCard';
|
|
9
|
+
import { Tooltip } from '../components/tooltip';
|
|
10
|
+
import { toaster } from '../toast';
|
|
11
|
+
import { useBujangPaths } from '../context';
|
|
12
|
+
import { usePageTitle } from '../hooks/usePageTitle';
|
|
13
|
+
|
|
14
|
+
export const PROJECTS_KEY = ['bujang-projects'];
|
|
15
|
+
|
|
16
|
+
const inputStyle = {
|
|
17
|
+
bg: 'var(--color-input-bg)',
|
|
18
|
+
borderColor: 'var(--color-input-border)',
|
|
19
|
+
color: 'var(--color-text)',
|
|
20
|
+
} as const;
|
|
21
|
+
|
|
22
|
+
const errorMessage = (error: unknown) => (error as ApiError)?.message || String(error);
|
|
23
|
+
const fail = (title: string) => (error: unknown) =>
|
|
24
|
+
toaster.create({ title, description: errorMessage(error), type: 'error', closable: true });
|
|
25
|
+
|
|
26
|
+
/** The last folder of a path, as a project name ("~/work/my repo/" -> "my-repo") */
|
|
27
|
+
function nameFromPath(path: string): string {
|
|
28
|
+
const last = path.replace(/[\\/]+$/, '').split(/[\\/]/).pop() || '';
|
|
29
|
+
return last.replace(/[^A-Za-z0-9._@+=,-]+/g, '-').replace(/^[^A-Za-z0-9]+/, '');
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const Label: React.FC<{ children: React.ReactNode }> = ({ children }) => (
|
|
33
|
+
<Text fontSize="xs" fontWeight="semibold" color="var(--color-text-muted)" mb={1}>{children}</Text>
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
const RegisterCard: React.FC<{ info: ProjectsInfo }> = ({ info }) => {
|
|
37
|
+
const queryClient = useQueryClient();
|
|
38
|
+
const navigate = useNavigate();
|
|
39
|
+
const paths = useBujangPaths();
|
|
40
|
+
const [path, setPath] = useState('');
|
|
41
|
+
const [name, setName] = useState('');
|
|
42
|
+
const [folder, setFolder] = useState('');
|
|
43
|
+
const register = useMutation({
|
|
44
|
+
mutationFn: () => registerProject({ name: name || nameFromPath(path), path, folder: folder || undefined }),
|
|
45
|
+
onSuccess: (out) => {
|
|
46
|
+
const linked = out.sync?.added?.length ?? 0;
|
|
47
|
+
toaster.create({
|
|
48
|
+
title: `Project ${out.project.name} registered`,
|
|
49
|
+
description: `${out.project.path}/${out.project.folder}${linked ? `: ${linked} jobs linked` : ''}`,
|
|
50
|
+
type: 'success',
|
|
51
|
+
});
|
|
52
|
+
setPath(''); setName(''); setFolder('');
|
|
53
|
+
queryClient.invalidateQueries({ queryKey: PROJECTS_KEY });
|
|
54
|
+
navigate(paths.projectDetails(out.project.name));
|
|
55
|
+
},
|
|
56
|
+
onError: fail('Registration failed'),
|
|
57
|
+
});
|
|
58
|
+
const effectiveName = name || nameFromPath(path);
|
|
59
|
+
|
|
60
|
+
return (
|
|
61
|
+
<LinkableCard id="register" icon={<LuPlus />} title="Register a repository"
|
|
62
|
+
subtitle="bujang makes a folder inside it and links there every job tagged for the project">
|
|
63
|
+
{!info.writable ? (
|
|
64
|
+
<Text fontSize="sm" color="var(--color-text-muted)">
|
|
65
|
+
This server is read-only (the host did not turn editing on): projects are registered from a
|
|
66
|
+
server started with <Code fontSize="xs">bujang serve</Code>, or in <Code fontSize="xs">projects.yaml</Code> of the local cache.
|
|
67
|
+
</Text>
|
|
68
|
+
) : (
|
|
69
|
+
<VStack align="stretch" gap={3}>
|
|
70
|
+
<HStack gap={3} align="flex-end" wrap="wrap">
|
|
71
|
+
<Box flex="2" minW="260px">
|
|
72
|
+
<Label>Repository path (on the bujang server's machine)</Label>
|
|
73
|
+
<Input {...inputStyle} size="sm" placeholder="/home/me/work/my-repo" value={path}
|
|
74
|
+
onChange={(e) => setPath(e.target.value)} fontFamily="mono" />
|
|
75
|
+
</Box>
|
|
76
|
+
<Box flex="1" minW="160px">
|
|
77
|
+
<Label>Name</Label>
|
|
78
|
+
<Input {...inputStyle} size="sm" placeholder={nameFromPath(path) || 'my-repo'} value={name}
|
|
79
|
+
onChange={(e) => setName(e.target.value)} />
|
|
80
|
+
</Box>
|
|
81
|
+
<Box flex="1" minW="140px">
|
|
82
|
+
<Label>Folder inside the repository</Label>
|
|
83
|
+
<Input {...inputStyle} size="sm" placeholder={info.default_folder} value={folder}
|
|
84
|
+
onChange={(e) => setFolder(e.target.value)} fontFamily="mono" />
|
|
85
|
+
</Box>
|
|
86
|
+
<Button size="sm" colorPalette="blue" disabled={!path.trim() || !effectiveName}
|
|
87
|
+
loading={register.isPending} onClick={() => register.mutate()}>
|
|
88
|
+
<LuPlus /> Register
|
|
89
|
+
</Button>
|
|
90
|
+
</HStack>
|
|
91
|
+
{path.trim() && (
|
|
92
|
+
<Text fontSize="xs" color="var(--color-text-muted)">
|
|
93
|
+
Jobs submitted with <Code fontSize="xs">project="{effectiveName}"</Code> will show in{' '}
|
|
94
|
+
<Code fontSize="xs">{path.replace(/\/+$/, '')}/{folder || info.default_folder}/<job id></Code>.
|
|
95
|
+
The folder gets a README for the agents working there and a <Code fontSize="xs">.gitignore</Code>.
|
|
96
|
+
</Text>
|
|
97
|
+
)}
|
|
98
|
+
</VStack>
|
|
99
|
+
)}
|
|
100
|
+
</LinkableCard>
|
|
101
|
+
);
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
export const ProjectCard: React.FC<{ project: Project; writable: boolean; onRemoved?: () => void }> = ({ project, writable, onRemoved }) => {
|
|
105
|
+
const paths = useBujangPaths();
|
|
106
|
+
const queryClient = useQueryClient();
|
|
107
|
+
const [confirm, setConfirm] = useState(false);
|
|
108
|
+
const sync = useMutation({
|
|
109
|
+
mutationFn: () => syncProjects(project.name),
|
|
110
|
+
onSuccess: (report) => {
|
|
111
|
+
const r = report[project.name] || {};
|
|
112
|
+
toaster.create({
|
|
113
|
+
title: r.error ? `Cannot link ${project.name}` : `${project.name}: ${r.added?.length ?? 0} links added, ${r.removed?.length ?? 0} removed`,
|
|
114
|
+
description: r.error,
|
|
115
|
+
type: r.error ? 'error' : 'success',
|
|
116
|
+
});
|
|
117
|
+
queryClient.invalidateQueries({ queryKey: PROJECTS_KEY });
|
|
118
|
+
},
|
|
119
|
+
onError: fail('Sync failed'),
|
|
120
|
+
});
|
|
121
|
+
const remove = useMutation({
|
|
122
|
+
mutationFn: () => removeProject(project.name),
|
|
123
|
+
onSuccess: (out) => {
|
|
124
|
+
toaster.create({ title: `Project ${project.name} removed`, description: `${out.removed.length} links removed from the repository`, type: 'success' });
|
|
125
|
+
queryClient.invalidateQueries({ queryKey: PROJECTS_KEY });
|
|
126
|
+
onRemoved?.();
|
|
127
|
+
},
|
|
128
|
+
onError: fail('Removal failed'),
|
|
129
|
+
});
|
|
130
|
+
const jobsLink = paths.projectDetails(project.name);
|
|
131
|
+
|
|
132
|
+
return (
|
|
133
|
+
<LinkableCard
|
|
134
|
+
id={`project-${project.name}`}
|
|
135
|
+
icon={<LuFolderGit2 />}
|
|
136
|
+
title={project.name}
|
|
137
|
+
subtitle={<Code fontSize="xs" bg="transparent" color="var(--color-text-muted)" p={0}>{project.path}</Code>}
|
|
138
|
+
actions={
|
|
139
|
+
<HStack gap={1}>
|
|
140
|
+
<Tooltip content="Add the missing links, remove the stale ones" showArrow>
|
|
141
|
+
<Button size="xs" variant="ghost" loading={sync.isPending} onClick={() => sync.mutate()}><LuRefreshCw /> Relink</Button>
|
|
142
|
+
</Tooltip>
|
|
143
|
+
{writable && (confirm ? (
|
|
144
|
+
<>
|
|
145
|
+
<Button size="xs" colorPalette="red" loading={remove.isPending} onClick={() => remove.mutate()}>Remove the links</Button>
|
|
146
|
+
<Button size="xs" variant="ghost" onClick={() => setConfirm(false)}>Cancel</Button>
|
|
147
|
+
</>
|
|
148
|
+
) : (
|
|
149
|
+
<Tooltip content="Forget the project: its links leave the repository, the jobs stay" showArrow>
|
|
150
|
+
<Button size="xs" variant="ghost" colorPalette="red" onClick={() => setConfirm(true)}><LuTrash2 /></Button>
|
|
151
|
+
</Tooltip>
|
|
152
|
+
))}
|
|
153
|
+
</HStack>
|
|
154
|
+
}
|
|
155
|
+
>
|
|
156
|
+
<VStack align="stretch" gap={2} fontSize="sm" color="var(--color-text)">
|
|
157
|
+
<HStack gap={2} wrap="wrap">
|
|
158
|
+
{!project.exists && <Badge colorPalette="red">repository missing</Badge>}
|
|
159
|
+
{project.exists && !project.git && <Badge colorPalette="orange" variant="subtle">not a git repository</Badge>}
|
|
160
|
+
<Link to={jobsLink}>
|
|
161
|
+
<Badge variant="outline" cursor="pointer">{project.jobs} jobs</Badge>
|
|
162
|
+
</Link>
|
|
163
|
+
<Badge variant="subtle"><LuLink /> {project.links} links</Badge>
|
|
164
|
+
</HStack>
|
|
165
|
+
<Text color="var(--color-text-muted)">
|
|
166
|
+
bujang folder <Code fontSize="xs">{project.target}</Code>, jobs linked in <Code fontSize="xs">{project.jobs_dir}</Code>
|
|
167
|
+
</Text>
|
|
168
|
+
<ProjectConfig project={project} />
|
|
169
|
+
<ProjectArchive project={project} />
|
|
170
|
+
<Text color="var(--color-text-muted)">
|
|
171
|
+
Tag a job: <Code fontSize="xs">project="{project.name}"</Code> (MCP <Code fontSize="xs">submit_job</Code> /{' '}
|
|
172
|
+
<Code fontSize="xs">run_pipeline</Code>, the Submit page), or <Code fontSize="xs">export BUJANG_PROJECT={project.name}</Code> in the script.
|
|
173
|
+
</Text>
|
|
174
|
+
</VStack>
|
|
175
|
+
</LinkableCard>
|
|
176
|
+
);
|
|
177
|
+
};
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* Archive the jobs of a project: their folders move out of the local cache into the project's jobs/,
|
|
181
|
+
* where their links were (a preview first). Jobs not over or still on their cluster stay.
|
|
182
|
+
*/
|
|
183
|
+
export const ProjectArchive: React.FC<{ project: Project }> = ({ project }) => {
|
|
184
|
+
const queryClient = useQueryClient();
|
|
185
|
+
const [plan, setPlan] = useState<JanitorArchiveResult | null>(null);
|
|
186
|
+
const preview = useMutation({
|
|
187
|
+
mutationFn: () => janitorArchive({ organizer: 'projects', value: project.name, dry_run: true }),
|
|
188
|
+
onSuccess: setPlan,
|
|
189
|
+
onError: fail('Preview failed'),
|
|
190
|
+
});
|
|
191
|
+
const apply = useMutation({
|
|
192
|
+
mutationFn: () => janitorArchive({ organizer: 'projects', value: project.name, dry_run: false }),
|
|
193
|
+
onSuccess: (out) => {
|
|
194
|
+
setPlan(null);
|
|
195
|
+
toaster.create({
|
|
196
|
+
title: `Archived ${out.moved?.length ?? 0} job folders into ${project.jobs_dir}`,
|
|
197
|
+
description: out.skipped.length ? `${out.skipped.length} left where they are` : undefined,
|
|
198
|
+
type: 'success',
|
|
199
|
+
});
|
|
200
|
+
queryClient.invalidateQueries({ queryKey: PROJECTS_KEY });
|
|
201
|
+
},
|
|
202
|
+
onError: fail('Archive failed'),
|
|
203
|
+
});
|
|
204
|
+
const moving = plan?.would_move ?? [];
|
|
205
|
+
return (
|
|
206
|
+
<Box>
|
|
207
|
+
<Tooltip content="Move the job folders of the project into its repository, in place of their links" showArrow>
|
|
208
|
+
<Button size="xs" variant="ghost" loading={preview.isPending} onClick={() => preview.mutate()}>
|
|
209
|
+
<LuArchive /> Archive
|
|
210
|
+
</Button>
|
|
211
|
+
</Tooltip>
|
|
212
|
+
{plan && (
|
|
213
|
+
<VStack align="stretch" gap={2} mt={2} p={3} borderWidth="1px" borderRadius="md" borderColor="var(--color-border)" fontSize="sm">
|
|
214
|
+
{moving.length === 0
|
|
215
|
+
? <Text color="var(--color-text-muted)">Nothing to archive.</Text>
|
|
216
|
+
: (
|
|
217
|
+
<Text color="var(--color-text)">
|
|
218
|
+
{moving.length} job folders move into <Code fontSize="xs">{project.jobs_dir}</Code>: they leave the
|
|
219
|
+
local cache and live in the repository from then on (deleting them there deletes the jobs).
|
|
220
|
+
</Text>
|
|
221
|
+
)}
|
|
222
|
+
{plan.skipped.length > 0 && (
|
|
223
|
+
<Box maxH="120px" overflowY="auto" fontFamily="mono" fontSize="xs" color="var(--color-text-muted)">
|
|
224
|
+
{plan.skipped.map(s => <Box key={s.jr_job_id}>{s.jr_job_id}: {s.reason}</Box>)}
|
|
225
|
+
</Box>
|
|
226
|
+
)}
|
|
227
|
+
<HStack gap={2}>
|
|
228
|
+
{moving.length > 0 && (
|
|
229
|
+
<Button size="xs" colorPalette="blue" loading={apply.isPending} onClick={() => apply.mutate()}>
|
|
230
|
+
Move {moving.length} folders
|
|
231
|
+
</Button>
|
|
232
|
+
)}
|
|
233
|
+
<Button size="xs" variant="ghost" onClick={() => setPlan(null)}>Cancel</Button>
|
|
234
|
+
</HStack>
|
|
235
|
+
</VStack>
|
|
236
|
+
)}
|
|
237
|
+
</Box>
|
|
238
|
+
);
|
|
239
|
+
};
|
|
240
|
+
|
|
241
|
+
/** The scripts, pipelines and profiles of a project (files of its bujang folder) */
|
|
242
|
+
export const ProjectConfig: React.FC<{ project: Project }> = ({ project }) => {
|
|
243
|
+
const paths = useBujangPaths();
|
|
244
|
+
const groups: [string, string[], (name: string) => string | null][] = [
|
|
245
|
+
['scripts', project.templates ?? [], (name) => `${paths.submitJob()}?template=${encodeURIComponent(name)}&project=${encodeURIComponent(project.name)}`],
|
|
246
|
+
['pipelines', project.pipelines ?? [], (name) => paths.pipelineDetails(name)],
|
|
247
|
+
['profiles', project.profiles ?? [], () => null],
|
|
248
|
+
];
|
|
249
|
+
const prefix = `${project.name}:`;
|
|
250
|
+
const empty = groups.every(([, items]) => items.length === 0);
|
|
251
|
+
return (
|
|
252
|
+
<VStack align="stretch" gap={1} color="var(--color-text-muted)">
|
|
253
|
+
{groups.map(([label, items, to]) => items.length > 0 && (
|
|
254
|
+
<HStack key={label} gap={2} wrap="wrap" align="baseline">
|
|
255
|
+
<Text fontSize="xs" fontWeight="semibold" w="70px">{label}</Text>
|
|
256
|
+
{items.map((item) => {
|
|
257
|
+
const short = item.startsWith(prefix) ? item.slice(prefix.length) : item;
|
|
258
|
+
const link = to(item);
|
|
259
|
+
const badge = <Badge key={item} variant="subtle" cursor={link ? 'pointer' : undefined} title={item}>{short}</Badge>;
|
|
260
|
+
return link ? <Link key={item} to={link}>{badge}</Link> : badge;
|
|
261
|
+
})}
|
|
262
|
+
</HStack>
|
|
263
|
+
))}
|
|
264
|
+
{empty && (
|
|
265
|
+
<Text fontSize="xs">
|
|
266
|
+
No scripts, pipelines or profiles yet: add <Code fontSize="xs">scripts/<cluster>/*.sh</Code>,{' '}
|
|
267
|
+
<Code fontSize="xs">scripts/<cluster>/pipeline/*.json</Code>, <Code fontSize="xs">profiles.yaml</Code> or{' '}
|
|
268
|
+
<Code fontSize="xs">clusters.yaml</Code> to the bujang folder, they are named <Code fontSize="xs">{prefix}<name></Code>.
|
|
269
|
+
</Text>
|
|
270
|
+
)}
|
|
271
|
+
</VStack>
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
const AgentsCard: React.FC<{ argument: string }> = ({ argument }) => (
|
|
276
|
+
<LinkableCard id="agents" icon={<LuBot />} title="Coding agents" subtitle="how an agent working in a repository tags its jobs">
|
|
277
|
+
<VStack align="stretch" gap={2} fontSize="sm" color="var(--color-text-muted)">
|
|
278
|
+
<Text>
|
|
279
|
+
The MCP server tells the agents to call <Code fontSize="xs">list_projects</Code>, compare the paths with their
|
|
280
|
+
working directory, and pass <Code fontSize="xs">project=<name></Code> to <Code fontSize="xs">submit_job</Code> and{' '}
|
|
281
|
+
<Code fontSize="xs">run_pipeline</Code>. The README bujang puts in the repository folder says the same, for an agent that
|
|
282
|
+
reads the repository first.
|
|
283
|
+
</Text>
|
|
284
|
+
<Text>
|
|
285
|
+
A project keeps its own scripts, pipelines and profiles in its bujang folder, named{' '}
|
|
286
|
+
<Code fontSize="xs"><project>:<name></Code>: an agent edits them as files of the repository (or with{' '}
|
|
287
|
+
<Code fontSize="xs">save_template</Code> / <Code fontSize="xs">save_pipeline</Code> / <Code fontSize="xs">save_profile</Code>{' '}
|
|
288
|
+
and <Code fontSize="xs">project=</Code>). Using one tags the job with the project; in a project pipeline a bare name finds
|
|
289
|
+
the project's first.
|
|
290
|
+
</Text>
|
|
291
|
+
<Text>
|
|
292
|
+
A job script can tag itself with <Code fontSize="xs">export {argument}=<name></Code>. A pipeline run tagged for a
|
|
293
|
+
project brings its steps (they show inside the run folder). An unknown project name is refused at submission.
|
|
294
|
+
</Text>
|
|
295
|
+
</VStack>
|
|
296
|
+
</LinkableCard>
|
|
297
|
+
);
|
|
298
|
+
|
|
299
|
+
export const ProjectsView: React.FC = () => {
|
|
300
|
+
usePageTitle('Projects');
|
|
301
|
+
const queryClient = useQueryClient();
|
|
302
|
+
const { data, isLoading, error, refetch, isFetching } = useQuery<ProjectsInfo>({
|
|
303
|
+
queryKey: PROJECTS_KEY,
|
|
304
|
+
queryFn: getProjects,
|
|
305
|
+
});
|
|
306
|
+
useHashScroll(!!data);
|
|
307
|
+
const syncAll = useMutation({
|
|
308
|
+
mutationFn: () => syncProjects(),
|
|
309
|
+
onSuccess: (report) => {
|
|
310
|
+
const added = Object.values(report).reduce((n, r) => n + (r.added?.length ?? 0), 0);
|
|
311
|
+
const removed = Object.values(report).reduce((n, r) => n + (r.removed?.length ?? 0), 0);
|
|
312
|
+
toaster.create({ title: `${added} links added, ${removed} removed`, type: 'success' });
|
|
313
|
+
queryClient.invalidateQueries({ queryKey: PROJECTS_KEY });
|
|
314
|
+
},
|
|
315
|
+
onError: fail('Sync failed'),
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
return (
|
|
319
|
+
<Box p={6} maxW="1200px">
|
|
320
|
+
<HStack mb={2} gap={3} color="var(--color-text)" justify="space-between" wrap="wrap">
|
|
321
|
+
<HStack gap={3}>
|
|
322
|
+
<LuFolderGit2 size={24} />
|
|
323
|
+
<Heading size="lg">Projects</Heading>
|
|
324
|
+
</HStack>
|
|
325
|
+
<HStack gap={1}>
|
|
326
|
+
{!!data?.projects.length && (
|
|
327
|
+
<Button size="sm" variant="ghost" loading={syncAll.isPending} onClick={() => syncAll.mutate()}><LuLink /> Relink all</Button>
|
|
328
|
+
)}
|
|
329
|
+
<Button size="sm" variant="ghost" loading={isFetching} onClick={() => refetch()}><LuRefreshCw /> Refresh</Button>
|
|
330
|
+
</HStack>
|
|
331
|
+
</HStack>
|
|
332
|
+
<Text mb={6} color="var(--color-text-muted)">
|
|
333
|
+
Code repositories on this machine. The jobs submitted for a project show inside its repository as links to their
|
|
334
|
+
job folders (logs, <Code fontSize="xs">output/</Code>), so the results sit next to the code that made them.
|
|
335
|
+
</Text>
|
|
336
|
+
{isLoading && <Spinner />}
|
|
337
|
+
{error && <Text color="var(--color-status-failed)">{errorMessage(error)}</Text>}
|
|
338
|
+
{data && (
|
|
339
|
+
<VStack align="stretch" gap={6}>
|
|
340
|
+
{!data.enabled && (
|
|
341
|
+
<Box p={3} borderWidth="1px" borderRadius="md" borderColor="var(--color-status-failed)" color="var(--color-text)" fontSize="sm">
|
|
342
|
+
The <Code fontSize="xs">projects</Code> organizer is not loaded (the <Code fontSize="xs">organizers</Code> setting
|
|
343
|
+
leaves it out): jobs are tagged but nothing is linked into the repositories.
|
|
344
|
+
</Box>
|
|
345
|
+
)}
|
|
346
|
+
<RegisterCard info={data} />
|
|
347
|
+
{data.projects.length === 0
|
|
348
|
+
? <Text fontSize="sm" color="var(--color-text-muted)" fontStyle="italic">No project registered yet.</Text>
|
|
349
|
+
: data.projects.map(p => <ProjectCard key={p.name} project={p} writable={data.writable} />)}
|
|
350
|
+
<AgentsCard argument={data.argument} />
|
|
351
|
+
</VStack>
|
|
352
|
+
)}
|
|
353
|
+
</Box>
|
|
354
|
+
);
|
|
355
|
+
};
|
package/src/views/dataCharts.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Charts of the
|
|
1
|
+
/** Charts of the data files of a job: the chart builder, its Vega-Lite spec, and the chart itself. */
|
|
2
2
|
import React, { useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { Alert, Box, HStack, Input, Text } from '@chakra-ui/react';
|
|
4
4
|
import type { JobData, JobDataField, JobDataRole, OverviewBlock } from '../types';
|