Skip to content

Commit 37d25e4

Browse files
committed
Bring the look of the new status page table closer to the old one
1 parent 40db8d1 commit 37d25e4

File tree

1 file changed

+65
-72
lines changed
  • site/frontend/src/pages/status_new

1 file changed

+65
-72
lines changed

site/frontend/src/pages/status_new/page.vue

Lines changed: 65 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,32 @@ import {h, ref, Ref} from "vue";
44
import {getJson} from "../../utils/requests";
55
import {STATUS_DATA_NEW_URL} from "../../urls";
66
import {withLoading} from "../../utils/loading";
7-
import {
8-
formatSecondsAsDuration,
9-
formatISODate,
10-
shortenTag,
11-
} from "../../utils/formatting";
7+
import {formatISODate, formatSecondsAsDuration} from "../../utils/formatting";
128
import {useExpandedStore} from "../../utils/expansion";
139
import {
1410
BenchmarkRequest,
1511
BenchmarkRequestStatus,
1612
CollectorConfig,
17-
StatusResponse,
1813
isJobComplete,
14+
StatusResponse,
1915
} from "./data";
2016
import Collector from "./collector.vue";
2117
2218
const loading = ref(true);
2319
2420
const data: Ref<{
25-
timeline: BenchmarkRequestWithWaterLine[];
21+
timeline: BenchmarkRequestRow[];
2622
queueLength: number;
2723
collectors: CollectorConfig[];
2824
} | null> = ref(null);
2925
30-
type BenchmarkRequestWithWaterLine = BenchmarkRequest & {
26+
type BenchmarkRequestRow = BenchmarkRequest & {
3127
isLastInProgress: boolean;
3228
hasPendingJobs: boolean;
3329
};
3430
35-
function getRequestRowClassName(req: BenchmarkRequestWithWaterLine) {
36-
const inProgress = req.status === "InProgress";
37-
if (inProgress && req.isLastInProgress) {
38-
return "timeline-waterline";
39-
} else if (inProgress) {
31+
function getRequestRowClassName(req: BenchmarkRequestRow) {
32+
if (req.status === "InProgress") {
4033
return "timeline-row-bold";
4134
}
4235
return "";
@@ -47,7 +40,7 @@ async function loadStatusData(loading: Ref<boolean>) {
4740
let resp: StatusResponse = await getJson<StatusResponse>(
4841
STATUS_DATA_NEW_URL
4942
);
50-
let timeline: BenchmarkRequestWithWaterLine[] = [];
43+
let timeline: BenchmarkRequestRow[] = [];
5144
5245
let queueLength = 0;
5346
@@ -135,28 +128,43 @@ function CommitSha({request}: {request: BenchmarkRequest}): string {
135128
);
136129
}
137130
138-
function getJobCompletion(
139-
req: BenchmarkRequest,
140-
collectors: CollectorConfig[]
141-
) {
131+
function RequestProgress({
132+
request,
133+
collectors,
134+
}: {
135+
request: BenchmarkRequest;
136+
collectors: CollectorConfig[];
137+
}): string {
142138
const jobs = collectors
143139
.flatMap((c) => c.jobs)
144-
.filter((j) => j.requestTag === req.tag);
145-
if (jobs.length === 0) {
146-
return "";
147-
}
140+
.filter((j) => j.requestTag === request.tag);
148141
const completed = jobs.reduce((acc, job) => {
149142
if (isJobComplete(job)) {
150143
acc += 1;
151144
}
152145
return acc;
153146
}, 0);
154-
return `${completed} / ${jobs.length}`;
147+
148+
if (request.status === "Completed") {
149+
return "";
150+
} else if (request.status === "Queued") {
151+
return "";
152+
} else {
153+
return (
154+
<progress
155+
title={`${completed} out of ${jobs.length} job(s) completed`}
156+
max={jobs.length}
157+
value={completed}
158+
></progress>
159+
);
160+
}
155161
}
156162
157163
const {toggleExpanded: toggleExpandedErrors, isExpanded: hasExpandedErrors} =
158164
useExpandedStore();
159165
166+
const tableWidth = 8;
167+
160168
loadStatusData(loading);
161169
</script>
162170

@@ -175,14 +183,17 @@ loadStatusData(loading);
175183
<th>Kind</th>
176184
<th>Tag</th>
177185
<th>Status</th>
178-
<th>Jobs Complete</th>
186+
<th>Progress</th>
179187
<th>Completed At</th>
180188
<th>Duration</th>
181189
<th>Errors</th>
182190
</tr>
183191
</thead>
184192
<tbody>
185193
<template v-for="req in data.timeline">
194+
<tr v-if="req.isLastInProgress">
195+
<td :colspan="tableWidth"><hr /></td>
196+
</tr>
186197
<tr :class="getRequestRowClassName(req)">
187198
<td><PullRequestLink :request="req" /></td>
188199
<td>{{ req.requestType }}</td>
@@ -194,7 +205,10 @@ loadStatusData(loading);
194205
}}
195206
</td>
196207
<td>
197-
{{ getJobCompletion(req, data.collectors) }}
208+
<RequestProgress
209+
:request="req"
210+
:collectors="data.collectors"
211+
/>
198212
</td>
199213
<td>
200214
{{ formatISODate(req.completedAt) }}
@@ -204,27 +218,31 @@ loadStatusData(loading);
204218
{{ getDuration(req) }}
205219
</td>
206220

207-
<td v-if="hasErrors(req.errors)">
208-
<button @click="toggleExpandedErrors(req.tag)">
209-
{{ hasExpandedErrors(req.tag) ? "Hide" : "Show" }}
210-
{{ getErrorsLength(req.errors) }}
211-
</button>
221+
<td>
222+
<template v-if="hasErrors(req.errors)">
223+
<button @click="toggleExpandedErrors(req.tag)">
224+
{{ getErrorsLength(req.errors) }}
225+
{{ hasExpandedErrors(req.tag) ? "(hide)" : "(show)" }}
226+
</button>
227+
</template>
212228
</td>
213-
<td v-else></td>
214229
</tr>
215230

216231
<tr v-if="hasExpandedErrors(req.tag)">
217-
<td colspan="7" style="padding: 10px 0">
218-
<div v-for="benchmark in Object.entries(req.errors)">
232+
<td :colspan="tableWidth" style="padding: 10px 0">
233+
<div v-for="[context, error] in Object.entries(req.errors)">
219234
<div>
220-
<details open>
221-
<summary>{{ benchmark[0] }}</summary>
222-
<pre class="error">{{ benchmark[1] }}</pre>
235+
<details>
236+
<summary>{{ context }}</summary>
237+
<pre class="error">{{ error }}</pre>
223238
</details>
224239
</div>
225240
</div>
226241
</td>
227242
</tr>
243+
<tr v-if="req.isLastInProgress">
244+
<td :colspan="tableWidth"><hr /></td>
245+
</tr>
228246
</template>
229247
</tbody>
230248
</table>
@@ -249,74 +267,49 @@ loadStatusData(loading);
249267
}
250268
251269
.collector-wrapper {
252-
width: 100%;
253270
display: flex;
254271
align-items: center;
255272
flex-direction: column;
256273
padding-left: 8px;
257274
}
258275
259-
.timeline-waterline {
260-
border-bottom: 1px solid black;
261-
font-weight: bold;
262-
}
263-
264276
.timeline-row-bold {
265277
font-weight: bold;
266278
}
267279
268280
.timeline-wrapper {
269281
display: flex;
270-
justify-content: center;
271-
align-items: center;
272-
height: fit-content;
273282
flex-direction: column;
274-
width: 100%;
275-
padding-right: 8px;
283+
align-items: center;
284+
margin-bottom: 50px;
276285
277286
table {
278287
border-collapse: collapse;
279288
font-size: 1.1em;
280-
width: 100%;
289+
290+
@media screen and (max-width: 850px) {
291+
align-self: start;
292+
}
281293
282294
th,
283295
td {
284-
padding: 0.2em;
296+
text-align: center;
285297
}
286298
287299
th {
288-
text-align: center;
300+
padding: 1em 0.5em;
289301
}
290-
td {
291-
text-align: left;
292-
padding: 0 0.5em;
293302
294-
&.centered {
295-
text-align: center;
296-
}
297-
&.right-align {
298-
text-align: right;
299-
}
303+
td {
304+
padding: 1px 0.5em;
300305
}
306+
301307
tr.active {
302308
font-weight: bold;
303309
}
304310
}
305-
306-
@media screen and (min-width: 1440px) {
307-
width: 100%;
308-
}
309311
}
310312
311-
.wrapper {
312-
display: grid;
313-
column-gap: 100px;
314-
grid-template-columns: 1fr;
315-
316-
@media screen and (min-width: 1440px) {
317-
grid-template-columns: 4fr 6fr;
318-
}
319-
}
320313
.current {
321314
max-width: 100%;
322315
width: fit-content;

0 commit comments

Comments
 (0)