Skip to content

Commit 904af9a

Browse files
committed
Feat; filter collectors jobs by status
1 parent d5a7580 commit 904af9a

File tree

1 file changed

+96
-30
lines changed

1 file changed

+96
-30
lines changed

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

Lines changed: 96 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
<script setup lang="ts">
2+
import {ref} from "vue";
23
import {CollectorConfig} from "./data";
34
45
const props = defineProps<{
@@ -8,6 +9,15 @@ const props = defineProps<{
89
function statusClass(c: CollectorConfig): string {
910
return c.isActive ? "active" : "inactive";
1011
}
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+
}
1121
</script>
1222

1323
<template>
@@ -56,6 +66,26 @@ function statusClass(c: CollectorConfig): string {
5666
</div>
5767

5868
<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>
5989
<table class="table-collector" style="border-collapse: collapse">
6090
<caption>
6191
current benchmark jobs
@@ -71,22 +101,29 @@ function statusClass(c: CollectorConfig): string {
71101
</tr>
72102
</thead>
73103
<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>
90127
</tbody>
91128
</table>
92129
</div>
@@ -98,8 +135,11 @@ function statusClass(c: CollectorConfig): string {
98135
</template>
99136

100137
<style lang="scss" scoped>
138+
$sm-padding: 8px;
139+
$sm-radius: 8px;
140+
101141
.collector-card {
102-
border-radius: 8px;
142+
border-radius: $sm-radius;
103143
flex-direction: column;
104144
justify-content: space-between;
105145
padding: 16px;
@@ -109,11 +149,11 @@ function statusClass(c: CollectorConfig): string {
109149
}
110150
.collector-name {
111151
font-size: 1.5em;
112-
padding: 8px;
152+
padding: $sm-padding;
113153
}
114154
115155
.meta {
116-
padding: 8px;
156+
padding: $sm-padding;
117157
}
118158
119159
.collector-meta {
@@ -134,13 +174,39 @@ function statusClass(c: CollectorConfig): string {
134174
}
135175
136176
.collector-sm-padding-left-right {
137-
padding: 0px 8px;
177+
padding: 0px $sm-padding;
138178
}
139179
.collector-sm-padding-left {
140-
padding-left: 8px;
180+
padding-left: $sm-padding;
141181
}
142182
.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;
144210
}
145211
146212
.status {
@@ -158,10 +224,10 @@ function statusClass(c: CollectorConfig): string {
158224
}
159225
160226
.table-collector-wrapper {
161-
padding: 8px;
227+
padding: $sm-padding;
228+
margin: $sm-padding 0px;
162229
background-color: #eee;
163-
margin: 8px 0px;
164-
border-radius: 8px;
230+
border-radius: $sm-radius;
165231
166232
table {
167233
font-size: 1em;
@@ -183,12 +249,12 @@ function statusClass(c: CollectorConfig): string {
183249
}
184250
185251
.table-header-padding {
186-
padding: 8px 8px 0px 0px;
252+
padding: $sm-padding $sm-padding 0px $sm-padding;
187253
text-align: left;
188254
}
189255
190256
.table-cell-padding {
191-
padding: 8px 8px 1px 0px;
257+
padding: $sm-padding $sm-padding 1px 0px;
192258
text-align: left;
193259
}
194260
}
@@ -199,9 +265,9 @@ function statusClass(c: CollectorConfig): string {
199265
align-items: center;
200266
height: 40px;
201267
background-color: #eee;
202-
margin: 8px;
203-
padding: 8px;
204-
border-radius: 8px;
268+
margin: $sm-padding;
269+
padding: $sm-padding;
270+
border-radius: $sm-radius;
205271
206272
h3 {
207273
font-variant: small-caps;

0 commit comments

Comments
 (0)