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