Merge remote-tracking branch 'origin/4.15' into main

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

 Conflicts:
	ui/src/utils/plugins.js
	ui/src/views/AutogenView.vue
	ui/tests/mockData/ActionButton.mock.json
	ui/tests/unit/views/compute/MigrateWizard.spec.js
diff --git a/ui/src/components/view/ActionButton.vue b/ui/src/components/view/ActionButton.vue
index f919f4c..5202cc6 100644
--- a/ui/src/components/view/ActionButton.vue
+++ b/ui/src/components/view/ActionButton.vue
@@ -145,7 +145,6 @@
       this.actionBadge = {}
       const arrAsync = []
       const actionBadge = this.actions.filter(action => action.showBadge === true)
-      if ((actionBadge.dataView ? actionBadge.dataView : false) !== this.dataView) return
 
       if (actionBadge && actionBadge.length > 0) {
         const dataLength = actionBadge.length
diff --git a/ui/src/utils/plugins.js b/ui/src/utils/plugins.js
index 946a13a..6416389 100644
--- a/ui/src/utils/plugins.js
+++ b/ui/src/utils/plugins.js
@@ -66,7 +66,7 @@
         status: 'progress'
       })
 
-      options.originalPage = options.originalPage ? options.originalPage : this.$router.currentRoute.path
+      options.originalPage = options.originalPage || this.$router.currentRoute.path
       api('queryAsyncJobResult', { jobId }).then(json => {
         const result = json.queryasyncjobresultresponse
         if (result.jobstatus === 1) {
@@ -92,7 +92,7 @@
 
           // Ensure we refresh on the same / parent page
           const currentPage = this.$router.currentRoute.path
-          const samePage = originalPage === currentPage || originalPage.startsWith(currentPage + '/')
+          const samePage = options.originalPage === currentPage || options.originalPage.startsWith(currentPage + '/')
           if (samePage && (!action || !('isFetchData' in action) || (action.isFetchData))) {
             eventBus.$emit('async-job-complete')
           }
diff --git a/ui/src/views/AutogenView.vue b/ui/src/views/AutogenView.vue
index f1cf48b..0ddf530 100644
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@ -1177,19 +1177,18 @@
               message = message + ' - ' + this.$t(action.successMessage)
               duration = 5
             }
-            this.$message.success({
-              content: message,
-              key: action.label + resourceName,
-              duration: duration
-            })
+            break
           }
-          break
         }
-      }
-      if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
-        this.$store.dispatch('UpdateConfiguration')
-      }
-      return false
+        if (['addLdapConfiguration', 'deleteLdapConfiguration'].includes(action.api)) {
+          this.$store.dispatch('UpdateConfiguration')
+        }
+        if (jobId) {
+          return resolve(this.pollActionCompletion(jobId, action, resourceName, showLoading))
+        }
+
+        return resolve(false)
+      })
     },
     execSubmit (e) {
       e.preventDefault()
diff --git a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
index b51e976..3a086d1 100644
--- a/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
+++ b/ui/src/views/infra/zone/ZoneWizardLaunchZone.vue
@@ -326,7 +326,7 @@
       params.dns1 = this.prefillContent.ipv4Dns1.value
       params.dns2 = this.prefillContent.ipv4Dns2 ? this.prefillContent.ipv4Dns2.value : null
       params.ip6dns1 = this.prefillContent.ipv6Dns1 ? this.prefillContent.ipv6Dns1.value : null
-      params.ip6dns2 = this.prefillContent.ipv6Dns1 ? this.prefillContent.ipv6Dns1.value : null
+      params.ip6dns2 = this.prefillContent.ipv6Dns2 ? this.prefillContent.ipv6Dns2.value : null
       params.internaldns1 = this.prefillContent.internalDns1 ? this.prefillContent.internalDns1.value : null
       params.internaldns2 = this.prefillContent.internalDns2 ? this.prefillContent.internalDns2.value : null
       params.domain = this.prefillContent.networkDomain ? this.prefillContent.networkDomain.value : null
diff --git a/ui/tests/mockData/ActionButton.mock.json b/ui/tests/mockData/ActionButton.mock.json
index 7c073d3..1135844 100644
--- a/ui/tests/mockData/ActionButton.mock.json
+++ b/ui/tests/mockData/ActionButton.mock.json
@@ -33,4 +33,4 @@
       }
     }
   ]
-}
\ No newline at end of file
+}
diff --git a/ui/tests/unit/views/AutogenView.spec.js b/ui/tests/unit/views/AutogenView.spec.js
index 8823894..a866aae 100644
--- a/ui/tests/unit/views/AutogenView.spec.js
+++ b/ui/tests/unit/views/AutogenView.spec.js
@@ -36,9 +36,6 @@
 store = common.createMockStore(state)
 i18n = common.createMockI18n('en', mockData.messages)
 
