Skip to content

Commit

Permalink
Adds support for handing off cases in bulk (#2985)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvilanova authored Feb 13, 2023
1 parent 8a7cc38 commit 24fdb20
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 11 deletions.
24 changes: 16 additions & 8 deletions src/dispatch/static/dispatch/src/case/BulkEditSheet.vue
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
<template>
<v-bottom-sheet v-model="showBulkEdit" hide-overlay persistent>
<handoff-dialog />
<v-card :loading="bulkEditLoading" tile>
<v-list>
<v-list-item>
<v-list-item-content>
<v-list-item-subtitle>{{ selected.length }} selected</v-list-item-subtitle>
</v-list-item-content>
<v-spacer />
<v-list-item-icon>
<v-btn text @click="showHandoffDialog()">
<v-icon>mdi-account-arrow-right</v-icon>
Handoff
</v-btn>
</v-list-item-icon>
<v-list-item-icon>
<v-btn text @click="saveBulk({ status: 'New' })">
<v-icon>mdi-alert-decagram</v-icon>
Expand All @@ -19,12 +26,6 @@
Mark Triage
</v-btn>
</v-list-item-icon>
<!--<v-list-item-icon>
<v-btn text @click="saveBulk({ status: 'Escalated' })">
<v-icon>mdi-swap-horizontal</v-icon>
Mark Escalated
</v-btn>
</v-list-item-icon>-->
<v-list-item-icon>
<v-btn text @click="saveBulk({ status: 'Closed' })">
<v-icon>mdi-close</v-icon>
Expand All @@ -47,18 +48,25 @@
import { mapFields } from "vuex-map-fields"
import { mapActions } from "vuex"
import HandoffDialog from "@/case/HandoffDialog.vue"
export default {
name: "CaseBulkEditSheet",
components: {
HandoffDialog,
},
computed: {
...mapFields("case_management", ["table.rows.selected", "table.bulkEditLoading"]),
showBulkEdit: function () {
return this.selected.length ? true : false
},
...mapFields("case_management", ["table.rows.selected", "table.bulkEditLoading"]),
},
methods: {
...mapActions("case_management", ["saveBulk", "deleteBulk"]),
...mapActions("case_management", ["saveBulk", "deleteBulk", "showHandoffDialog"]),
},
}
</script>
54 changes: 54 additions & 0 deletions src/dispatch/static/dispatch/src/case/HandoffDialog.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<v-dialog v-model="showHandoffDialog" persistent max-width="800px">
<v-card>
<v-card-title>
<span class="headline">Handoff Cases</span>
</v-card-title>
<v-card-text>
Select the new assignee for the selected cases.
</v-card-text>
<v-card-actions>
<v-container grid-list-md>
<v-layout wrap>
<v-flex xs12>
<participant-select v-model="assignee" label="Case Assignee" :project="project"/>
</v-flex>
<v-btn color="blue en-1" text @click="closeHandoffDialog()"> Cancel </v-btn>
<v-btn color="red en-1" text :loading="loading" @click="saveBulk({assignee: assignee})">
Handoff
</v-btn>
</v-layout>
</v-container>
</v-card-actions>
</v-card>
</v-dialog>
</template>

<script>
import { mapFields } from "vuex-map-fields"
import { mapActions } from "vuex"
import ParticipantSelect from "@/incident/ParticipantSelect.vue"
export default {
name: "CaseHandoffDialog",
data() {
return {
assignee: { individual: { name: "Assignee Name" }},
}
},
components: {
ParticipantSelect,
},
computed: {
...mapFields("case_management", ["dialogs.showHandoffDialog", "selected.loading", "selected.project"]),
},
methods: {
...mapActions("case_management", ["closeHandoffDialog", "saveBulk", "resetSelected"]),
},
}
</script>
18 changes: 15 additions & 3 deletions src/dispatch/static/dispatch/src/case/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ const getDefaultSelectedState = () => {
escalated_at: null,
events: [],
groups: [],
signals: [],
id: null,
incidents: [],
loading: false,
name: null,
project: null,
related: [],
reported_at: null,
resolution: null,
signals: [],
status: null,
storage: null,
tags: [],
Expand All @@ -34,7 +35,6 @@ const getDefaultSelectedState = () => {
triage_at: null,
visibility: null,
workflow_instances: null,
loading: false,
}
}

Expand All @@ -49,9 +49,10 @@ const state = {
dialogs: {
showDeleteDialog: false,
showEditSheet: false,
showEscalateDialog: false,
showExport: false,
showHandoffDialog: false,
showNewSheet: false,
showEscalateDialog: false,
},
report: {
...getDefaultReportState(),
Expand Down Expand Up @@ -188,6 +189,14 @@ const actions = {
commit("RESET_SELECTED")
commit("incident/RESET_SELECTED", null, { root: true })
},
showHandoffDialog({ commit }, value) {
commit("SET_DIALOG_SHOW_HANDOFF", true)
commit("SET_SELECTED", value)
},
closeHandoffDialog({ commit }) {
commit("SET_DIALOG_SHOW_HANDOFF", false)
commit("RESET_SELECTED")
},
showExport({ commit }) {
commit("SET_DIALOG_SHOW_EXPORT", true)
},
Expand Down Expand Up @@ -333,6 +342,9 @@ const mutations = {
SET_DIALOG_SHOW_EXPORT(state, value) {
state.dialogs.showExport = value
},
SET_DIALOG_SHOW_HANDOFF(state, value) {
state.dialogs.showHandoffDialog = value
},
SET_DIALOG_DELETE(state, value) {
state.dialogs.showDeleteDialog = value
},
Expand Down

0 comments on commit 24fdb20

Please sign in to comment.