Skip to content

Commit 9cd19f8

Browse files
committed
Updates the chart on the Task landing page to match Agents landing page
1 parent 8fb1ba7 commit 9cd19f8

2 files changed

Lines changed: 172 additions & 195 deletions

File tree

apps/webapp/app/presenters/v3/TaskDetailPresenter.server.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,21 +171,21 @@ export class TaskDetailPresenter {
171171
}
172172

173173
const bucketMap = new Map<number, Record<string, number>>();
174-
const usedGroups = new Set<GroupLabel>();
175174
for (const row of rows) {
176175
const group = groupForStatus(row.status) ?? "RUNNING";
177-
usedGroups.add(group);
178176
const ts = row.bucket * 1000;
179177
const existing = bucketMap.get(ts) ?? {};
180178
existing[group] = (existing[group] ?? 0) + row.val;
181179
bucketMap.set(ts, existing);
182180
}
183181

182+
// Always emit every status group so the chart legend is stable across
183+
// time ranges (even when a group has no runs in the current window).
184184
const bucketMs = bucketSeconds * 1000;
185185
const start = Math.floor(from.getTime() / bucketMs) * bucketMs;
186186
const end = Math.ceil(to.getTime() / bucketMs) * bucketMs;
187187
const points: TaskActivityPoint[] = [];
188-
const orderedStatuses = GROUP_LABEL.filter((g) => usedGroups.has(g));
188+
const orderedStatuses = [...GROUP_LABEL];
189189
for (let ts = start; ts < end; ts += bucketMs) {
190190
const existing = bucketMap.get(ts) ?? {};
191191
const point: TaskActivityPoint = { bucket: ts };

0 commit comments

Comments
 (0)