Skip to content

Commit

Permalink
Adds search filtering to signal instance table
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova committed Nov 29, 2023
1 parent 1a99d5d commit 89f9022
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/dispatch/static/dispatch/src/signal/store.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { getField, updateField } from "vuex-map-fields"
import { debounce } from "lodash"
import { debounce, filter } from "lodash"

import SearchUtils from "@/search/utils"
import SignalApi from "@/signal/api"
Expand Down Expand Up @@ -117,6 +117,14 @@ const actions = {
return SignalApi.getAllInstances(params)
.then((response) => {
commit("SET_INSTANCE_TABLE_LOADING", false)

// We filter out instances based on the given query parameter provided
if (params.q) {
response.data.items = filter(response.data.items, function (item) {
return item.signal.name.includes(params.q) || item.signal.description.includes(params.q)
})
}

commit("SET_INSTANCE_TABLE_ROWS", response.data)
})
.catch(() => {
Expand Down

0 comments on commit 89f9022

Please sign in to comment.