diff --git a/client/app/services/vm-details/vm-details.component.js b/client/app/services/vm-details/vm-details.component.js index 77158b1e8..e75435cff 100644 --- a/client/app/services/vm-details/vm-details.component.js +++ b/client/app/services/vm-details/vm-details.component.js @@ -21,6 +21,7 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, E function activate() { vm.permissions = ServicesState.getPermissions(); angular.extend(vm, { + hasCustomButtons: hasCustomButtons, loading: true, neverText: __('Never'), noneText: __('None'), @@ -84,6 +85,7 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, E EventNotifications.warn(sprintf(__("%s is a retired resource"), vm.vmDetails.name), {persistent: true, unread: false}); } getListActions(); + hasCustomButtons(); vm.loading = false; } @@ -92,6 +94,14 @@ function ComponentController($stateParams, VmsService, ServicesState, sprintf, E } } + function hasCustomButtons() { + const actions = vm.vmDetails.custom_actions || {}; + const groups = actions.button_groups || []; + const buttons = [].concat(actions.buttons, ...groups.map((g) => g.buttons)); + + return lodash.compact(buttons).length > 0; + } + function getListActions() { vm.listActions = []; const powerOptionsMenu = { diff --git a/client/app/services/vm-details/vm-details.html b/client/app/services/vm-details/vm-details.html index 0277dd270..15635952a 100644 --- a/client/app/services/vm-details/vm-details.html +++ b/client/app/services/vm-details/vm-details.html @@ -18,6 +18,10 @@