UI fixes for job queue table

This commit is contained in:
Alex Holliday committed 2026-05-04 11:53:12 -07:00
1 parent f648ab1b24
commit 22230b8a08
4 files changed
+49 -8

No files matched your search

+1 -1
View File
@@ -19,7 +19,7 @@ export const TabQueue = () => {
isLoading, isLoading,
// error, // error,
refetch, refetch,
} = useGet<QueueData>("/queue/all-metrics", {}, { refreshInterval: 5000 }); } = useGet<QueueData>("/queue/all-metrics", {}, { refreshInterval: 1000 });
const { post, loading: isFlushing } = usePost(); const { post, loading: isFlushing } = usePost();
+41 -6
View File
@@ -30,6 +30,22 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
}; };
const headers: Header<QueueJobWithId>[] = [ const headers: Header<QueueJobWithId>[] = [
{
id: "state",
content: t("pages.logs.table.headers.state"),
render: (row) => {
if (row.lockedAt) {
return t("common.labels.running");
}
if (row.monitorActive === true) {
return t("common.labels.active");
}
if (row.monitorActive === false) {
return t("common.labels.paused");
}
return t("common.labels.idle");
},
},
{ {
id: "id", id: "id",
content: t("common.table.headers.monitorId"), content: t("common.table.headers.monitorId"),
@@ -47,7 +63,10 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
id: "url", id: "url",
content: t("common.table.headers.url"), content: t("common.table.headers.url"),
render: (row) => ( render: (row) => (
<Typography title={row.monitorUrl ?? ""} sx={cellSx}> <Typography
title={row.monitorUrl ?? ""}
sx={cellSx}
>
{row.monitorUrl} {row.monitorUrl}
</Typography> </Typography>
), ),
@@ -60,9 +79,15 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
{ {
id: "interval", id: "interval",
content: t("common.table.headers.interval"), content: t("common.table.headers.interval"),
render: (row) => ( render: (row) => {
<Typography sx={cellSx}>{prettyMilliseconds(row.monitorInterval ?? 0)}</Typography> let interval;
), 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: "lastRun",
@@ -70,7 +95,10 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
render: (row) => { render: (row) => {
const v = formatTimestamp(row.lastRunAt) ?? "-"; const v = formatTimestamp(row.lastRunAt) ?? "-";
return ( return (
<Typography title={v} sx={cellSx}> <Typography
title={v}
sx={cellSx}
>
{v} {v}
</Typography> </Typography>
); );
@@ -90,7 +118,10 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
render: (row) => { render: (row) => {
const v = formatTimestamp(row.lockedAt) ?? "-"; const v = formatTimestamp(row.lockedAt) ?? "-";
return ( return (
<Typography title={v} sx={cellSx}> <Typography
title={v}
sx={cellSx}
>
{v} {v}
</Typography> </Typography>
); );
@@ -100,6 +131,7 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
const isDark = theme.palette.mode === "dark"; const isDark = theme.palette.mode === "dark";
const runningBg = isDark ? "rgba(19, 113, 91, 0.18)" : "#ECF7F2"; const runningBg = isDark ? "rgba(19, 113, 91, 0.18)" : "#ECF7F2";
const pausedBg = isDark ? "rgba(255, 165, 0, 0.18)" : "#FFF4E5";
return ( return (
<Table <Table
@@ -109,6 +141,9 @@ export const TableJobs = ({ jobs }: TableJobsProps) => {
...(row.lockedAt && { ...(row.lockedAt && {
"& td": { backgroundColor: runningBg }, "& td": { backgroundColor: runningBg },
}), }),
...(row.monitorActive === false && {
"& td": { backgroundColor: pausedBg },
}),
})} })}
/> />
); );
+3
View File
@@ -23,6 +23,8 @@ export interface QueueJobSummary {
monitorUrl: string | null; monitorUrl: string | null;
monitorType: MonitorType | null; monitorType: MonitorType | null;
monitorInterval: number | null; monitorInterval: number | null;
monitorGeoInterval: number | null;
monitorActive: boolean | null;
active: boolean; active: boolean;
lockedAt: number | null; lockedAt: number | null;
runCount: number; runCount: number;
@@ -32,6 +34,7 @@ export interface QueueJobSummary {
lastFinishedAt: number | null; lastFinishedAt: number | null;
lastRunTook: number | null; lastRunTook: number | null;
lastFailedAt: number | null; lastFailedAt: number | null;
repeat: number | null;
} }
export interface QueueData { export interface QueueData {
+4 -1
View File
@@ -70,7 +70,9 @@
}, },
"labels": { "labels": {
"active": "Active", "active": "Active",
"paused": "paused", "running": "Running",
"paused": "Paused",
"idle": "Idle",
"na": "N/A", "na": "N/A",
"resolved": "Resolved", "resolved": "Resolved",
"responseTime": "Response time" "responseTime": "Response time"
@@ -887,6 +889,7 @@
}, },
"table": { "table": {
"headers": { "headers": {
"state": "State",
"timestamp": "Timestamp", "timestamp": "Timestamp",
"level": "Level", "level": "Level",
"service": "Service", "service": "Service",