Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows for an incident commander to be specified when reporting an incident #4101

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,20 @@ 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
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
Loading