Skip to content

Commit edab35c

Browse files
committed
update front end ui & rename job to parent_job for clarity
1 parent d7216df commit edab35c

File tree

2 files changed

+75
-20
lines changed

2 files changed

+75
-20
lines changed

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

Lines changed: 71 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,73 @@ import {
1313
CollectorInfo,
1414
ReleaseCommit,
1515
BenchmarkRequestCompleteStr,
16+
BenchmarkRequestInProgressStr,
1617
} from "./data";
1718
import Collector from "./collector.vue";
1819
20+
const loading = ref(true);
21+
/* @TODO; redo type */
22+
const dataNew: Ref<{
23+
queueLength: number;
24+
timeline: BenchmarkRequestWithWaterLine[];
25+
requestsMap: Dict<BenchmarkRequest>;
26+
jobMap: Dict<BenchmarkJob>;
27+
collectorWorkMap: Dict<CollectorInfo>;
28+
tagToJobs: Dict<number[]>;
29+
} | null> = ref(null);
30+
31+
type BenchmarkRequestWithWaterLine = BenchmarkRequest & {isWaterLine: boolean};
32+
33+
function requestIsInProgress(req: BenchmarkRequest, tagToJobs: Dict<number[]>) {
34+
switch (req.status.state) {
35+
case BenchmarkRequestCompleteStr:
36+
if (req.requestType.tag in tagToJobs) {
37+
return true;
38+
}
39+
return false;
40+
case BenchmarkRequestInProgressStr:
41+
return true;
42+
default:
43+
return false;
44+
}
45+
}
46+
47+
function getRequestRowClassName(
48+
req: BenchmarkRequestWithWaterLine,
49+
tagToJobs: Dict<number[]>
50+
) {
51+
const inProgress = requestIsInProgress(req, tagToJobs);
52+
if (inProgress && req.isWaterLine) {
53+
return "timeline-waterline";
54+
} else if (inProgress) {
55+
return "timeline-row-bold";
56+
}
57+
return "";
58+
}
59+
1960
async function loadStatusNew(loading: Ref<boolean>) {
2061
dataNew.value = await withLoading(loading, async () => {
2162
let d: StatusResponse = await getJson<StatusResponse>(STATUS_DATA_NEW_URL);
63+
let timeline: BenchmarkRequestWithWaterLine[] = [];
64+
// figure out where to draw the line.
65+
for (let i = 1; i < d.queueRequestTags.length; ++i) {
66+
let req = d.requestsMap[d.queueRequestTags[i - 1]];
67+
let nextReq = d.requestsMap[d.queueRequestTags[i]];
68+
let isWaterLine = false;
69+
if (
70+
requestIsInProgress(req, d.tagToJobs) &&
71+
!requestIsInProgress(nextReq, d.tagToJobs)
72+
) {
73+
isWaterLine = true;
74+
}
75+
timeline.push({
76+
...req,
77+
isWaterLine,
78+
});
79+
}
2280
return {
2381
queueLength: d.queueRequestTags.length,
24-
timeline: d.queueRequestTags.map((tag) => d.requestsMap[tag]),
82+
timeline,
2583
requestsMap: d.requestsMap,
2684
jobMap: d.jobMap,
2785
collectorWorkMap: d.collectorWorkMap,
@@ -30,17 +88,6 @@ async function loadStatusNew(loading: Ref<boolean>) {
3088
});
3189
}
3290
33-
const loading = ref(true);
34-
/* @TODO; redo type */
35-
const dataNew: Ref<{
36-
queueLength: number;
37-
timeline: BenchmarkRequest[];
38-
requestsMap: Dict<BenchmarkRequest>;
39-
jobMap: Dict<BenchmarkJob>;
40-
collectorWorkMap: Dict<CollectorInfo>;
41-
tagToJobs: Dict<number[]>;
42-
} | null> = ref(null);
43-
4491
function getCreatedAt(request: BenchmarkRequest): string {
4592
if (request.status.state == BenchmarkRequestCompleteStr) {
4693
return request.status.completedAt;
@@ -91,19 +138,18 @@ loadStatusNew(loading);
91138
</thead>
92139
<tbody>
93140
<template v-for="req in dataNew.timeline">
94-
<tr>
141+
<tr :class="getRequestRowClassName(req, dataNew.tagToJobs)">
95142
<td><PullRequestLink :requestType="req.requestType" /></td>
96143
<td>{{ req.requestType.type }}</td>
97144
<td>
98145
{{ req.requestType.tag }}
99146
</td>
100147
<td>
101-
{{ req.status.state }}
102148
{{
103149
req.status.state === BenchmarkRequestCompleteStr &&
104150
req.requestType.tag in dataNew.tagToJobs
105-
? "*"
106-
: ""
151+
? `${req.status.state}*`
152+
: `${req.status.state}`
107153
}}
108154
</td>
109155
<td v-html="getCreatedAt(req)"></td>
@@ -148,6 +194,15 @@ loadStatusNew(loading);
148194
padding-left: 8px;
149195
}
150196
197+
.timeline-waterline {
198+
border-bottom: 1px solid black;
199+
font-weight: bold;
200+
}
201+
202+
.timeline-row-bold {
203+
font-weight: bold;
204+
}
205+
151206
.timeline-wrapper {
152207
display: flex;
153208
justify-content: center;

site/src/request_handlers/status_page_new.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -175,13 +175,13 @@ pub async fn handle_status_page_new(ctxt: Arc<SiteCtxt>) -> ServerResult<status_
175175
benchmark_request_to_ui(&parent.0, vec![]).map_err(error_to_string)?,
176176
);
177177

178-
for job in parent.1.iter() {
178+
for parent_job in parent.1.iter() {
179179
if let Some(jobs) = tag_to_jobs.get_mut(&parent_tag) {
180-
jobs.push(job.id());
180+
jobs.push(parent_job.id());
181181
} else {
182-
tag_to_jobs.insert(parent_tag.clone(), vec![job.id()]);
182+
tag_to_jobs.insert(parent_tag.clone(), vec![parent_job.id()]);
183183
}
184-
jobs.push(job);
184+
jobs.push(parent_job);
185185
}
186186
}
187187
}

0 commit comments

Comments
 (0)