Skip to content

Commit

Permalink
Adds routing to an incident's forms tab. (#4376)
Browse files Browse the repository at this point in the history
  • Loading branch information
metroid-samus authored Feb 10, 2024
1 parent 482f7e0 commit acd7ca1
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 8 deletions.
5 changes: 4 additions & 1 deletion src/dispatch/static/dispatch/src/incident/EditSheet.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,11 @@ export default {
$route: {
immediate: true,
handler(newVal) {
if (newVal.meta && newVal.meta.showTimeline) {
if (!newVal.meta) return
if (newVal.meta.showTimeline) {
this.tab = 3
} else if (newVal.meta.showForms) {
this.tab = 6
}
},
},
Expand Down
20 changes: 13 additions & 7 deletions src/dispatch/static/dispatch/src/incident/FormsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ export default {
"project_id",
"table.options.filters",
]),
...mapFields("incident", { selected_incident: "selected" }),
...mapFields("incident", { selected_incident: "selected", project: "selected.project" }),
},
methods: {
...mapActions("forms", ["getAll", "createShow", "editShow", "showDeleteDialog"]),
Expand All @@ -123,17 +123,23 @@ export default {
},
}
},
getFormsData() {
if (this.selected_incident) {
this.incident_id = this.selected_incident.id
}
if (this.project) {
this.project_id = this.project.id
}
this.getAll()
},
},
created() {
this.project_id = this.selected_incident.project.id
this.incident_id = this.selected_incident.id
this.getAll()
this.getFormsData()
this.$watch(
(vm) => [vm.project, vm.selected_incident],
(vm) => [vm.project, vm.selected_incident, vm.project],
() => {
this.getAll()
this.getFormsData()
}
)
},
Expand Down
10 changes: 10 additions & 0 deletions src/dispatch/static/dispatch/src/router/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,16 @@ export const protectedRoute = [
showTimeline: true,
},
},
{
path: "/:organization/incidents/:name/forms",
name: "IncidentTableEditForms",
component: () => import("@/incident/EditSheet.vue"),
props: true,
meta: {
showEditSheet: true,
showForms: true,
},
},
],
},
],
Expand Down

0 comments on commit acd7ca1

Please sign in to comment.