Skip to content

Commit

Permalink
Enhancement/signal definition UI (Netflix#3059) (#41)
Browse files Browse the repository at this point in the history
* Minor fixes to signal ui

* Remove table filtering for now

Co-authored-by: kevgliss <[email protected]>
  • Loading branch information
rutvijmehta-harness and kevgliss authored Mar 17, 2023
1 parent 9f8f578 commit 5692e11
Show file tree
Hide file tree
Showing 5 changed files with 36 additions and 15 deletions.
4 changes: 3 additions & 1 deletion src/dispatch/database/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
}
Expand Down
6 changes: 3 additions & 3 deletions src/dispatch/signal/flows.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
7 changes: 5 additions & 2 deletions src/dispatch/static/dispatch/src/signal/Table.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
<settings-breadcrumbs v-model="project" />
</v-col>
<v-col class="text-right">
<v-btn color="info" class="mr-2" @click="createEditShow()"> New </v-btn>
<v-btn color="info" class="ml-2" @click="createEditShow()"> New </v-btn>
</v-col>
</v-row>
<v-row no-gutters>
Expand All @@ -42,6 +42,9 @@
:loading="loading"
loading-text="Loading... Please wait"
>
<template v-slot:item.enabled="{ item }">
<v-simple-checkbox v-model="item.enabled" disabled />
</template>
<template v-slot:item.status="{ item }">
<case-status :status="item.status" :id="item.id" />
</template>
Expand Down Expand Up @@ -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" },
Expand Down
8 changes: 1 addition & 7 deletions src/dispatch/static/dispatch/src/signal/TableInstance.vue
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,6 @@
</template>
<template v-slot:item.data-table-actions="{ item }">
<raw-signal-viewer v-model="item.raw" />
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<v-icon v-bind="attrs" v-on="on" class="mr-2"> mdi-fingerprint </v-icon>
</template>
<span>{{ item.fingerprint }}</span>
</v-tooltip>
</template>
</v-data-table>
</v-card>
Expand Down Expand Up @@ -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" },
],
Expand Down
26 changes: 24 additions & 2 deletions src/dispatch/static/dispatch/src/signal/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -50,11 +73,10 @@ const state = {
q: "",
page: 1,
itemsPerPage: 10,
sortBy: ["name"],
sortBy: ["created_at"],
descending: [true],
},
loading: false,
bulkEditLoading: false,
},
}

Expand Down

0 comments on commit 5692e11

Please sign in to comment.