-const actions = {
-  AddAsyncJob: jest.fn((jobId) => {})
-}
 const spyConsole = {
   log: null,
   warn: null
@@ -2814,8 +2811,8 @@
         }, 1000)
       })
 
-      it('check pollActionCompletion() and action AddAsyncJob is called when api is called and response have jobId result', async (done) => {
-        store = common.createMockStore(state, actions)
+      it('check pollActionCompletion() is called when api is called and response have jobId result', async (done) => {
+        store = common.createMockStore(state)
         wrapper = factory({
           store: store,
           data: {
@@ -2851,14 +2848,13 @@
         wrapper.vm.execSubmit(event)
 
         setTimeout(() => {
-          expect(actions.AddAsyncJob).toHaveBeenCalled()
           expect(spyPollAction).toHaveBeenCalled()
 
           done()
         })
       })
 
-      it('check $notification when api is called and response have not jobId result', async (done) => {
+      it('check $message, fetchData() is called when api response have not jobId result', async (done) => {
         wrapper = factory({
           data: {
             showAction: true,
@@ -2888,6 +2884,7 @@
           }
         }
 
+        const spyFetchData = jest.spyOn(wrapper.vm, 'fetchData')
         mockAxios.mockResolvedValue(mockData)
         spyConsole.log = jest.spyOn(console, 'log').mockImplementation(() => {})
 
@@ -2903,6 +2900,7 @@
             key: 'labelnametest-name-value',
             duration: 2
           })
+          expect(spyFetchData).toHaveBeenCalled()
 
           done()
         })
diff --git a/ui/tests/unit/views/compute/MigrateWizard.spec.js b/ui/tests/unit/views/compute/MigrateWizard.spec.js
index eef8722..333a7d4 100644
--- a/ui/tests/unit/views/compute/MigrateWizard.spec.js
+++ b/ui/tests/unit/views/compute/MigrateWizard.spec.js
@@ -25,9 +25,6 @@
 let wrapper, i18n, store, mocks, router
 
 const state = {}
-const actions = {
-  AddAsyncJob: jest.fn((jobObject) => {})
-}
 mocks = {
   $message: {
     error: jest.fn((message) => {})
@@ -56,7 +53,7 @@
   })
 }
 i18n = common.createMockI18n('en', mockData.messages)
-store = common.createMockStore(state, actions)
+store = common.createMockStore(state)
 
 const factory = (opts = {}) => {
   i18n = opts.i18n || i18n
@@ -564,7 +561,6 @@
         await wrapper.vm.submitForm()
 
         setTimeout(() => {
-          expect(actions.AddAsyncJob).toHaveBeenCalled()
           expect(mocks.$pollJob).toHaveBeenCalled()
           expect(wrapper.emitted()['close-action'][0]).toEqual([])
 
@@ -572,7 +568,7 @@
         })
       })
 
-      it('check store dispatch `AddAsyncJob` and $pollJob have successMethod() is called with requiresStorageMotion is false', async (done) => {
+      it('check $pollJob have successMethod() is called with requiresStorageMotion is false', async (done) => {
         const mockData = {
           migratevirtualmachineresponse: {
             jobid: 'test-job-id-case-2'
@@ -670,7 +666,6 @@
         await wrapper.vm.submitForm()
 
         setTimeout(() => {
-          expect(actions.AddAsyncJob).toHaveBeenCalled()
           expect(mocks.$pollJob).toHaveBeenCalled()
           expect(wrapper.emitted()['close-action'][0]).toEqual([])
 
@@ -678,7 +673,7 @@
         })
       })
 
-      it('check store dispatch `AddAsyncJob` and $pollJob have errorMethod() is called', async (done) => {
+      it('check $pollJob have errorMethod() is called', async (done) => {
         const mockData = {
           migratesystemvmresponse: {
             jobid: 'test-job-id-case-3'
@@ -713,7 +708,6 @@
         await wrapper.vm.submitForm()
 
         setTimeout(() => {
-          expect(actions.AddAsyncJob).toHaveBeenCalled()
           expect(mocks.$pollJob).toHaveBeenCalled()
           expect(wrapper.emitted()['close-action'][0]).toEqual([])
 
@@ -721,7 +715,7 @@
         })
       })
 
-      it('check store dispatch `AddAsyncJob` and $pollJob have catchMethod() is called', async (done) => {
+      it('check $pollJob have catchMethod() is called', async (done) => {
         const mockData = {
           migratesystemvmresponse: {
             jobid: 'test-job-id-case-4'
@@ -750,7 +744,6 @@
         await wrapper.vm.submitForm()
 
         setTimeout(() => {
-          expect(actions.AddAsyncJob).toHaveBeenCalled()
           expect(mocks.$pollJob).toHaveBeenCalled()
           expect(wrapper.emitted()['close-action'][0]).toEqual([])