Skip to content
Snippets Groups Projects
Commit dfd569c6 authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Merge branch 'status-load-process' into 'master'

Ensure the process is properly loaded when showing its status page

See merge request !1052
parents d7e66eec b869ca25
No related branches found
No related tags found
1 merge request!1052Ensure the process is properly loaded when showing its status page
......@@ -127,16 +127,6 @@ export default {
...mapActions('process', ['retrieveProcess']),
...mapMutations('process', ['setProcesses']),
...mapMutations('notifications', ['notify']),
async loadProcess () {
this.loading = true
try {
await this.retrieveProcess(this.id)
} catch (e) {
if (!e.response || e.response.status !== 404) this.error = errorParser(e)
} finally {
this.loading = false
}
},
async retry () {
try {
await this.$store.dispatch('process/retryProcess', this.process.id)
......@@ -204,11 +194,25 @@ export default {
}
},
watch: {
id: {
immediate: true,
async handler (newValue) {
if (newValue === this.process?.id && this.process._complete) return
this.loading = true
try {
await this.retrieveProcess(this.id)
} catch (e) {
if (!e.response || e.response.status !== 404) this.error = errorParser(e)
} finally {
this.loading = false
}
}
},
initialTasks (tasks) {
/*
* Inspect the status of the first tasks to deduce when the activity state is ready for this process.
* This is useful when a worker process is still in a "pending" state to avoid flooding the backend
* because we know the first tasks are waiting activities to be initialized.
* because we know the first tasks are waiting for activities to be initialized.
*/
if (this.process.activity_state !== this.PENDING_ACTIVITY_STATE) return
if (tasks.length && tasks.every(task => task.state.toLowerCase() === PROCESS_STATES.completed.toLowerCase())) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment