@@ -9,25 +9,32 @@ import {
9
9
StatusResponse ,
10
10
CollectorJobMap ,
11
11
BenchmarkRequestType ,
12
+ BenchmarkRequest ,
12
13
ReleaseCommit ,
13
14
createCollectorJobMap ,
15
+ createTimeline ,
16
+ BenchmarkRequestCompleteStr ,
14
17
} from " ./data" ;
15
18
import Collector from " ./collector.vue" ;
16
19
17
20
async function loadStatusNew(loading : Ref <boolean >) {
18
21
dataNew .value = await withLoading (loading , async () => {
19
22
let d: StatusResponse = await getJson <StatusResponse >(STATUS_DATA_NEW_URL );
20
23
return {
21
- ... d ,
24
+ queueLength: d . queue . length ,
22
25
collectorJobMap: createCollectorJobMap (d .collectorConfigs , d .inProgress ),
26
+ timeline: createTimeline (d .completed , d .queue ),
23
27
};
24
28
});
25
29
}
26
30
27
31
const loading = ref (true );
28
- const dataNew: Ref <
29
- (StatusResponse & {collectorJobMap: CollectorJobMap }) | null
30
- > = ref (null );
32
+ /* @TODO; redo type */
33
+ const dataNew: Ref <{
34
+ queueLength: number ;
35
+ collectorJobMap: CollectorJobMap ;
36
+ timeline: BenchmarkRequest [];
37
+ } | null > = ref (null );
31
38
32
39
function pullRequestUrlAsHtml(reqType : BenchmarkRequestType ): string {
33
40
if (reqType .type === ReleaseCommit ) {
@@ -36,86 +43,105 @@ function pullRequestUrlAsHtml(reqType: BenchmarkRequestType): string {
36
43
return ` <a href="https://github.com/rust-lang/rust/pull/${reqType .pr }">#${reqType .pr }</a> ` ;
37
44
}
38
45
46
+ function getCreatedAt(request : BenchmarkRequest ): string {
47
+ if (request .status .state == BenchmarkRequestCompleteStr ) {
48
+ return request .status .completedAt ;
49
+ }
50
+ return " " ;
51
+ }
52
+
53
+ function getDuration(request : BenchmarkRequest ): string {
54
+ if (request .status .state == BenchmarkRequestCompleteStr ) {
55
+ return formatDuration (request .status .duration );
56
+ }
57
+ return " " ;
58
+ }
59
+
39
60
loadStatusNew (loading );
40
61
</script >
41
62
42
63
<template >
43
- <div id =" app" class =" container" >
44
- <div v-if =" dataNew !== null" >
45
- <span >
46
- <div class =" timeline" >
47
- <h1 >Previous</h1 >
48
- <table >
49
- <thead >
50
- <tr >
51
- <th >Pr</th >
52
- <th >Kind</th >
53
- <th >Sha / Tag</th >
54
- <th >Status</th >
55
- <th >Completed At</th >
56
- <th >Duration</th >
57
- <th >Errors</th >
58
- </tr >
59
- </thead >
60
- <tbody >
61
- <template v-for =" req in dataNew .completed " >
62
- <tr >
63
- <td v-html =" pullRequestUrlAsHtml(req.requestType)" ></td >
64
- <td >{{ req.requestType.type }}</td >
65
- <td >{{ req.requestType.tag }}</td >
66
- <td >{{ req.status.state }}</td >
67
- <td >{{ req.status.completedAt }}</td >
68
- <td v-html =" formatDuration(req.status.duration)" ></td >
69
- <td >
70
- <pre >{{ req.errors.join("\n") }}</pre >
71
- </td >
72
- </tr >
73
- </template >
74
- </tbody >
75
- </table >
64
+ <div v-if =" dataNew !== null" >
65
+ <div class =" status-page-wrapper" >
66
+ <div class =" timeline-wrapper" >
67
+ <h1 >Timeline</h1 >
68
+ <div style =" margin-bottom : 10px " >
69
+ Queue length: {{ dataNew.queueLength }}
76
70
</div >
77
- <div class =" timeline" >
78
- <h1 >Queue</h1 >
79
- <table >
80
- <thead >
71
+ <table >
72
+ <thead >
73
+ <tr >
74
+ <th >Pr</th >
75
+ <th >Kind</th >
76
+ <th >Sha / Tag</th >
77
+ <th >Status</th >
78
+ <th >Completed At</th >
79
+ <th >Duration</th >
80
+ <th >Errors</th >
81
+ </tr >
82
+ </thead >
83
+ <tbody >
84
+ <template v-for =" req in dataNew .timeline " >
81
85
<tr >
82
- <th >Pr</th >
83
- <th >Kind</th >
84
- <th >Sha / Tag</th >
85
- <th >Status</th >
86
+ <td v-html =" pullRequestUrlAsHtml(req.requestType)" ></td >
87
+ <td >{{ req.requestType.type }}</td >
88
+ <td >{{ req.requestType.tag }}</td >
89
+ <td >{{ req.status.state }}</td >
90
+ <td v-html =" getCreatedAt(req)" ></td >
91
+ <td v-html =" getDuration(req)" ></td >
92
+ <td >
93
+ <pre >{{ req.errors.join("\n") }}</pre >
94
+ </td >
86
95
</tr >
87
- </thead >
88
- <tbody >
89
- <template v-for =" req in dataNew .queue " >
90
- <tr >
91
- <td v-html =" pullRequestUrlAsHtml(req.requestType)" ></td >
92
- <td >{{ req.requestType.type }}</td >
93
- <td >{{ req.requestType.tag }}</td >
94
- <td >{{ req.status.state }}</td >
95
- </tr >
96
- </template >
97
- </tbody >
98
- </table >
99
- </div >
100
- </span >
101
- <h1 >Collectors</h1 >
102
- <div class =" grid" >
103
- <div :key =" cc[0]" v-for =" cc in Object.entries(dataNew.collectorJobMap)" >
104
- <Collector :collector =" cc[1]" />
96
+ </template >
97
+ </tbody >
98
+ </table >
99
+ </div >
100
+ <div class =" collector-wrapper" >
101
+ <h1 >Collectors</h1 >
102
+ <div class =" collectors-grid" >
103
+ <div
104
+ :key =" cc[0]"
105
+ v-for =" cc in Object.entries(dataNew.collectorJobMap)"
106
+ >
107
+ <Collector :collector =" cc[1]" />
108
+ </div >
105
109
</div >
106
110
</div >
107
111
</div >
108
112
</div >
109
113
</template >
110
114
111
115
<style scoped lang="scss">
112
- .timeline {
113
- max-width : 100% ;
114
- width : fit-content ;
116
+ .status-page-wrapper {
117
+ display : flex ;
118
+ @media screen and (max-width : 1450px ) {
119
+ flex-direction : column ;
120
+ }
121
+ }
122
+
123
+ .collector-wrapper {
124
+ width : 100% ;
125
+ display : flex ;
126
+ justify-content : center ;
127
+ align-items : center ;
128
+ flex-direction : column ;
129
+ padding-left : 8px ;
130
+ }
131
+
132
+ .timeline-wrapper {
133
+ display : flex ;
134
+ justify-content : center ;
135
+ align-items : center ;
136
+ height : fit-content ;
137
+ flex-direction : column ;
138
+ width : 100% ;
139
+ padding-right : 8px ;
115
140
116
141
table {
117
142
border-collapse : collapse ;
118
143
font-size : 1.1em ;
144
+ width : 100% ;
119
145
120
146
th ,
121
147
td {
@@ -195,7 +221,8 @@ loadStatusNew(loading);
195
221
word-break : break-word ;
196
222
}
197
223
198
- .grid {
224
+ .collectors-grid {
225
+ width : 100% ;
199
226
display : grid ;
200
227
grid-template-columns : repeat (auto-fill , minmax (500px , 1fr ));
201
228
gap : 20px ;
0 commit comments