diff --git a/src/dispatch/database/service.py b/src/dispatch/database/service.py index 6af9fb7156e6..85d5c3cab601 100644 --- a/src/dispatch/database/service.py +++ b/src/dispatch/database/service.py @@ -33,7 +33,7 @@ from dispatch.participant.models import Participant from dispatch.plugin.models import Plugin, PluginInstance from dispatch.search.fulltext.composite_search import CompositeSearch -from dispatch.signal.models import SignalInstance +from dispatch.signal.models import Signal, SignalInstance from dispatch.task.models import Task from .core import Base, get_class_by_tablename, get_db, get_model_name_by_tablename @@ -348,6 +348,8 @@ def apply_filter_specific_joins(model: Base, filter_spec: dict, query: orm.query (Incident, "Tag"): (Incident.tags, True), (Incident, "TagType"): (Incident.tags, True), (Incident, "Term"): (Incident.terms, True), + (Signal, "Tag"): (Signal.tags, True), + (Signal, "TagType"): {Signal.tags, True}, (SignalInstance, "Entity"): (SignalInstance.entities, True), (SignalInstance, "EntityType"): (SignalInstance.entities, True), } diff --git a/src/dispatch/signal/flows.py b/src/dispatch/signal/flows.py index 2ec4acce04f7..1709f64c16ba 100644 --- a/src/dispatch/signal/flows.py +++ b/src/dispatch/signal/flows.py @@ -19,12 +19,12 @@ def create_signal_instance( variant=signal_instance_data.variant, ) - if not signal.enabled: - raise Exception("Signal definition is not enabled.") - if not signal: raise Exception("No signal definition defined.") + if not signal.enabled: + raise Exception("Signal definition is not enabled.") + signal_instance_in = SignalInstanceCreate(raw=signal_instance_data, project=signal.project) signal_instance = signal_service.create_instance( diff --git a/src/dispatch/static/dispatch/src/signal/Table.vue b/src/dispatch/static/dispatch/src/signal/Table.vue index 63cb6b8b84d6..883fba2cecd6 100644 --- a/src/dispatch/static/dispatch/src/signal/Table.vue +++ b/src/dispatch/static/dispatch/src/signal/Table.vue @@ -15,7 +15,7 @@ - New + New @@ -42,6 +42,9 @@ :loading="loading" loading-text="Loading... Please wait" > + @@ -115,7 +118,7 @@ export default { { text: "Name", value: "name", align: "left", width: "10%" }, { text: "Variant", value: "variant", sortable: true }, { text: "Description", value: "description", sortable: false }, - { text: "Project", value: "project.name", sortable: true }, + { text: "Enabled", value: "enabled", sortable: true }, { text: "Owner", value: "owner" }, { text: "Case Type", value: "case_type" }, { text: "Case Priority", value: "case_priority" }, diff --git a/src/dispatch/static/dispatch/src/signal/TableInstance.vue b/src/dispatch/static/dispatch/src/signal/TableInstance.vue index 54e3b8b1de30..b77e45411b4e 100644 --- a/src/dispatch/static/dispatch/src/signal/TableInstance.vue +++ b/src/dispatch/static/dispatch/src/signal/TableInstance.vue @@ -40,12 +40,6 @@ @@ -78,7 +72,7 @@ export default { { text: "Case", value: "case", sortable: false }, { text: "Signal", value: "signal", sortable: false }, { text: "Project", value: "project.name", sortable: true }, - { text: "Tags", value: "tags", sortable: false }, + { text: "Entities", value: "entities", sortable: false }, { text: "Created At", value: "created_at" }, { text: "", value: "data-table-actions", sortable: false, align: "end" }, ], diff --git a/src/dispatch/static/dispatch/src/signal/store.js b/src/dispatch/static/dispatch/src/signal/store.js index 9687c4c66838..e0c1857bfe3b 100644 --- a/src/dispatch/static/dispatch/src/signal/store.js +++ b/src/dispatch/static/dispatch/src/signal/store.js @@ -36,6 +36,29 @@ const state = { showRemove: false, }, table: { + rows: { + items: [], + total: null, + }, + options: { + filters: { + case_priority: [], + case_severity: [], + case_type: [], + project: [], + tag: [], + tag_type: [], + }, + q: "", + page: 1, + itemsPerPage: 10, + sortBy: ["name"], + descending: [true], + }, + loading: false, + bulkEditLoading: false, + }, + instanceTable: { rows: { items: [], total: null, @@ -50,11 +73,10 @@ const state = { q: "", page: 1, itemsPerPage: 10, - sortBy: ["name"], + sortBy: ["created_at"], descending: [true], }, loading: false, - bulkEditLoading: false, }, }