11<script setup lang="tsx">
22import {h , ref , Ref } from " vue" ;
33import {parseISO , differenceInHours } from " date-fns" ;
4- import {formatISODate , shortenTag } from " ../../utils/formatting" ;
5- import {CollectorConfig , BenchmarkJobStatus , isJobComplete } from " ./data" ;
4+ import {formatISODate } from " ../../utils/formatting" ;
5+ import {
6+ CollectorConfig ,
7+ BenchmarkJobStatus ,
8+ isJobComplete ,
9+ BenchmarkJob ,
10+ } from " ./data" ;
11+ import CommitSha from " ./commit-sha.vue" ;
612
713const props = defineProps <{
814 collector: CollectorConfig ;
@@ -80,6 +86,21 @@ function ActiveStatus({collector}: {collector: CollectorConfig}) {
8086function toggleShowJobs() {
8187 showJobs .value = ! showJobs .value ;
8288}
89+
90+ function formatBackend(job : BenchmarkJob ): string {
91+ if (job .kind === " compiletime" ) {
92+ return job .backend ;
93+ } else {
94+ return " " ;
95+ }
96+ }
97+ function formatProfile(job : BenchmarkJob ): string {
98+ if (job .kind === " compiletime" ) {
99+ return job .profile ;
100+ } else {
101+ return " " ;
102+ }
103+ }
83104 </script >
84105
85106<template >
@@ -120,7 +141,10 @@ function toggleShowJobs() {
120141 </span >
121142 <span >{{ formatISODate(collector.dateAdded) }}</span >
122143 </div >
123- <button @click =" toggleShowJobs" >show jobs</button >
144+ <button @click =" toggleShowJobs" class =" show-jobs" >
145+ <template v-if =" showJobs " >Hide jobs</template >
146+ <template v-else >Show jobs</template >
147+ </button >
124148 </div >
125149
126150 <div v-if =" showJobs" class =" table-collector-wrapper" >
@@ -130,60 +154,58 @@ function toggleShowJobs() {
130154 <div class =" table-collector-status-filter-btn-wrapper" >
131155 <template v-for =" filter in FILTERS " >
132156 <button
133- class =" table-collector-status-filter-btn"
157+ :class =" {
158+ active: ACTIVE_FILTERS[filter],
159+ }"
134160 @click =" filterJobByStatus(filter)"
135161 >
136162 {{ formatJobStatus(filter) }}
137- <input
138- type =" checkbox"
139- value =" filter"
140- :checked =" ACTIVE_FILTERS[filter]"
141- />
142163 </button >
143164 </template >
144165 </div >
145166 </div >
146167 </div >
147168 <table class =" table-collector" style =" border-collapse : collapse " >
148- <caption >
149- current benchmark jobs
150- </caption >
151169 <thead >
152170 <tr class =" table-header-row" >
153- <th class =" table-header-padding" >Tag / Sha</th >
154- <th class =" table-header-padding" >State</th >
155- <th class =" table-header-padding" >Started At</th >
156- <th class =" table-header-padding" >Backend</th >
157- <th class =" table-header-padding" >Profile</th >
158- <th class =" table-header-padding" >Dequeue Counter</th >
171+ <th >Tag</th >
172+ <th >Status</th >
173+ <th >Started at</th >
174+ <th >Completed at</th >
175+ <th >Kind</th >
176+ <th >Backend</th >
177+ <th >Profile</th >
178+ <th >Attempts</th >
159179 </tr >
160180 </thead >
161181 <tbody >
162182 <template v-for =" job in collector .jobs " >
163183 <tr v-if =" ACTIVE_FILTERS[job.status]" >
164- <td class = " table-cell-padding " >
165- {{ shortenTag( job.requestTag) }}
184+ <td >
185+ < CommitSha :tag = " job.requestTag" ></ CommitSha >
166186 </td >
167- <td class = " table-cell-padding " >
187+ <td >
168188 {{ formatJobStatus(job.status) }}
169189 </td >
170- <td class = " table-cell-padding " >
190+ <td >
171191 {{ formatISODate(job.startedAt) }}
172192 </td >
173- <td class =" table-cell-padding" >{{ job.backend }}</td >
174- <td class =" table-cell-padding" >{{ job.profile }}</td >
175- <td class =" table-cell-padding" >
193+ <td >
194+ {{ formatISODate(job.completedAt) }}
195+ </td >
196+ <td >{{ job.kind }}</td >
197+ <td >{{ formatBackend(job) }}</td >
198+ <td >
199+ {{ formatProfile(job) }}
200+ </td >
201+ <td >
176202 {{ job.dequeCounter }}
177203 </td >
178204 </tr >
179205 </template >
180206 </tbody >
181207 </table >
182208 </div >
183-
184- <div class =" collector-no-work" v-if =" collector.jobs.length === 0" >
185- <h3 >no active benchmarks</h3 >
186- </div >
187209 </div >
188210</template >
189211
@@ -237,12 +259,28 @@ $sm-radius: 8px;
237259}
238260
239261.table-collector-status-filter-wrapper {
240- padding : $sm-padding 0 px ;
262+ padding : $sm-padding 0 ;
241263}
242264
243265.table-collector-status-filters {
244266 display : flex ;
245267 flex-direction : column ;
268+
269+ button {
270+ border : 1px solid #333 ;
271+ border-radius : $sm-radius ;
272+ margin-right : $sm-padding ;
273+ padding : 5px 10px ;
274+
275+ & .active {
276+ font-weight : bold ;
277+ border-width : 2px ;
278+ border-color : #1b45e4 ;
279+ }
280+ & :hover {
281+ box-shadow : inset 0 0 2px #1b45e4 ;
282+ }
283+ }
246284}
247285
248286.table-collector-status-filter-btn-wrapper {
@@ -251,20 +289,6 @@ $sm-radius: 8px;
251289 flex-direction : row ;
252290}
253291
254- .table-collector-status-filter-btn {
255- border : 1px solid #333 ;
256- border-radius : $sm-radius ;
257- width : 100% ;
258- margin-right : $sm-padding ;
259- }
260-
261- .table-collector-status-filter-btn :hover {
262- transition : 250ms ;
263- }
264-
265- .status {
266- }
267-
268292.status.benchmarking {
269293 background : #117411 ;
270294 color : white ;
@@ -288,7 +312,7 @@ $sm-radius: 8px;
288312
289313.table-collector-wrapper {
290314 padding : $sm-padding ;
291- margin : $sm-padding 0 px ;
315+ margin : $sm-padding 0 ;
292316 background-color : #eee ;
293317 border-radius : $sm-radius ;
294318
@@ -311,31 +335,18 @@ $sm-radius: 8px;
311335 border-bottom : 1px solid black ;
312336 }
313337
314- .table-header-padding {
315- padding : $sm-padding $sm-padding 0 px $sm-padding ;
316- text-align : left ;
338+ th {
339+ padding : $sm-padding $sm-padding 0 $sm-padding ;
340+ text-align : center ;
317341 }
318342
319- .table-cell-padding {
320- padding : $sm-padding $sm-padding 1px 0 px ;
321- text-align : left ;
343+ td {
344+ padding : 5 px 1px ;
345+ text-align : center ;
322346 }
323347}
324348
325- .collector-no-work {
326- display : flex ;
327- justify-content : center ;
328- align-items : center ;
329- height : 40px ;
330- background-color : #eee ;
331- margin : $sm-padding ;
332- padding : $sm-padding ;
333- border-radius : $sm-radius ;
334-
335- h3 {
336- font-variant : small-caps ;
337- font-weight : 700 ;
338- font-size : 1.5em ;
339- }
349+ .show-jobs {
350+ margin-top : 10px ;
340351}
341352 </style >
0 commit comments