Skip to content

Commit 7d50b65

Browse files
authored
UI: Fix delete ISO navigation after job is finished (#6598)
* UI: Fix delete ISO navigation after job is finished * Apply suggestion * Fix redirection
1 parent 3220efe commit 7d50b65

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

ui/src/views/image/IsoZones.vue

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,7 @@ export default {
206206
selectedColumns: [],
207207
filterColumns: ['Status', 'Ready'],
208208
showConfirmationAction: false,
209+
redirectOnFinish: true,
209210
message: {
210211
title: this.$t('label.action.bulk.delete.isos'),
211212
confirmMessage: this.$t('label.confirm.delete.isos')
@@ -340,6 +341,14 @@ export default {
340341
this.selectedRowKeys = []
341342
this.fetchData()
342343
if (this.dataSource.length === 0) {
344+
this.moveToPreviousView()
345+
this.redirectOnFinish = false
346+
}
347+
},
348+
async moveToPreviousView () {
349+
const lastPath = this.$router.currentRoute.value.fullPath
350+
const navigationResult = await this.$router.go(-1)
351+
if (navigationResult !== undefined || this.$router.currentRoute.value.fullPath === lastPath) {
343352
this.$router.go(-1)
344353
}
345354
},
@@ -372,14 +381,15 @@ export default {
372381
const jobId = json.deleteisoresponse.jobid
373382
eventBus.emit('update-job-details', { jobId, resourceId: null })
374383
const singleZone = (this.dataSource.length === 1)
384+
this.redirectOnFinish = true
375385
this.$pollJob({
376386
jobId,
377387
title: this.$t('label.action.delete.iso'),
378388
description: this.resource.name,
379389
successMethod: result => {
380390
if (singleZone) {
381-
if (this.selectedItems.length === 0) {
382-
this.$router.go(-1)
391+
if (this.selectedItems.length === 0 && this.redirectOnFinish) {
392+
this.moveToPreviousView()
383393
}
384394
} else {
385395
if (this.selectedItems.length === 0) {
@@ -388,6 +398,9 @@ export default {
388398
}
389399
if (this.selectedItems.length > 0) {
390400
eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: record.zoneid, state: 'success' })
401+
if (this.selectedItems.length === this.zones.length && this.redirectOnFinish) {
402+
this.moveToPreviousView()
403+
}
391404
}
392405
},
393406
errorMethod: () => {

0 commit comments

Comments
 (0)