Skip to content

Commit

Permalink
Tries a different approach to signal instance table filtering (#4044)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova authored Nov 29, 2023
1 parent 651a6f7 commit 65aef6e
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
"""Removes search vector from signal instance model
Revision ID: bdaeabba3e53
Revises: f2605bfc1f59
Create Date: 2023-11-29 12:59:45.408085
"""
from alembic import op

# revision identifiers, used by Alembic.
revision = "bdaeabba3e53"
down_revision = "f2605bfc1f59"
branch_labels = None
depends_on = None


def upgrade():
# ### commands auto generated by Alembic - please adjust! ###
op.drop_index(
"signal_instance_search_vector_idx", table_name="signal_instance", postgresql_using="gin"
)
op.drop_column("signal_instance", "search_vector")
# ### end Alembic commands ###


def downgrade():
# ### commands auto generated by Alembic - please adjust! ###
pass
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 65aef6e

Please sign in to comment.