Greyout Scale VM Icon on a running VM, if the VM is not configured to be dynamically scalable

This commit is contained in:
Harikrishna Patnala 2021-05-21 14:06:03 +05:30
parent 90da94d960
commit ced6630fea
2 changed files with 5 additions and 2 deletions

View File

@ -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" >
<a-button
:type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')"
:shape="!dataView && action.icon === 'plus' ? 'round' : 'circle'"
@ -59,6 +60,7 @@
(!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"
:type="action.icon === 'delete' ? 'danger' : (action.icon === 'plus' ? 'primary' : 'default')"
:shape="!dataView && ['plus', 'user-add'].includes(action.icon) ? 'round' : 'circle'"
style="margin-left: 5px"

View File

@ -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')
},