Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Job{,List}: Link to job archive directories #37

Merged
merged 3 commits into from
Aug 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/components/JobList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { formatDate, formatDuration } from "../../lib/utils";
import DataGrid from "../../components/DataGrid";
import IconLink from "../../components/IconLink";
import type { Run, NodeJobs } from "../../lib/paddles.d";
import { dirName } from "../../lib/utils";

import sentryIcon from "./assets/sentry.svg";

Expand Down Expand Up @@ -50,7 +51,7 @@ const columns: GridColDef[] = [
width: 75,
valueGetter: (params: GridValueGetterParams) => {
return {
log: params.row.log_href,
log: dirName(params.row.log_href),
sentry: params.row.sentry_event,
};
},
Expand Down
8 changes: 7 additions & 1 deletion src/lib/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,10 @@ function colorTint(hex, delta) {
return "#" + convert.hsl.hex(hsl);
}

export { formatDate, getDuration, formatDuration, colorTint };
function dirName(path) {
const array = path.split("/");
array.splice(-1, 1, "");
return array.join("/");
}

export { formatDate, getDuration, formatDuration, colorTint, dirName };
21 changes: 14 additions & 7 deletions src/pages/Job/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import ScheduleIcon from "@mui/icons-material/Schedule";
import PlayCircleOutlineIcon from "@mui/icons-material/PlayCircleOutline";
import CheckCircleOutlineIcon from "@mui/icons-material/CheckCircleOutline";
import HighlightOffIcon from "@mui/icons-material/HighlightOff";
import FolderIcon from '@mui/icons-material/Folder';
import formatDuration from "date-fns/formatDuration";
import { isValid, parse } from "date-fns";
import Editor from "react-simple-code-editor";
Expand All @@ -21,7 +22,7 @@ import YAML from "json-to-pretty-yaml";

import Link from "../../components/Link";
import { useJob } from "../../lib/paddles";
import { getDuration } from "../../lib/utils";
import { getDuration, dirName } from "../../lib/utils";

function StatusIcon({ status }) {
const theme = useTheme();
Expand Down Expand Up @@ -76,6 +77,18 @@ function JobHeader({ query }) {
if (!query.isSuccess) return null;
return (
<>
<Grid item xs={12} style={{ display: "flex" }}>
<StatusIcon status={query.data?.status} />
<Typography variant="h5">
<Link to={`/runs/${query.data.name}`}>{query.data.name}</Link>/{query.data.job_id}
</Typography>
</Grid>
<Grid item xs={12} style={{ display: "flex" }}>
<FolderIcon sx={{ alignSelf: "center", margin: "5px" }} />
<Typography variant="h5">
<Link to={dirName(query.data.log_href)}>Log Archive</Link>
</Typography>
</Grid>
<Grid item xs={4}>
<Typography>Status: {query.data.status}</Typography>
<Typography>
Expand Down Expand Up @@ -167,12 +180,6 @@ export default function Job() {
<Helmet>
<title>{`Job ${job_id} - Pulpito`}</title>
</Helmet>
<Grid item xs={12} style={{ display: "flex" }}>
<StatusIcon status={query.data?.status} />
<Typography variant="h5">
<Link to={`/runs/${name}`}>{name}</Link>/{job_id}
</Typography>
</Grid>
<JobHeader query={query} />
<Grid item xs={12}>
<Accordion
Expand Down