You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ro...@apache.org on 2020/08/31 07:56:50 UTC

[cloudstack-primate] branch master updated: compute: Fixing expunge only when allowuserexpungerecovervm is true (#636)

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 8e7250a  compute: Fixing expunge only when allowuserexpungerecovervm is true (#636)
8e7250a is described below

commit 8e7250ac90436649379e495e0d5423e11c5a9bac
Author: davidjumani <dj...@gmail.com>
AuthorDate: Mon Aug 31 13:26:44 2020 +0530

    compute: Fixing expunge only when allowuserexpungerecovervm is true (#636)
    
    Fixes #635
---
 src/config/section/compute.js                      | 7 +++++--
 src/config/section/storage.js                      | 3 ++-
 src/views/compute/{DestoryVM.vue => DestroyVM.vue} | 2 +-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/src/config/section/compute.js b/src/config/section/compute.js
index 03d68b1..e411538 100644
--- a/src/config/section/compute.js
+++ b/src/config/section/compute.js
@@ -387,11 +387,14 @@ export default {
           docHelp: 'adminguide/virtual_machines.html#deleting-vms',
           dataView: true,
           groupAction: true,
-          args: ['expunge'],
+          args: (record, store, group) => {
+            return (['Admin'].includes(store.userInfo.roletype) || store.features.allowuserexpungerecovervm)
+              ? ['expunge'] : []
+          },
           popup: true,
           groupMap: (selection, values) => { return selection.map(x => { return { id: x, expunge: values.expunge } }) },
           show: (record) => { return ['Running', 'Stopped', 'Error'].includes(record.state) },
-          component: () => import('@/views/compute/DestoryVM.vue')
+          component: () => import('@/views/compute/DestroyVM.vue')
         }
       ]
     },
diff --git a/src/config/section/storage.js b/src/config/section/storage.js
index 73337f1..7949061 100644
--- a/src/config/section/storage.js
+++ b/src/config/section/storage.js
@@ -237,7 +237,8 @@ export default {
           message: 'message.action.destroy.volume',
           dataView: true,
           args: (record, store) => {
-            return (!['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) && !store.features.allowuserexpungerecovervolumestore) ? [] : ['expunge']
+            return (['Admin'].includes(store.userInfo.roletype) || store.features.allowuserexpungerecovervolume)
+              ? ['expunge'] : []
           },
           show: (record, store) => {
             return !['Destroy', 'Destroyed', 'Expunging', 'Expunged', 'Migrating', 'Uploading', 'UploadError', 'Creating', 'Allocated', 'Uploaded'].includes(record.state) &&
diff --git a/src/views/compute/DestoryVM.vue b/src/views/compute/DestroyVM.vue
similarity index 97%
rename from src/views/compute/DestoryVM.vue
rename to src/views/compute/DestroyVM.vue
index 56d2b23..754bf81 100644
--- a/src/views/compute/DestoryVM.vue
+++ b/src/views/compute/DestroyVM.vue
@@ -23,7 +23,7 @@
         :form="form"
         @submit="handleSubmit"
         layout="vertical">
-        <a-form-item>
+        <a-form-item v-if="$store.getters.userInfo.roletype === 'Admin' || $store.getters.features.allowuserexpungerecovervm">
           <span slot="label">
             {{ $t('label.expunge') }}
             <a-tooltip placement="bottom" :title="apiParams.expunge.description">