remove dead fields from table, add correct fields
This commit is contained in:
1 parent
dffa49ae9d
commit
99ded83bd5
1 file changed
+18
-41
@@ -42,12 +42,15 @@ export const TableJobs = ({
|
|||||||
maxWidth: 220,
|
maxWidth: 220,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const isRunning = (row: QueueJobWithId) =>
|
||||||
|
row.lockedBy !== null && row.lockedUntil !== null && row.lockedUntil > Date.now();
|
||||||
|
|
||||||
const headers: Header<QueueJobWithId>[] = [
|
const headers: Header<QueueJobWithId>[] = [
|
||||||
{
|
{
|
||||||
id: "state",
|
id: "state",
|
||||||
content: t("pages.logs.table.headers.state"),
|
content: t("pages.logs.table.headers.state"),
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
if (row.lockedAt) {
|
if (isRunning(row)) {
|
||||||
return t("common.labels.running");
|
return t("common.labels.running");
|
||||||
}
|
}
|
||||||
if (row.monitorActive === true) {
|
if (row.monitorActive === true) {
|
||||||
@@ -72,18 +75,6 @@ export const TableJobs = ({
|
|||||||
</Typography>
|
</Typography>
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
{
|
|
||||||
id: "url",
|
|
||||||
content: t("common.table.headers.url"),
|
|
||||||
render: (row) => (
|
|
||||||
<Typography
|
|
||||||
title={row.monitorUrl ?? ""}
|
|
||||||
sx={cellSx}
|
|
||||||
>
|
|
||||||
{row.monitorUrl}
|
|
||||||
</Typography>
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
id: "type",
|
id: "type",
|
||||||
content: t("common.table.headers.type"),
|
content: t("common.table.headers.type"),
|
||||||
@@ -92,50 +83,36 @@ export const TableJobs = ({
|
|||||||
{
|
{
|
||||||
id: "interval",
|
id: "interval",
|
||||||
content: t("common.table.headers.interval"),
|
content: t("common.table.headers.interval"),
|
||||||
render: (row) => {
|
render: (row) => (
|
||||||
let interval;
|
<Typography sx={cellSx}>{prettyMilliseconds(row.monitorInterval ?? 0)}</Typography>
|
||||||
if (row.monitorId.toString().includes("geo")) {
|
),
|
||||||
interval = row.monitorGeoInterval ?? 0;
|
|
||||||
} else {
|
|
||||||
interval = row.repeat ?? 0;
|
|
||||||
}
|
|
||||||
return <Typography sx={cellSx}>{prettyMilliseconds(interval)}</Typography>;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "lastRun",
|
id: "lastFinishedAt",
|
||||||
content: t("pages.logs.table.headers.lastRunAt"),
|
content: t("pages.logs.table.headers.lastFinishedAt"),
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
const v = formatTimestamp(row.lastRunAt) ?? "-";
|
const lastFinishedAt = formatTimestamp(row.lastFinishedAt) ?? "-";
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
title={v}
|
title={lastFinishedAt}
|
||||||
sx={cellSx}
|
sx={cellSx}
|
||||||
>
|
>
|
||||||
{v}
|
{lastFinishedAt}
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: "lastRunTook",
|
id: "nextScheduledAt",
|
||||||
content: t("pages.logs.table.headers.lastRunTook"),
|
content: t("pages.logs.table.headers.nextScheduledAt"),
|
||||||
render: (row) => {
|
render: (row) => {
|
||||||
const value = row.lastRunTook ? prettyMilliseconds(row.lastRunTook) : "-";
|
const nextScheduledAt = formatTimestamp(row.nextScheduledAt) ?? "-";
|
||||||
return <Typography sx={cellSx}>{value}</Typography>;
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: "lockedAt",
|
|
||||||
content: t("pages.logs.table.headers.lockedAt"),
|
|
||||||
render: (row) => {
|
|
||||||
const v = formatTimestamp(row.lockedAt) ?? "-";
|
|
||||||
return (
|
return (
|
||||||
<Typography
|
<Typography
|
||||||
title={v}
|
title={nextScheduledAt}
|
||||||
sx={cellSx}
|
sx={cellSx}
|
||||||
>
|
>
|
||||||
{v}
|
{nextScheduledAt}
|
||||||
</Typography>
|
</Typography>
|
||||||
);
|
);
|
||||||
},
|
},
|
||||||
@@ -169,7 +146,7 @@ export const TableJobs = ({
|
|||||||
headers={headers}
|
headers={headers}
|
||||||
data={jobsWithId}
|
data={jobsWithId}
|
||||||
getRowSx={(row) => ({
|
getRowSx={(row) => ({
|
||||||
...(row.lockedAt && {
|
...(isRunning(row) && {
|
||||||
"& td": { backgroundColor: theme.palette.rowStatus.running },
|
"& td": { backgroundColor: theme.palette.rowStatus.running },
|
||||||
}),
|
}),
|
||||||
...(row.monitorActive === false && {
|
...(row.monitorActive === false && {
|
||||||
|
|||||||
Reference in new issue
Block a user