diff --git a/client/src/Pages/Logs/components/TableJobs.tsx b/client/src/Pages/Logs/components/TableJobs.tsx index 241b6f016..26fe62bb3 100644 --- a/client/src/Pages/Logs/components/TableJobs.tsx +++ b/client/src/Pages/Logs/components/TableJobs.tsx @@ -42,12 +42,15 @@ export const TableJobs = ({ maxWidth: 220, }; + const isRunning = (row: QueueJobWithId) => + row.lockedBy !== null && row.lockedUntil !== null && row.lockedUntil > Date.now(); + const headers: Header[] = [ { id: "state", content: t("pages.logs.table.headers.state"), render: (row) => { - if (row.lockedAt) { + if (isRunning(row)) { return t("common.labels.running"); } if (row.monitorActive === true) { @@ -72,18 +75,6 @@ export const TableJobs = ({ ), }, - { - id: "url", - content: t("common.table.headers.url"), - render: (row) => ( - - {row.monitorUrl} - - ), - }, { id: "type", content: t("common.table.headers.type"), @@ -92,50 +83,36 @@ export const TableJobs = ({ { id: "interval", content: t("common.table.headers.interval"), - render: (row) => { - let interval; - if (row.monitorId.toString().includes("geo")) { - interval = row.monitorGeoInterval ?? 0; - } else { - interval = row.repeat ?? 0; - } - return {prettyMilliseconds(interval)}; - }, + render: (row) => ( + {prettyMilliseconds(row.monitorInterval ?? 0)} + ), }, { - id: "lastRun", - content: t("pages.logs.table.headers.lastRunAt"), + id: "lastFinishedAt", + content: t("pages.logs.table.headers.lastFinishedAt"), render: (row) => { - const v = formatTimestamp(row.lastRunAt) ?? "-"; + const lastFinishedAt = formatTimestamp(row.lastFinishedAt) ?? "-"; return ( - {v} + {lastFinishedAt} ); }, }, { - id: "lastRunTook", - content: t("pages.logs.table.headers.lastRunTook"), + id: "nextScheduledAt", + content: t("pages.logs.table.headers.nextScheduledAt"), render: (row) => { - const value = row.lastRunTook ? prettyMilliseconds(row.lastRunTook) : "-"; - return {value}; - }, - }, - { - id: "lockedAt", - content: t("pages.logs.table.headers.lockedAt"), - render: (row) => { - const v = formatTimestamp(row.lockedAt) ?? "-"; + const nextScheduledAt = formatTimestamp(row.nextScheduledAt) ?? "-"; return ( - {v} + {nextScheduledAt} ); }, @@ -169,7 +146,7 @@ export const TableJobs = ({ headers={headers} data={jobsWithId} getRowSx={(row) => ({ - ...(row.lockedAt && { + ...(isRunning(row) && { "& td": { backgroundColor: theme.palette.rowStatus.running }, }), ...(row.monitorActive === false && {