11<script setup lang="ts">
2- import {CollectorConfig } from " ./data" ;
2+ import {ref , Ref } from " vue" ;
3+ import {CollectorConfig , BenchmarkJobStatus } from " ./data" ;
34
45const props = defineProps <{
56 collector: CollectorConfig ;
@@ -8,6 +9,23 @@ const props = defineProps<{
89function statusClass(c : CollectorConfig ): string {
910 return c .isActive ? " active" : " inactive" ;
1011}
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+ }
1129 </script >
1230
1331<template >
@@ -56,6 +74,26 @@ function statusClass(c: CollectorConfig): string {
5674 </div >
5775
5876 <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 >
5997 <table class =" table-collector" style =" border-collapse : collapse " >
6098 <caption >
6199 current benchmark jobs
@@ -71,22 +109,24 @@ function statusClass(c: CollectorConfig): string {
71109 </tr >
72110 </thead >
73111 <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 >
90130 </tbody >
91131 </table >
92132 </div >
@@ -98,8 +138,11 @@ function statusClass(c: CollectorConfig): string {
98138</template >
99139
100140<style lang="scss" scoped>
141+ $sm-padding : 8px ;
142+ $sm-radius : 8px ;
143+
101144.collector-card {
102- border-radius : 8 px ;
145+ border-radius : $sm-radius ;
103146 flex-direction : column ;
104147 justify-content : space-between ;
105148 padding : 16px ;
@@ -109,11 +152,11 @@ function statusClass(c: CollectorConfig): string {
109152}
110153.collector-name {
111154 font-size : 1.5em ;
112- padding : 8 px ;
155+ padding : $sm-padding ;
113156}
114157
115158.meta {
116- padding : 8 px ;
159+ padding : $sm-padding ;
117160}
118161
119162.collector-meta {
@@ -134,13 +177,39 @@ function statusClass(c: CollectorConfig): string {
134177}
135178
136179.collector-sm-padding-left-right {
137- padding : 0px 8 px ;
180+ padding : 0px $sm-padding ;
138181}
139182.collector-sm-padding-left {
140- padding-left : 8 px ;
183+ padding-left : $sm-padding ;
141184}
142185.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 ;
144213}
145214
146215.status {
@@ -158,10 +227,10 @@ function statusClass(c: CollectorConfig): string {
158227}
159228
160229.table-collector-wrapper {
161- padding : 8px ;
230+ padding : $sm-padding ;
231+ margin : $sm-padding 0px ;
162232 background-color : #eee ;
163- margin : 8px 0px ;
164- border-radius : 8px ;
233+ border-radius : $sm-radius ;
165234
166235 table {
167236 font-size : 1em ;
@@ -183,12 +252,12 @@ function statusClass(c: CollectorConfig): string {
183252 }
184253
185254 .table-header-padding {
186- padding : 8 px 8 px 0px 0 px ;
255+ padding : $sm-padding $sm-padding 0px $sm-padding ;
187256 text-align : left ;
188257 }
189258
190259 .table-cell-padding {
191- padding : 8 px 8 px 1px 0px ;
260+ padding : $sm-padding $sm-padding 1px 0px ;
192261 text-align : left ;
193262 }
194263}
@@ -199,9 +268,9 @@ function statusClass(c: CollectorConfig): string {
199268 align-items : center ;
200269 height : 40px ;
201270 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 ;
205274
206275 h3 {
207276 font-variant : small-caps ;
0 commit comments