From 441122a8be0d631064f7bbd130445a81cd4753e6 Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Fri, 1 Dec 2023 11:18:00 -0800 Subject: [PATCH 1/4] Removes store filtering --- src/dispatch/static/dispatch/src/signal/store.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/dispatch/static/dispatch/src/signal/store.js b/src/dispatch/static/dispatch/src/signal/store.js index 558eb5fb7b62..2b2009072174 100644 --- a/src/dispatch/static/dispatch/src/signal/store.js +++ b/src/dispatch/static/dispatch/src/signal/store.js @@ -1,5 +1,5 @@ import { getField, updateField } from "vuex-map-fields" -import { debounce, filter } from "lodash" +import { debounce } from "lodash" import SearchUtils from "@/search/utils" import SignalApi from "@/signal/api" @@ -117,14 +117,6 @@ 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(() => { From 914c04ff3a2d931439162b192c422096281501fa Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Fri, 1 Dec 2023 13:13:19 -0800 Subject: [PATCH 2/4] Adds filter button to signal instance table --- .../dispatch/src/signal/TableFilterDialog.vue | 68 +++++++++++++++++++ .../dispatch/src/signal/TableInstance.vue | 12 ++-- .../static/dispatch/src/signal/store.js | 1 + 3 files changed, 76 insertions(+), 5 deletions(-) create mode 100644 src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue diff --git a/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue new file mode 100644 index 000000000000..c8bfef5a9ef1 --- /dev/null +++ b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue @@ -0,0 +1,68 @@ + + + diff --git a/src/dispatch/static/dispatch/src/signal/TableInstance.vue b/src/dispatch/static/dispatch/src/signal/TableInstance.vue index f66ad0ae1742..81b0831be5de 100644 --- a/src/dispatch/static/dispatch/src/signal/TableInstance.vue +++ b/src/dispatch/static/dispatch/src/signal/TableInstance.vue @@ -4,6 +4,9 @@
Signals
+ + + @@ -32,9 +35,6 @@ :loading="loading" loading-text="Loading... Please wait" > - @@ -91,6 +91,7 @@ import CasePopover from "@/case/CasePopover.vue" import RawSignalViewer from "@/signal/RawSignalViewer.vue" import RouterUtils from "@/router/utils" import SignalPopover from "@/signal/SignalPopover.vue" +import TableFilterDialog from "@/signal/TableFilterDialog.vue" export default { name: "SignalInstanceTable", @@ -99,12 +100,12 @@ export default { CasePopover, RawSignalViewer, SignalPopover, + TableFilterDialog, }, data() { return { headers: [ - { title: "Create Case", value: "signal.create_case", sortable: false }, { title: "Case", value: "case", sortable: false }, { title: "Signal Definition", value: "signal", sortable: false }, { title: "Filter Action", value: "filter_action", sortable: true }, @@ -124,6 +125,7 @@ export default { "instanceTable.loading", "instanceTable.options.descending", "instanceTable.options.filters", + "instanceTable.options.filters.signal", "instanceTable.options.itemsPerPage", "instanceTable.options.page", "instanceTable.options.q", @@ -166,7 +168,7 @@ export default { ) this.$watch( - (vm) => [vm.q, vm.sortBy, vm.itemsPerPage, vm.descending, vm.created_at, vm.project], + (vm) => [vm.q, vm.sortBy, vm.itemsPerPage, vm.descending, vm.created_at, vm.project, vm.signal], () => { this.page = 1 RouterUtils.updateURLFilters(this.filters) diff --git a/src/dispatch/static/dispatch/src/signal/store.js b/src/dispatch/static/dispatch/src/signal/store.js index 2b2009072174..524894e64261 100644 --- a/src/dispatch/static/dispatch/src/signal/store.js +++ b/src/dispatch/static/dispatch/src/signal/store.js @@ -76,6 +76,7 @@ const state = { start: null, end: null, }, + signal: [], }, q: "", page: 1, From 046e8250911006bddc7e6e486cb046f7a66a86af Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Fri, 1 Dec 2023 13:21:08 -0800 Subject: [PATCH 3/4] Fixes linting errors --- .../static/dispatch/src/signal/TableFilterDialog.vue | 9 ++------- .../static/dispatch/src/signal/TableInstance.vue | 12 ++++++++++-- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue index c8bfef5a9ef1..9132f137076d 100644 --- a/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue +++ b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue @@ -33,7 +33,6 @@ export default { name: "SignalInstanceTableFilterDialog", components: { - DateWindowInput, SignalDefinitionCombobox, }, @@ -45,13 +44,9 @@ export default { }, computed: { - ...mapFields("signal", [ - "instanceTable.options.filters.signal", - ]), + ...mapFields("signal", ["instanceTable.options.filters.signal"]), numFilters: function () { - return sum([ - this.signal.length - ]) + return sum([this.signal.length]) }, }, diff --git a/src/dispatch/static/dispatch/src/signal/TableInstance.vue b/src/dispatch/static/dispatch/src/signal/TableInstance.vue index 81b0831be5de..e15661d4caa9 100644 --- a/src/dispatch/static/dispatch/src/signal/TableInstance.vue +++ b/src/dispatch/static/dispatch/src/signal/TableInstance.vue @@ -5,7 +5,7 @@
Signals
- +
@@ -168,7 +168,15 @@ export default { ) this.$watch( - (vm) => [vm.q, vm.sortBy, vm.itemsPerPage, vm.descending, vm.created_at, vm.project, vm.signal], + (vm) => [ + vm.q, + vm.sortBy, + vm.itemsPerPage, + vm.descending, + vm.created_at, + vm.project, + vm.signal + ], () => { this.page = 1 RouterUtils.updateURLFilters(this.filters) From 9c8ee5aeeb9cff50e0f7229d378655dffc765128 Mon Sep 17 00:00:00 2001 From: Marc Vilanova Date: Fri, 1 Dec 2023 13:23:01 -0800 Subject: [PATCH 4/4] more lint errors --- src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue | 1 - src/dispatch/static/dispatch/src/signal/TableInstance.vue | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue index 9132f137076d..37c257d8dfc8 100644 --- a/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue +++ b/src/dispatch/static/dispatch/src/signal/TableFilterDialog.vue @@ -26,7 +26,6 @@ import { sum } from "lodash" import { mapFields } from "vuex-map-fields" -import DateWindowInput from "@/components/DateWindowInput.vue" import SignalDefinitionCombobox from "@/signal/SignalDefinitionCombobox.vue" export default { diff --git a/src/dispatch/static/dispatch/src/signal/TableInstance.vue b/src/dispatch/static/dispatch/src/signal/TableInstance.vue index e15661d4caa9..a9362786fa14 100644 --- a/src/dispatch/static/dispatch/src/signal/TableInstance.vue +++ b/src/dispatch/static/dispatch/src/signal/TableInstance.vue @@ -175,7 +175,7 @@ export default { vm.descending, vm.created_at, vm.project, - vm.signal + vm.signal, ], () => { this.page = 1