From ced6630fead4ca1fda92fd1dd4d1c8a3b0992359 Mon Sep 17 00:00:00 2001 From: Harikrishna Patnala Date: Fri, 21 May 2021 14:06:03 +0530 Subject: [PATCH] Greyout Scale VM Icon on a running VM, if the VM is not configured to be dynamically scalable --- ui/src/components/view/ActionButton.vue | 4 +++- ui/src/config/section/compute.js | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/ui/src/components/view/ActionButton.vue b/ui/src/components/view/ActionButton.vue index bf9f63b0fdd..5202cc6001d 100644 --- a/ui/src/components/view/ActionButton.vue +++ b/ui/src/components/view/ActionButton.vue @@ -39,7 +39,8 @@ action.showBadge && ( (!dataView && ((action.listView && ('show' in action ? action.show(resource, $store.getters) : true)) || (action.groupAction && selectedRowKeys.length > 0 && ('groupShow' in action ? action.show(resource, $store.getters) : true)))) || (dataView && action.dataView && ('show' in action ? action.show(resource, $store.getters) : true)) - )" > + )" + :disabled="'disabled' in action ? action.disabled(resource, $store.getters) : false" > 0 && ('groupShow' in action ? action.show(resource, $store.getters) : true)))) || (dataView && action.dataView && ('show' in action ? action.show(resource, $store.getters) : true)) )" + :disabled="'disabled' in action ? action.disabled(resource, $store.getters) : false" :type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')" :shape="!dataView && ['plus', 'user-add'].includes(action.icon) ? 'round' : 'circle'" style="margin-left: 5px" diff --git a/ui/src/config/section/compute.js b/ui/src/config/section/compute.js index 4345b0118bc..db6ab88d736 100644 --- a/ui/src/config/section/compute.js +++ b/ui/src/config/section/compute.js @@ -286,7 +286,8 @@ export default { label: 'label.scale.vm', docHelp: 'adminguide/virtual_machines.html#how-to-dynamically-scale-cpu-and-ram', dataView: true, - show: (record) => { return ['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'KVM' && record.hypervisor !== 'LXC' && record.isdynamicallyscalable) }, + show: (record) => { return ['Stopped'].includes(record.state) || (['Running'].includes(record.state) && record.hypervisor !== 'KVM' && record.hypervisor !== 'LXC') }, + disabled: (record) => { return !record.isdynamicallyscalable }, popup: true, component: () => import('@/views/compute/ScaleVM.vue') },