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

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

commit db31e67d5100f6fa2a55366cb38fe8e4ee784623
Merge: 61fd402 1ccd61c
Author: Rohit Yadav <rohit.ya...@shapeblue.com>
AuthorDate: Fri Jul 30 15:00:09 2021 +0530

    Merge remote-tracking branch 'origin/4.15' into main
    
    Signed-off-by: Rohit Yadav <rohit.ya...@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

 ui/src/components/view/ActionButton.vue           |  1 -
 ui/src/utils/plugins.js                           |  4 ++--
 ui/src/views/AutogenView.vue                      | 21 ++++++++++-----------
 ui/src/views/infra/zone/ZoneWizardLaunchZone.vue  |  2 +-
 ui/tests/mockData/ActionButton.mock.json          |  2 +-
 ui/tests/unit/views/AutogenView.spec.js           | 12 +++++-------
 ui/tests/unit/views/compute/MigrateWizard.spec.js | 15 ++++-----------
 7 files changed, 23 insertions(+), 34 deletions(-)

diff --cc ui/src/views/AutogenView.vue
index f1cf48b,a1fb569..0ddf530
--- a/ui/src/views/AutogenView.vue
+++ b/ui/src/views/AutogenView.vue
@@@ -1149,47 -948,39 +1149,46 @@@ export default 
          })
        })
      },
 -    handleResponse (response, resourceName, action, showLoading = true) {
 -      return new Promise(resolve => {
 -        let jobId = null
 -        for (const obj in response) {
 -          if (obj.includes('response')) {
 -            if (response[obj].jobid) {
 -              jobId = response[obj].jobid
 -            } else {
 -              var message = action.successMessage ? 
this.$t(action.successMessage) : this.$t(action.label) +
 -                (resourceName ? ' - ' + resourceName : '')
 -              var duration = 2
 -              if (action.additionalMessage) {
 -                message = message + ' - ' + this.$t(action.successMessage)
 -                duration = 5
 +    getDataIdentifier (params) {
 +      var dataIdentifier = ''
 +      dataIdentifier = params.id || params.username || params.name || 
params.vmsnapshotid || params.ids
 +      return dataIdentifier
 +    },
 +    handleResponse (response, resourceName, resource, action, showLoading = 
true) {
 +      for (const obj in response) {
 +        if (obj.includes('response')) {
 +          if (response[obj].jobid) {
 +            return new Promise(resolve => {
 +              const jobid = response[obj].jobid
 +              eventBus.$emit('update-resource-state', this.selectedItems, 
resource, 'InProgress', jobid)
 +              resolve(this.pollActionCompletion(jobid, action, resourceName, 
resource, showLoading))
 +            })
 +          } else {
 +            if (this.selectedItems.length > 0) {
 +              eventBus.$emit('update-resource-state', this.selectedItems, 
resource, 'success')
 +              if (resource) {
 +                this.selectedItems.filter(item => item === resource)
                }
 -              this.$message.success({
 -                content: message,
 -                key: action.label + resourceName,
 -                duration: duration
 -              })
 +            }
 +            var message = action.successMessage ? 
this.$t(action.successMessage) : this.$t(action.label) +
 +              (resourceName ? ' - ' + resourceName : '')
 +            var duration = 2
 +            if (action.additionalMessage) {
 +              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 --cc ui/tests/mockData/ActionButton.mock.json
index 7c073d3,85ff8f1..1135844
--- a/ui/tests/mockData/ActionButton.mock.json
+++ b/ui/tests/mockData/ActionButton.mock.json
@@@ -33,4 -33,4 +33,4 @@@
        }
      }
    ]
--}
++}
diff --cc ui/tests/unit/views/compute/MigrateWizard.spec.js
index eef8722,210bf1c..333a7d4
--- a/ui/tests/unit/views/compute/MigrateWizard.spec.js
+++ b/ui/tests/unit/views/compute/MigrateWizard.spec.js
@@@ -22,12 -22,9 +22,9 @@@ import mockData from '../../../mockData
  
  jest.mock('axios', () => mockAxios)
  
 -let wrapper, i18n, store, mocks
 +let wrapper, i18n, store, mocks, router
  
  const state = {}
- const actions = {
-   AddAsyncJob: jest.fn((jobObject) => {})
- }
  mocks = {
    $message: {
      error: jest.fn((message) => {})
@@@ -678,9 -515,9 +673,9 @@@ describe('Views > compute > MigrateWiza
          })
        })
  
-       it('check store dispatch `AddAsyncJob` and $pollJob have errorMethod() 
is called', async (done) => {
+       it('check $pollJob have errorMethod() is called', async (done) => {
          const mockData = {
 -          migratevirtualmachinewithvolumeresponse: {
 +          migratesystemvmresponse: {
              jobid: 'test-job-id-case-3'
            },
            queryasyncjobresultresponse: {
@@@ -721,9 -557,9 +715,9 @@@
          })
        })
  
-       it('check store dispatch `AddAsyncJob` and $pollJob have catchMethod() 
is called', async (done) => {
+       it('check $pollJob have catchMethod() is called', async (done) => {
          const mockData = {
 -          migratevirtualmachinewithvolumeresponse: {
 +          migratesystemvmresponse: {
              jobid: 'test-job-id-case-4'
            }
          }

Reply via email to