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

bugfix(case/ui): some escalate dialog resources never exit load state #5021

Merged
merged 1 commit into from
Jul 26, 2024
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
25 changes: 24 additions & 1 deletion src/dispatch/static/dispatch/src/case/EscalateDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ export default {
name: "CaseEscalateDialog",

data() {
return {}
return {
isIncidentDataLoaded: false,
}
},

components: {
Expand Down Expand Up @@ -83,6 +85,27 @@ export default {
methods: {
...mapActions("case_management", ["getDetails", "closeEscalateDialog", "escalate"]),
...mapActions("incident", ["report", "resetSelected"]),

async handleEscalate(incident) {
try {
this.loading = true
const incidentData = await this.escalate(incident)
this.$store.commit("incident/SET_SELECTED", incidentData)
this.isIncidentDataLoaded = true
} catch (error) {
console.error("Error escalating case:", error)
this.$store.commit(
"notification_backend/addBeNotification",
{
text: `Failed to escalate case.`,
type: "exception",
},
{ root: true }
)
} finally {
this.loading = false
}
},
},

created() {
Expand Down
19 changes: 10 additions & 9 deletions src/dispatch/static/dispatch/src/case/store.js
Original file line number Diff line number Diff line change
Expand Up @@ -240,16 +240,17 @@ const actions = {
return CaseApi.escalate(state.selected.id, payload).then((response) => {
commit("incident/SET_SELECTED", response.data, { root: true })
commit("SET_SELECTED_LOADING", false)
var interval = setInterval(function () {
if (state.selected.id) {
dispatch("incident/get", response.data.id, { root: true })
}

// TODO this is fragile but we don't set anything as "created"
if (state.selected.storage) {
clearInterval(interval)
}
}, 5000)
return new Promise((resolve) => {
const interval = setInterval(() => {
dispatch("incident/get", response.data.id, { root: true }).then((incidentData) => {
if (incidentData.conversation && incidentData.storage && incidentData.documents) {
clearInterval(interval)
resolve(incidentData)
}
})
}, 5000)
})
})
},
report({ commit, dispatch }) {
Expand Down
Loading