Skip to content

Commit c3f2122

Browse files
committed
Replace workflow Run display with a table
1 parent 439a035 commit c3f2122

File tree

4 files changed

+81
-198
lines changed

4 files changed

+81
-198
lines changed

src/renderer/components/Experiment/Workflows/WorkflowRunCanvas.tsx

Lines changed: 0 additions & 195 deletions
This file was deleted.
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
import React from 'react';
2+
import {
3+
Card,
4+
CardContent,
5+
Typography,
6+
Divider,
7+
List,
8+
ListItem,
9+
Box,
10+
Chip,
11+
CardCover,
12+
} from '@mui/joy';
13+
import { SquareCheckIcon } from 'lucide-react';
14+
15+
export default function WorkflowRunDisplay({ selectedWorkflowRun }) {
16+
if (!selectedWorkflowRun) {
17+
return <Typography>No workflow run selected</Typography>;
18+
}
19+
20+
const { run, jobs, workflow } = selectedWorkflowRun;
21+
22+
const formatDuration = (start, end) => {
23+
if (!start || !end) {
24+
return null;
25+
}
26+
27+
const startTime = new Date(start);
28+
const endTime = new Date(end);
29+
const duration = (endTime - startTime) / 1000; // duration in seconds
30+
const minutes = Math.floor(duration / 60);
31+
const seconds = duration % 60;
32+
return `${minutes}m ${seconds}s`;
33+
};
34+
35+
return (
36+
<Card variant="outlined" sx={{ padding: 2 }}>
37+
<CardContent>
38+
<Typography level="h4" sx={{ marginBottom: 1 }}>
39+
Workflow: {workflow.name}
40+
</Typography>
41+
<Typography level="body-md" sx={{ marginBottom: 2 }}>
42+
Status: <Chip>{run.status}</Chip>
43+
</Typography>
44+
<Typography level="body-md" sx={{ marginBottom: 2 }}>
45+
Created At: {run.created_at} | Updated At: {run.updated_at}
46+
</Typography>
47+
<Divider />
48+
<Typography level="h4" sx={{ marginTop: 2, marginBottom: 1 }}>
49+
Tasks:
50+
</Typography>
51+
<List>
52+
{jobs.map((job) => (
53+
<ListItem key={job.jobID}>
54+
<Box>
55+
<Typography
56+
level="title-md"
57+
startDecorator={<SquareCheckIcon />}
58+
>{`Task: ${job.taskName}`}</Typography>
59+
<Typography level="body-md" sx={{ color: 'text.secondary' }}>
60+
Status: <Chip>{job.status}</Chip>
61+
</Typography>
62+
<Typography level="body-md" sx={{ color: 'text.secondary' }}>
63+
{`Start: ${job?.jobStartTime} | End: ${job?.jobEndTime}`}
64+
</Typography>
65+
<Typography level="body-md" sx={{ color: 'text.secondary' }}>
66+
Duration: {formatDuration(job.jobStartTime, job.jobEndTime)}
67+
</Typography>
68+
<Divider sx={{ marginTop: 1 }} />
69+
</Box>
70+
</ListItem>
71+
))}
72+
</List>
73+
</CardContent>
74+
</Card>
75+
);
76+
}

src/renderer/components/Experiment/Workflows/WorkflowRuns.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import useSWR from 'swr';
1414
import TinyCircle from 'renderer/components/Shared/TinyCircle';
1515
import { useEffect, useState } from 'react';
1616
import * as chatAPI from '../../../lib/transformerlab-api-sdk';
17-
import WorkflowRunCanvas from './WorkflowRunCanvas';
17+
import WorkflowRunCanvas from './WorkflowRunDisplay';
1818

1919
const fetcher = (url: any) => fetch(url).then((res) => res.json());
2020

@@ -58,7 +58,9 @@ function ListOfWorkflowRuns({
5858
)}
5959
</ListItemDecorator>
6060
<ListItemContent>
61-
<Typography level="title-lg">{run?.id}</Typography>
61+
<Typography level="title-lg">
62+
{run?.workflow_name} - {run?.id}
63+
</Typography>
6264
</ListItemContent>
6365
</ListItemButton>
6466
</ListItem>

src/renderer/components/Experiment/Workflows/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function Workflows({ experimentInfo }) {
4242
>
4343
<WorkflowList experimentInfo={experimentInfo} />
4444
</TabPanel>
45-
<TabPanel value={1} sx={{ width: '100%' }}>
45+
<TabPanel value={1} sx={{ width: '100%', overflow: 'hidden' }}>
4646
<WorkflowRuns experimentInfo={experimentInfo} />
4747
</TabPanel>
4848
<TabPanel value={2} sx={{ width: '100%', overflow: 'hidden' }}>

0 commit comments

Comments
 (0)