rhtyd commented on a change in pull request #231: URL: https://github.com/apache/cloudstack-primate/pull/231#discussion_r412757975
########## 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') + } + }, + { + api: 'destroyVolume', + icon: 'delete', + label: 'Destroy Volume', + dataView: true, + args: (record, store) => { Review comment: @shwstppr args is expected to be an array not a function; this would require some changes in AutogenView. On testing I'm getting: ``` vue.runtime.esm.js?2b0e:619 [Vue warn]: Error in v-on handler: "TypeError: action.args.map is not a function" found in ---> <ActionButton> at src/components/view/ActionButton.vue <ACol> <ARow> <ACard> <Resource> at src/views/AutogenView.vue <RouteView> at src/layouts/RouteView.vue... (1 recursive calls) <Anonymous> <ALayoutContent> <Anonymous> <ALayout> <Anonymous> <ALayout> <GlobalLayout> at src/components/page/GlobalLayout.vue <BasicLayout> at src/layouts/BasicLayout.vue <ALocaleProvider> <App> at src/App.vue <Root> ``` ---------------------------------------------------------------- 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