11<script setup lang="ts">
2- import {ref } from " vue" ;
3- import {CollectorConfig } from " ./data" ;
2+ import {ref , Ref } from " vue" ;
3+ import {CollectorConfig , BenchmarkJobStatus } from " ./data" ;
44
55const props = defineProps <{
66 collector: CollectorConfig ;
@@ -10,13 +10,21 @@ function statusClass(c: CollectorConfig): string {
1010 return c .isActive ? " active" : " inactive" ;
1111}
1212
13- const FILTERS = [" InProgress" , " Queued" , " Success" , " Failure" ];
14- const ACTIVE_FILTERS = ref (new Set (FILTERS ));
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: false ,
24+ });
1525
1626function filterJobByStatus(status : string ) {
17- if (! ACTIVE_FILTERS .value .delete (status )) {
18- ACTIVE_FILTERS .value .add (status );
19- }
27+ ACTIVE_FILTERS .value [status ] = ! ACTIVE_FILTERS .value [status ];
2028}
2129 </script >
2230
@@ -79,7 +87,7 @@ function filterJobByStatus(status: string) {
7987 <input
8088 type =" checkbox"
8189 value =" filter"
82- :checked =" ACTIVE_FILTERS.has( filter) "
90+ :checked =" ACTIVE_FILTERS[ filter] "
8391 />
8492 </button >
8593 </template >
@@ -102,12 +110,7 @@ function filterJobByStatus(status: string) {
102110 </thead >
103111 <tbody >
104112 <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- >
113+ <tr v-if =" ACTIVE_FILTERS[job.status]" >
111114 <td class =" table-cell-padding" >
112115 {{ job.requestTag }}
113116 </td >
0 commit comments