1
1
<script setup lang="ts">
2
- import {CollectorConfig } from " ./data" ;
2
+ import {ref , Ref } from " vue" ;
3
+ import {CollectorConfig , BenchmarkJobStatus } from " ./data" ;
3
4
4
5
const props = defineProps <{
5
6
collector: CollectorConfig ;
@@ -8,6 +9,23 @@ const props = defineProps<{
8
9
function statusClass(c : CollectorConfig ): string {
9
10
return c .isActive ? " active" : " inactive" ;
10
11
}
12
+
13
+ const FILTERS: BenchmarkJobStatus [] = [
14
+ " InProgress" ,
15
+ " Queued" ,
16
+ " Success" ,
17
+ " Failed" ,
18
+ ];
19
+ const ACTIVE_FILTERS: Ref <Record <BenchmarkJobStatus , boolean >> = ref ({
20
+ InProgress: true ,
21
+ Queued: true ,
22
+ Success: false ,
23
+ Failed: true ,
24
+ });
25
+
26
+ function filterJobByStatus(status : string ) {
27
+ ACTIVE_FILTERS .value [status ] = ! ACTIVE_FILTERS .value [status ];
28
+ }
11
29
</script >
12
30
13
31
<template >
@@ -56,6 +74,26 @@ function statusClass(c: CollectorConfig): string {
56
74
</div >
57
75
58
76
<div class =" table-collector-wrapper" >
77
+ <div class =" table-collector-status-filter-wrapper" >
78
+ <div class =" table-collector-status-filters" >
79
+ <strong >Filter by job status:</strong >
80
+ <div class =" table-collector-status-filter-btn-wrapper" >
81
+ <template v-for =" filter in FILTERS " >
82
+ <button
83
+ class =" table-collector-status-filter-btn"
84
+ @click =" filterJobByStatus(filter)"
85
+ >
86
+ {{ filter }}
87
+ <input
88
+ type =" checkbox"
89
+ value =" filter"
90
+ :checked =" ACTIVE_FILTERS[filter]"
91
+ />
92
+ </button >
93
+ </template >
94
+ </div >
95
+ </div >
96
+ </div >
59
97
<table class =" table-collector" style =" border-collapse : collapse " >
60
98
<caption >
61
99
current benchmark jobs
@@ -71,22 +109,24 @@ function statusClass(c: CollectorConfig): string {
71
109
</tr >
72
110
</thead >
73
111
<tbody >
74
- <tr v-for =" job in collector.jobs" >
75
- <td class =" table-cell-padding" >
76
- {{ job.requestTag }}
77
- </td >
78
- <td class =" table-cell-padding" >
79
- {{ job.status }}
80
- </td >
81
- <td class =" table-cell-padding" >
82
- {{ job.startedAt }}
83
- </td >
84
- <td class =" table-cell-padding" >{{ job.backend }}</td >
85
- <td class =" table-cell-padding" >{{ job.profile }}</td >
86
- <td class =" table-cell-padding" >
87
- {{ job.dequeCounter }}
88
- </td >
89
- </tr >
112
+ <template v-for =" job in collector .jobs " >
113
+ <tr v-if =" ACTIVE_FILTERS[job.status]" >
114
+ <td class =" table-cell-padding" >
115
+ {{ job.requestTag }}
116
+ </td >
117
+ <td class =" table-cell-padding" >
118
+ {{ job.status }}
119
+ </td >
120
+ <td class =" table-cell-padding" >
121
+ {{ job.startedAt }}
122
+ </td >
123
+ <td class =" table-cell-padding" >{{ job.backend }}</td >
124
+ <td class =" table-cell-padding" >{{ job.profile }}</td >
125
+ <td class =" table-cell-padding" >
126
+ {{ job.dequeCounter }}
127
+ </td >
128
+ </tr >
129
+ </template >
90
130
</tbody >
91
131
</table >
92
132
</div >
@@ -98,8 +138,11 @@ function statusClass(c: CollectorConfig): string {
98
138
</template >
99
139
100
140
<style lang="scss" scoped>
141
+ $sm-padding : 8px ;
142
+ $sm-radius : 8px ;
143
+
101
144
.collector-card {
102
- border-radius : 8 px ;
145
+ border-radius : $sm-radius ;
103
146
flex-direction : column ;
104
147
justify-content : space-between ;
105
148
padding : 16px ;
@@ -109,11 +152,11 @@ function statusClass(c: CollectorConfig): string {
109
152
}
110
153
.collector-name {
111
154
font-size : 1.5em ;
112
- padding : 8 px ;
155
+ padding : $sm-padding ;
113
156
}
114
157
115
158
.meta {
116
- padding : 8 px ;
159
+ padding : $sm-padding ;
117
160
}
118
161
119
162
.collector-meta {
@@ -134,13 +177,39 @@ function statusClass(c: CollectorConfig): string {
134
177
}
135
178
136
179
.collector-sm-padding-left-right {
137
- padding : 0px 8 px ;
180
+ padding : 0px $sm-padding ;
138
181
}
139
182
.collector-sm-padding-left {
140
- padding-left : 8 px ;
183
+ padding-left : $sm-padding ;
141
184
}
142
185
.collector-sm-padding-right {
143
- padding-right : 8px ;
186
+ padding-right : $sm-padding ;
187
+ }
188
+
189
+ .table-collector-status-filter-wrapper {
190
+ padding : $sm-padding 0px ;
191
+ }
192
+
193
+ .table-collector-status-filters {
194
+ display : flex ;
195
+ flex-direction : column ;
196
+ }
197
+
198
+ .table-collector-status-filter-btn-wrapper {
199
+ padding-top : $sm-padding ;
200
+ display : flex ;
201
+ flex-direction : row ;
202
+ }
203
+
204
+ .table-collector-status-filter-btn {
205
+ border : 1px solid #333 ;
206
+ border-radius : $sm-radius ;
207
+ width : 100% ;
208
+ margin-right : $sm-padding ;
209
+ }
210
+
211
+ .table-collector-status-filter-btn :hover {
212
+ transition : 250ms ;
144
213
}
145
214
146
215
.status {
@@ -158,10 +227,10 @@ function statusClass(c: CollectorConfig): string {
158
227
}
159
228
160
229
.table-collector-wrapper {
161
- padding : 8px ;
230
+ padding : $sm-padding ;
231
+ margin : $sm-padding 0px ;
162
232
background-color : #eee ;
163
- margin : 8px 0px ;
164
- border-radius : 8px ;
233
+ border-radius : $sm-radius ;
165
234
166
235
table {
167
236
font-size : 1em ;
@@ -183,12 +252,12 @@ function statusClass(c: CollectorConfig): string {
183
252
}
184
253
185
254
.table-header-padding {
186
- padding : 8 px 8 px 0px 0 px ;
255
+ padding : $sm-padding $sm-padding 0px $sm-padding ;
187
256
text-align : left ;
188
257
}
189
258
190
259
.table-cell-padding {
191
- padding : 8 px 8 px 1px 0px ;
260
+ padding : $sm-padding $sm-padding 1px 0px ;
192
261
text-align : left ;
193
262
}
194
263
}
@@ -199,9 +268,9 @@ function statusClass(c: CollectorConfig): string {
199
268
align-items : center ;
200
269
height : 40px ;
201
270
background-color : #eee ;
202
- margin : 8 px ;
203
- padding : 8 px ;
204
- border-radius : 8 px ;
271
+ margin : $sm-padding ;
272
+ padding : $sm-padding ;
273
+ border-radius : $sm-radius ;
205
274
206
275
h3 {
207
276
font-variant : small-caps ;
0 commit comments