Skip to content

Commit cd89cd8

Browse files
chore(ui): introduce filters bar to flow triggers page (#7292)
Co-authored-by: MilosPaunovic <[email protected]>
1 parent 9b5e16a commit cd89cd8

File tree

1 file changed

+25
-9
lines changed

1 file changed

+25
-9
lines changed

ui/src/components/flows/FlowTriggers.vue

+25-9
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,12 @@
11
<template>
2+
<KestraFilter
3+
prefix="flow_triggers"
4+
:buttons="{
5+
refresh: {shown: true, callback: loadData},
6+
settings: {shown: false}
7+
}"
8+
/>
9+
210
<el-table
311
v-if="triggersWithType.length"
412
v-bind="$attrs"
@@ -39,12 +47,6 @@
3947
<el-table-column column-key="backfill" v-if="userCan(action.UPDATE) || userCan(action.CREATE)">
4048
<template #header>
4149
{{ $t("backfill") }}
42-
<refresh-button
43-
:can-auto-refresh="true"
44-
@refresh="loadData"
45-
size="small"
46-
custom-class="mx-1"
47-
/>
4850
</template>
4951
<template #default="scope">
5052
<el-button
@@ -220,9 +222,10 @@
220222
import Restart from "vue-material-design-icons/Restart.vue";
221223
import CalendarCollapseHorizontalOutline from "vue-material-design-icons/CalendarCollapseHorizontalOutline.vue"
222224
import FlowRun from "./FlowRun.vue";
223-
import RefreshButton from "../layout/RefreshButton.vue";
224225
import Id from "../Id.vue";
225226
import TriggerAvatar from "./TriggerAvatar.vue";
227+
228+
import KestraFilter from "../filter/KestraFilter.vue";
226229
</script>
227230

228231
<script>
@@ -238,6 +241,7 @@
238241
import LogsWrapper from "../logs/LogsWrapper.vue";
239242
import EmptyState from "../layout/EmptyState.vue";
240243
import TriggersEmptyImage from "../../assets/triggers_empty.svg";
244+
import _isEqual from "lodash/isEqual";
241245
242246
export default {
243247
components: {Markdown, Kicon, DateAgo, Vars, Drawer, LogsWrapper, EmptyState},
@@ -259,9 +263,19 @@
259263
created() {
260264
this.loadData();
261265
},
266+
watch: {
267+
$route(newValue, oldValue) {
268+
if (oldValue.name === newValue.name && !_isEqual(newValue.query, oldValue.query)) {
269+
this.loadData();
270+
}
271+
}
272+
},
262273
computed: {
263274
...mapState("auth", ["user"]),
264275
...mapGetters("flow", ["flow"]),
276+
query() {
277+
return Array.isArray(this.$route.query.q) ? this.$route.query.q[0] : this.$route.query.q;
278+
},
265279
modalData() {
266280
return Object
267281
.entries(this.triggersWithType.filter(trigger => trigger.triggerId === this.triggerId)[0])
@@ -284,10 +298,12 @@
284298
return {...trigger, sourceDisabled: trigger.disabled ?? false}
285299
})
286300
if (flowTriggers) {
287-
return flowTriggers.map(flowTrigger => {
301+
const triggers = flowTriggers.map(flowTrigger => {
288302
let pollingTrigger = this.triggers.find(trigger => trigger.triggerId === flowTrigger.id)
289303
return {...flowTrigger, ...(pollingTrigger || {})}
290304
})
305+
306+
return !this.query ? triggers : triggers.filter(trigger => trigger.id.includes(this.query))
291307
}
292308
return this.triggers
293309
},
@@ -332,7 +348,7 @@
332348
if(!this.triggersWithType.length) return;
333349
334350
this.$store
335-
.dispatch("trigger/find", {namespace: this.flow.namespace, flowId: this.flow.id, size: this.triggersWithType.length})
351+
.dispatch("trigger/find", {namespace: this.flow.namespace, flowId: this.flow.id, size: this.triggersWithType.length, q: this.query})
336352
.then(triggers => this.triggers = triggers.results);
337353
},
338354
setBackfillModal(trigger, bool) {

0 commit comments

Comments
 (0)