You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by sh...@apache.org on 2022/08/03 11:14:38 UTC

[cloudstack] branch 4.17 updated: UI: Fix delete ISO navigation after job is finished (#6598)

This is an automated email from the ASF dual-hosted git repository.

shwstppr pushed a commit to branch 4.17
in repository https://gitbox.apache.org/repos/asf/cloudstack.git


The following commit(s) were added to refs/heads/4.17 by this push:
     new 7d50b65674 UI: Fix delete ISO navigation after job is finished (#6598)
7d50b65674 is described below

commit 7d50b65674c47fb10919a5ae3e9b514688798c21
Author: Nicolas Vazquez <ni...@gmail.com>
AuthorDate: Wed Aug 3 08:14:31 2022 -0300

    UI: Fix delete ISO navigation after job is finished (#6598)
    
    * UI: Fix delete ISO navigation after job is finished
    
    * Apply suggestion
    
    * Fix redirection
---
 ui/src/views/image/IsoZones.vue | 17 +++++++++++++++--
 1 file changed, 15 insertions(+), 2 deletions(-)

diff --git a/ui/src/views/image/IsoZones.vue b/ui/src/views/image/IsoZones.vue
index 7ca07ebb4b..8c9df64354 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')
@@ -340,6 +341,14 @@ export default {
       this.selectedRowKeys = []
       this.fetchData()
       if (this.dataSource.length === 0) {
+        this.moveToPreviousView()
+        this.redirectOnFinish = false
+      }
+    },
+    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)
       }
     },
@@ -372,14 +381,15 @@ 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) {
-                this.$router.go(-1)
+              if (this.selectedItems.length === 0 && this.redirectOnFinish) {
+                this.moveToPreviousView()
               }
             } else {
               if (this.selectedItems.length === 0) {
@@ -388,6 +398,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.redirectOnFinish) {
+                this.moveToPreviousView()
+              }
             }
           },
           errorMethod: () => {