@@ -13,15 +13,73 @@ import {
13
13
CollectorInfo ,
14
14
ReleaseCommit ,
15
15
BenchmarkRequestCompleteStr ,
16
+ BenchmarkRequestInProgressStr ,
16
17
} from " ./data" ;
17
18
import Collector from " ./collector.vue" ;
18
19
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
+
19
60
async function loadStatusNew(loading : Ref <boolean >) {
20
61
dataNew .value = await withLoading (loading , async () => {
21
62
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
+ }
22
80
return {
23
81
queueLength: d .queueRequestTags .length ,
24
- timeline: d . queueRequestTags . map (( tag ) => d . requestsMap [ tag ]) ,
82
+ timeline ,
25
83
requestsMap: d .requestsMap ,
26
84
jobMap: d .jobMap ,
27
85
collectorWorkMap: d .collectorWorkMap ,
@@ -30,17 +88,6 @@ async function loadStatusNew(loading: Ref<boolean>) {
30
88
});
31
89
}
32
90
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
-
44
91
function getCreatedAt(request : BenchmarkRequest ): string {
45
92
if (request .status .state == BenchmarkRequestCompleteStr ) {
46
93
return request .status .completedAt ;
@@ -91,19 +138,18 @@ loadStatusNew(loading);
91
138
</thead >
92
139
<tbody >
93
140
<template v-for =" req in dataNew .timeline " >
94
- <tr >
141
+ <tr :class = " getRequestRowClassName(req, dataNew.tagToJobs) " >
95
142
<td ><PullRequestLink :requestType =" req.requestType" /></td >
96
143
<td >{{ req.requestType.type }}</td >
97
144
<td >
98
145
{{ req.requestType.tag }}
99
146
</td >
100
147
<td >
101
- {{ req.status.state }}
102
148
{{
103
149
req.status.state === BenchmarkRequestCompleteStr &&
104
150
req.requestType.tag in dataNew.tagToJobs
105
- ? "*"
106
- : ""
151
+ ? `${req.status.state}*`
152
+ : `${req.status.state}`
107
153
}}
108
154
</td >
109
155
<td v-html =" getCreatedAt(req)" ></td >
@@ -148,6 +194,15 @@ loadStatusNew(loading);
148
194
padding-left : 8px ;
149
195
}
150
196
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
+
151
206
.timeline-wrapper {
152
207
display : flex ;
153
208
justify-content : center ;
0 commit comments