From 2d7107557b4ecbb802ad27627e5d4e37cdc1e503 Mon Sep 17 00:00:00 2001 From: nvazquez Date: Tue, 2 Aug 2022 01:51:02 -0300 Subject: [PATCH 1/3] UI: Fix delete ISO navigation after job is finished --- ui/src/views/image/IsoZones.vue | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue index 7ca07ebb4bee..7fd752e570a9 100644 --- a/ui/src/views/image/IsoZones.vue +++ b/ui/src/views/image/IsoZones.vue @@ -379,7 +379,7 @@ export default { successMethod: result => { if (singleZone) { if (this.selectedItems.length === 0) { - this.$router.go(-1) + this.$router.push({ path: '/iso' }) } } else { if (this.selectedItems.length === 0) { @@ -388,6 +388,9 @@ export default { } if (this.selectedItems.length > 0) { eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: record.zoneid, state: 'success' }) + if (this.selectedItems.length === this.zones.length) { + this.$router.push({ path: '/iso' }) + } } }, errorMethod: () => { From 2e493967b8e35f6243b964feebf7b6b61be24de0 Mon Sep 17 00:00:00 2001 From: nvazquez Date: Tue, 2 Aug 2022 09:43:46 -0300 Subject: [PATCH 2/3] Apply suggestion --- ui/src/views/image/IsoZones.vue | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue index 7fd752e570a9..74f4e39add44 100644 --- a/ui/src/views/image/IsoZones.vue +++ b/ui/src/views/image/IsoZones.vue @@ -340,6 +340,13 @@ export default { this.selectedRowKeys = [] this.fetchData() if (this.dataSource.length === 0) { + this.moveToPreviousView() + } + }, + async moveToPreviousView () { + const lastPath = this.$router.currentRoute.value.fullPath + const navigationResult = await this.$router.go(-1) + if (navigationResult !== undefined || this.$router.currentRoute.value.fullPath === lastPath) { this.$router.go(-1) } }, @@ -379,7 +386,7 @@ export default { successMethod: result => { if (singleZone) { if (this.selectedItems.length === 0) { - this.$router.push({ path: '/iso' }) + this.moveToPreviousView() } } else { if (this.selectedItems.length === 0) { @@ -389,7 +396,7 @@ export default { if (this.selectedItems.length > 0) { eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: record.zoneid, state: 'success' }) if (this.selectedItems.length === this.zones.length) { - this.$router.push({ path: '/iso' }) + this.moveToPreviousView() } } }, From 5bf07ee90547a7e838f76a5d15941375877214df Mon Sep 17 00:00:00 2001 From: nvazquez Date: Tue, 2 Aug 2022 23:20:37 -0300 Subject: [PATCH 3/3] Fix redirection --- ui/src/views/image/IsoZones.vue | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue index 74f4e39add44..8c9df643542d 100644 --- a/ui/src/views/image/IsoZones.vue +++ b/ui/src/views/image/IsoZones.vue @@ -206,6 +206,7 @@ export default { selectedColumns: [], filterColumns: ['Status', 'Ready'], showConfirmationAction: false, + redirectOnFinish: true, message: { title: this.$t('label.action.bulk.delete.isos'), confirmMessage: this.$t('label.confirm.delete.isos') @@ -341,6 +342,7 @@ export default { this.fetchData() if (this.dataSource.length === 0) { this.moveToPreviousView() + this.redirectOnFinish = false } }, async moveToPreviousView () { @@ -379,13 +381,14 @@ export default { const jobId = json.deleteisoresponse.jobid eventBus.emit('update-job-details', { jobId, resourceId: null }) const singleZone = (this.dataSource.length === 1) + this.redirectOnFinish = true this.$pollJob({ jobId, title: this.$t('label.action.delete.iso'), description: this.resource.name, successMethod: result => { if (singleZone) { - if (this.selectedItems.length === 0) { + if (this.selectedItems.length === 0 && this.redirectOnFinish) { this.moveToPreviousView() } } else { @@ -395,7 +398,7 @@ export default { } if (this.selectedItems.length > 0) { eventBus.emit('update-resource-state', { selectedItems: this.selectedItems, resource: record.zoneid, state: 'success' }) - if (this.selectedItems.length === this.zones.length) { + if (this.selectedItems.length === this.zones.length && this.redirectOnFinish) { this.moveToPreviousView() } }