Skip to content

Commit 1d81692

Browse files
committed
PR Feedback; use a JS object over a set, remove :key on table row
1 parent da987e4 commit 1d81692

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

site/frontend/src/pages/status_new/collector.vue

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<script setup lang="ts">
22
import {ref} from "vue";
3-
import {CollectorConfig} from "./data";
3+
import {CollectorConfig, BenchmarkJobStatus} from "./data";
44
55
const 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<{[index: keyof BenchmarkJobStatus]: boolean}> = ref({
20+
InProgress: true,
21+
Queued: true,
22+
Success: false,
23+
Failed: false,
24+
});
1525
1626
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];
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

Comments
 (0)