Skip to content

Commit

Permalink
Allows for an incident commander to be specified
Browse files Browse the repository at this point in the history
  • Loading branch information
whitdog47 committed Dec 8, 2023
1 parent dd6e978 commit e4c029d
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/dispatch/incident/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,7 @@ def description_required(cls, v):

class IncidentCreate(IncidentBase):
commander: Optional[ParticipantUpdate]
commander_email: Optional[str]
incident_priority: Optional[IncidentPriorityCreate]
incident_severity: Optional[IncidentSeverityCreate]
incident_type: Optional[IncidentTypeCreate]
Expand Down
4 changes: 3 additions & 1 deletion src/dispatch/incident/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,9 @@ def create(*, db_session, incident_in: IncidentCreate) -> Incident:

# add commander
commander_email = commander_service_id = None
if incident_in.commander:
if incident_in.commander_email:
commander_email = incident_in.commander_email
elif incident_in.commander:
commander_email = incident_in.commander.individual.email
else:
commander_email, commander_service_id = resolve_and_associate_role(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,17 @@
<v-col cols="12">
<tag-filter-auto-complete :project="project" v-model="tags" label="Tags" />
</v-col>
<v-col cols="12">
<participant-select
v-model="local_commander"
label="Optional: Incident Commander"
hint="If not entered, the current on-call will be assigned."
clearable
:project="project"
name="Optional: Incident Commander"
:rules="[only_one]"
/>
</v-col>
</v-row>
</v-card-text>
<v-card-actions>
Expand Down Expand Up @@ -105,6 +116,7 @@ import IncidentPrioritySelect from "@/incident/priority/IncidentPrioritySelect.v
import IncidentTypeSelect from "@/incident/type/IncidentTypeSelect.vue"
import ProjectSelect from "@/project/ProjectSelect.vue"
import TagFilterAutoComplete from "@/tag/TagFilterAutoComplete.vue"
import ParticipantSelect from "@/components/ParticipantSelect.vue"
export default {
setup() {
Expand All @@ -119,20 +131,28 @@ export default {
IncidentPrioritySelect,
ProjectSelect,
TagFilterAutoComplete,
ParticipantSelect,
},
data() {
return {
isSubmitted: false,
project_faq: null,
local_commander: null,
only_one: (value) => {
if (value && value.length > 1) {
return "Only one is allowed"
}
return true
},
}
},
computed: {
...mapFields("incident", [
"selected.incident_priority",
"selected.incident_type",
"selected.commander",
"selected.commander_email",
"selected.title",
"selected.tags",
"selected.description",
Expand Down Expand Up @@ -248,16 +268,19 @@ export default {
vm.incident_type,
vm.title,
vm.description,
vm.local_commander,
vm.tags,
],
() => {
if (Array.isArray(this.local_commander)) this.commander_email = this.local_commander[0].individual.email

Check failure on line 275 in src/dispatch/static/dispatch/src/incident/ReportSubmissionCard.vue

View workflow job for this annotation

GitHub Actions / build

Insert `⏎·········`
var queryParams = {
project: this.project ? this.project.name : null,
incident_priority: this.incident_priority ? this.incident_priority.name : null,
incident_type: this.incident_type ? this.incident_type.name : null,
title: this.title,
description: this.description,
tag: this.tags ? this.tags.map((tag) => tag.name) : null,
commander_email: this.commander_email,
}
Object.keys(queryParams).forEach((key) => (queryParams[key] ? {} : delete queryParams[key]))
router
Expand Down

0 comments on commit e4c029d

Please sign in to comment.