diff --git a/src/dispatch/database/revisions/tenant/versions/2023-11-29_bdaeabba3e53.py b/src/dispatch/database/revisions/tenant/versions/2023-11-29_bdaeabba3e53.py new file mode 100644 index 000000000000..9a89179e9ccd --- /dev/null +++ b/src/dispatch/database/revisions/tenant/versions/2023-11-29_bdaeabba3e53.py @@ -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 diff --git a/src/dispatch/plugins/dispatch_slack/fields.py b/src/dispatch/plugins/dispatch_slack/fields.py index a5868bb91809..061fbad1c176 100644 --- a/src/dispatch/plugins/dispatch_slack/fields.py +++ b/src/dispatch/plugins/dispatch_slack/fields.py @@ -619,7 +619,7 @@ def entity_select( ): """Creates an entity select.""" entity_options = [ - {"text": entity.entity_type.name[:75], "value": entity.id} + {"text": entity.value[:75], "value": entity.id} for entity in entity_service.get_all_desc_by_signal( db_session=db_session, signal_id=signal_id ) @@ -664,7 +664,7 @@ def signal_definition_select( signals: list[Signal], action_id: str = DefaultActionIds.signal_definition_select, block_id: str = DefaultBlockIds.signal_definition_select, - label: str = "Signal Defintions", + label: str = "Signal Definitions", initial_option: Participant = None, **kwargs, ): diff --git a/src/dispatch/static/dispatch/src/signal/store.js b/src/dispatch/static/dispatch/src/signal/store.js index 2b2009072174..558eb5fb7b62 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 } from "lodash" +import { debounce, filter } from "lodash" import SearchUtils from "@/search/utils" import SignalApi from "@/signal/api" @@ -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(() => {