shwstppr commented on a change in pull request #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231#discussion_r410148102
 
 

 ##########
 File path: src/config/section/storage.js
 ##########
 @@ -150,20 +150,45 @@ export default {
           icon: 'picture',
           label: 'Create Template from Volume',
           dataView: true,
-          show: (record) => { return record.type === 'ROOT' },
+          show: (record) => { return record.type === 'ROOT' && record.vmstate 
=== 'Stopped' },
           args: ['volumeid', 'name', 'displaytext', 'ostypeid', 'ispublic', 
'isfeatured', 'isdynamicallyscalable', 'requireshvm', 'passwordenabled', 
'sshkeyenabled'],
           mapping: {
             volumeid: {
               value: (record) => { return record.id }
             }
           }
         },
+        {
+          api: 'recoverVolume',
+          icon: 'medicine-box',
+          label: 'Recover Volume',
+          dataView: true,
+          show: (record, store) => {
+            return (['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) 
|| store.getters.features.allowuserexpungerecovervolume) && record.state === 
'Destroy'
+          }
+        },
         {
           api: 'deleteVolume',
           icon: 'delete',
           label: 'Delete Volume',
           dataView: true,
-          groupAction: true
+          groupAction: true,
+          show: (record, store) => {
+            return ['Expunging', 'Expunged', 
'UploadError'].includes(record.state) ||
+              ((['Admin', 'DomainAdmin'].includes(store.userInfo.roletype) || 
store.getters.features.allowuserexpungerecovervolume) && record.state === 
'Destroy')
 
 Review comment:
   @rhtyd User account can delete volume if `allowuserexpungerecovervolume` is 
returned true by capabilities API
   
   
https://github.com/apache/cloudstack/blob/master/ui/scripts/storage.js#L3107-L3122

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to