cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ro...@apache.org
Subject [cloudstack-primate] branch master updated: src: cleanup unused utility
Date Thu, 19 Dec 2019 03:00:14 GMT
This is an automated email from the ASF dual-hosted git repository.

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


The following commit(s) were added to refs/heads/master by this push:
     new 5c41b27  src: cleanup unused utility
5c41b27 is described below

commit 5c41b27a7b686f2f79211fa8308ce2da9284b1c7
Author: Rohit Yadav <rohit.yadav@shapeblue.com>
AuthorDate: Thu Dec 19 08:29:34 2019 +0530

    src: cleanup unused utility
    
    This cleans up and uses the global `$pollJob()`.
    
    Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
---
 src/utils/methods.js                | 60 -------------------------------------
 src/views/compute/MigrateWizard.vue |  3 +-
 2 files changed, 1 insertion(+), 62 deletions(-)

diff --git a/src/utils/methods.js b/src/utils/methods.js
deleted file mode 100644
index 460efb0..0000000
--- a/src/utils/methods.js
+++ /dev/null
@@ -1,60 +0,0 @@
-// Licensed to the Apache Software Foundation (ASF) under one
-// or more contributor license agreements.  See the NOTICE file
-// distributed with this work for additional information
-// regarding copyright ownership.  The ASF licenses this file
-// to you under the Apache License, Version 2.0 (the
-// "License"); you may not use this file except in compliance
-// with the License.  You may obtain a copy of the License at
-//
-//   http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing,
-// software distributed under the License is distributed on an
-// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-// KIND, either express or implied.  See the License for the
-// specific language governing permissions and limitations
-// under the License.
-
-import { api } from '@/api'
-import { message, notification } from 'ant-design-vue'
-
-/**
- * Reusable queryAsyncJobResult method
- * @param {String} jobId
- * @param {String} successMessage
- * @param {Function} successMethod
- * @param {String} errorMessage
- * @param {Function} errorMethod
- * @param {String} loadingMessage
- * @param {String} catchMessage
- * @param {Function} catchMethod
- * @param {Number} loadingDuration
- */
-export const pollActionCompletion = ({
-  jobId, successMessage, successMethod, errorMessage, errorMethod, loadingMessage, catchMessage,
catchMethod, loadingDuration = 3
-}) => {
-  function runApi () {
-    api('queryAsyncJobResult', { jobId }).then(json => {
-      const result = json.queryasyncjobresultresponse
-
-      if (result.jobstatus === 1) {
-        message.success(successMessage || 'Success')
-        successMethod && successMethod()
-      } else if (result.jobstatus === 2) {
-        notification.error({
-          message: errorMessage || 'Error',
-          description: result.jobresult.errortext || 'Error'
-        })
-        errorMethod && errorMethod()
-      } else if (result.jobstatus === 0) {
-        message
-          .loading(loadingMessage, loadingDuration)
-          .then(() => runApi())
-      }
-    }).catch(e => {
-      console.error(`${catchMessage} - ${e}`)
-      catchMethod && catchMethod()
-    })
-  }
-  runApi()
-}
diff --git a/src/views/compute/MigrateWizard.vue b/src/views/compute/MigrateWizard.vue
index 80417e9..27f0c13 100644
--- a/src/views/compute/MigrateWizard.vue
+++ b/src/views/compute/MigrateWizard.vue
@@ -74,7 +74,6 @@
 
 <script>
 import { api } from '@/api'
-import { pollActionCompletion } from '@/utils/methods'
 
 export default {
   name: 'VMMigrateWizard',
@@ -123,7 +122,7 @@ export default {
           description: this.resource.name,
           status: 'progress'
         })
-        pollActionCompletion({
+        this.$pollJob({
           jobId: response.migratevirtualmachineresponse.jobid,
           successMessage: `Migration completed successfully for ${this.resource.name}`,
           successMethod: () => {


Mime
View raw message