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

Adds FAQ document link to incident submission form #1448

Merged
merged 1 commit into from
Jul 16, 2021
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
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const getDefaultSelectedState = () => {

export const referenceDocumentTypes = [
{
resource_type: "dispatch-faq-reference-document",
resource_type: "",
title: "FAQ",
description: "Create a new FAQ reference document",
icon: "mdi-file-document-edit-outline",
Expand Down
34 changes: 0 additions & 34 deletions src/dispatch/static/dispatch/src/incident/ReportReceiptCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,17 +189,6 @@
<v-divider />
</span>
</span>
<v-list-item v-if="incident_faq" :href="incident_faq.weblink" target="_blank">
<v-list-item-content>
<v-list-item-title>Incident FAQ</v-list-item-title>
<v-list-item-subtitle>{{ incident_faq.description }}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-list-item-icon>
<v-icon>open_in_new</v-icon>
</v-list-item-icon>
</v-list-item-action>
</v-list-item>
</v-list-group>
</v-list>
<v-container grid-list-md>
Expand All @@ -215,7 +204,6 @@
import { mapFields } from "vuex-map-fields"
import { mapActions } from "vuex"
import { forEach, find } from "lodash"
import DocumentApi from "@/document/api"
import PluginApi from "@/plugin/api"

export default {
Expand All @@ -225,7 +213,6 @@ export default {
data() {
return {
isSubmitted: false,
incident_faq: null,
activeResourcePlugins: {
document: null,
ticket: null,
Expand All @@ -236,27 +223,6 @@ export default {
}
},
created() {
DocumentApi.getAll({
filter: JSON.stringify({
and: [
{
field: "resource_type",
op: "==",
value: "dispatch-incident-faq",
},
{
model: "Project",
field: "name",
op: "==",
value: this.project.name,
},
],
}),
}).then((response) => {
if (response.data.items.length) {
this.incident_faq = response.data.items[0]
}
})
PluginApi.getAllInstances({
itemsPerPage: -1,
filter: JSON.stringify({
Expand Down
40 changes: 40 additions & 0 deletions src/dispatch/static/dispatch/src/incident/ReportSubmissionCard.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@
If you suspect an incident and require help, please fill out the following to the best of
your abilities.
</p>
<p v-if="project_faq">
Unsure if your in the right place or have additional questions? Checkout this project's
incident FAQ document:
<a :href="project_faq.weblink" target="_blank" style="text-decoration: none">
{{ project_faq.name }}
<v-icon small>open_in_new</v-icon>
</a>
</p>
<v-form>
<v-container grid-list-md>
<v-layout wrap>
Expand Down Expand Up @@ -101,6 +109,7 @@ import { required } from "vee-validate/dist/rules"
import IncidentTypeSelect from "@/incident_type/IncidentTypeSelect.vue"
import IncidentPrioritySelect from "@/incident_priority/IncidentPrioritySelect.vue"
import ProjectSelect from "@/project/ProjectSelect.vue"
import DocumentApi from "@/document/api"
import TagFilterCombobox from "@/tag/TagFilterCombobox.vue"

extend("required", {
Expand All @@ -122,6 +131,7 @@ export default {
data() {
return {
isSubmitted: false,
project_faq: null,
}
},
computed: {
Expand All @@ -147,6 +157,29 @@ export default {
},

methods: {
getFAQ() {
DocumentApi.getAll({
filter: JSON.stringify({
and: [
{
field: "resource_type",
op: "==",
value: "dispatch-faq-reference-document",
},
{
model: "Project",
field: "name",
op: "==",
value: this.project.name,
},
],
}),
}).then((response) => {
if (response.data.items.length) {
this.project_faq = response.data.items[0]
}
})
},
...mapActions("incident", ["report", "get", "resetSelected"]),
},

Expand All @@ -163,6 +196,13 @@ export default {
this.incident_priority = { name: this.query.incident_priority }
}

this.$watch(
(vm) => [vm.project],
() => {
this.getFAQ()
}
)

if (this.query.tag) {
if (Array.isArray(this.query.tag)) {
this.tags = this.query.tag.map(function (t) {
Expand Down