You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@cloudstack.apache.org by GitBox <gi...@apache.org> on 2020/03/17 09:48:20 UTC

[GitHub] [cloudstack-primate] shwstppr opened a new pull request #231: storage: fix volume actions

shwstppr opened a new pull request #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231
 
 
   Fixes #225 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack-primate] shwstppr commented on a change in pull request #231: storage: fix volume actions

Posted by GitBox <gi...@apache.org>.
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack-primate] shwstppr commented on issue #231: storage: fix volume actions

Posted by GitBox <gi...@apache.org>.
shwstppr commented on issue #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231#issuecomment-615038277
 
 
   @rhtyd you can review this

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack-primate] rhtyd commented on a change in pull request #231: storage: fix volume actions

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231#discussion_r410049822
 
 

 ##########
 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:
   @shwstppr  are users not allowed to delete volumes?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack-primate] shwstppr commented on a change in pull request #231: storage: fix volume actions

Posted by GitBox <gi...@apache.org>.
shwstppr commented on a change in pull request #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231#discussion_r399201680
 
 

 ##########
 File path: src/config/section/storage.js
 ##########
 @@ -163,7 +163,12 @@ export default {
           icon: 'delete',
           label: 'Delete Volume',
           dataView: true,
-          groupAction: true
+          groupAction: true,
+          show: (record, store) => { // g_allowUserExpungeRecoverVolume
 
 Review comment:
   @rhtyd just checked g_allowUserExpungeRecoverVolume is value from capabilities, `json.listcapabilitiesresponse.capability.allowuserexpungerecovervolume`. How to access that in Primate if set globally?
   
   For users, role based check is an OR condition so it will show up for user
   ![Screenshot from 2020-03-27 17-02-56](https://user-images.githubusercontent.com/153340/77752056-d618db00-704c-11ea-8ebc-ad6925a2136c.png)
   

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [cloudstack-primate] rhtyd commented on a change in pull request #231: storage: fix volume actions

Posted by GitBox <gi...@apache.org>.
rhtyd commented on a change in pull request #231: storage: fix volume actions
URL: https://github.com/apache/cloudstack-primate/pull/231#discussion_r399178953
 
 

 ##########
 File path: src/config/section/storage.js
 ##########
 @@ -163,7 +163,12 @@ export default {
           icon: 'delete',
           label: 'Delete Volume',
           dataView: true,
-          groupAction: true
+          groupAction: true,
+          show: (record, store) => { // g_allowUserExpungeRecoverVolume
 
 Review comment:
   @shwstppr can you explain the comment, do we need to check anything else? Shouldn't we allow users to delete a volume?

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services