1
1
<script setup lang="ts">
2
2
import {ref } from " vue" ;
3
- import {CollectorConfig } from " ./data" ;
3
+ import {CollectorConfig , BenchmarkJobStatus } from " ./data" ;
4
4
5
5
const props = defineProps <{
6
6
collector: CollectorConfig ;
@@ -10,13 +10,21 @@ function statusClass(c: CollectorConfig): string {
10
10
return c .isActive ? " active" : " inactive" ;
11
11
}
12
12
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 <{[index : keyof BenchmarkJobStatus ]: boolean }> = ref ({
20
+ InProgress: true ,
21
+ Queued: true ,
22
+ Success: false ,
23
+ Failed: false ,
24
+ });
15
25
16
26
function 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 ];
20
28
}
21
29
</script >
22
30
@@ -79,7 +87,7 @@ function filterJobByStatus(status: string) {
79
87
<input
80
88
type =" checkbox"
81
89
value =" filter"
82
- :checked =" ACTIVE_FILTERS.has( filter) "
90
+ :checked =" ACTIVE_FILTERS[ filter] "
83
91
/>
84
92
</button >
85
93
</template >
@@ -102,12 +110,7 @@ function filterJobByStatus(status: string) {
102
110
</thead >
103
111
<tbody >
104
112
<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]" >
111
114
<td class =" table-cell-padding" >
112
115
{{ job.requestTag }}
113
116
</td >
0 commit comments