From 1b1f4c1e07ab01ba856b2369a137163ada256192 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Mon, 27 Jun 2016 13:30:32 -0400 Subject: [PATCH] Disabled System Tracking and Run Commands buttons on inv manage rather than hiding them. Also added tooltips to those two buttons when they are disabled giving the user some instructions. --- awx/ui/client/legacy-styles/lists.less | 12 +++++ .../manage/hosts/hosts-list.controller.js | 2 +- .../manage/inventory-manage.controller.js | 5 +- awx/ui/client/src/lists/InventoryGroups.js | 9 ++-- awx/ui/client/src/lists/InventoryHosts.js | 5 +- .../list-generator/list-actions.partial.html | 46 ++++++++++++------- awx/ui/client/src/tooltip/tooltip.block.less | 3 ++ 7 files changed, 58 insertions(+), 24 deletions(-) diff --git a/awx/ui/client/legacy-styles/lists.less b/awx/ui/client/legacy-styles/lists.less index 860022c60f..f2120c139e 100644 --- a/awx/ui/client/legacy-styles/lists.less +++ b/awx/ui/client/legacy-styles/lists.less @@ -376,6 +376,18 @@ table, tbody { font-size: 13px; } +.List-action--showTooltipOnDisabled { + display: inline-block; +} + +.List-action--showTooltipOnDisabled .btn[disabled] { + pointer-events: none; +} + +.List-action--showTooltipOnDisabled.disabled { + cursor: not-allowed; +} + @media (max-width: 991px) { .List-searchWidget + .List-searchWidget { margin-top: 20px; diff --git a/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js b/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js index dcd35f68bb..1e294a96bb 100644 --- a/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js +++ b/awx/ui/client/src/inventories/manage/hosts/hosts-list.controller.js @@ -62,7 +62,7 @@ $scope.$parent.hostsSelected = selection.length > 0 ? true : false; $scope.$parent.hostsSelectedItems = selection.selectedItems; $scope.$parent.systemTrackingDisabled = selection.length > 0 && selection.length < 3 ? false : true; - $scope.$parent.systemTrackingTooltip = selection.length === 1 ? "Compare host facts over time" : "Compare hosts' facts"; + $scope.$parent.systemTrackingTooltip = selection.length > 0 && selection.length < 3 ? "Compare host facts over time" : "Select one or two hosts by clicking the checkbox beside the host. System tracking offers the ability to compare the results of two scan runs from different dates on one host or the same date on two hosts."; }); $scope.$on('PostRefresh', ()=>{ _.forEach($scope.hosts, (host) => SetStatus({scope: $scope, host: host})); diff --git a/awx/ui/client/src/inventories/manage/inventory-manage.controller.js b/awx/ui/client/src/inventories/manage/inventory-manage.controller.js index 0588e8ed17..aceb174363 100644 --- a/awx/ui/client/src/inventories/manage/inventory-manage.controller.js +++ b/awx/ui/client/src/inventories/manage/inventory-manage.controller.js @@ -17,4 +17,7 @@ }).value().join(':'); $state.go('inventoryManage.adhoc', {pattern: pattern}); }; - }]; \ No newline at end of file + $scope.$watchGroup(['groupsSelected', 'hostsSelected'], function(newVals) { + $scope.adhocCommandTooltip = (newVals[0] || newVals[1]) ? "Run a command on the selected inventory" : "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups."; + }); + }]; diff --git a/awx/ui/client/src/lists/InventoryGroups.js b/awx/ui/client/src/lists/InventoryGroups.js index 546f9c3f6c..0b821462db 100644 --- a/awx/ui/client/src/lists/InventoryGroups.js +++ b/awx/ui/client/src/lists/InventoryGroups.js @@ -135,11 +135,14 @@ export default launch: { mode: 'all', // $scope.$parent is governed by InventoryManageController, - ngShow: '$parent.groupsSelected || $parent.hostsSelected', + ngDisabled: '!$parent.groupsSelected && !$parent.hostsSelected', ngClick: '$parent.setAdhocPattern()', - awToolTip: "Run a command on the selected inventory", + awToolTip: "Select an inventory source by clicking the check box beside it. The inventory source can be a single group or host, a selection of multiple hosts, or a selection of multiple groups.", + dataTipWatch: "adhocCommandTooltip", actionClass: 'btn List-buttonDefault', - buttonContent: 'RUN COMMANDS' + buttonContent: 'RUN COMMANDS', + showTipWhenDisabled: true, + tooltipInnerClass: "Tooltip-wide" // TODO: set up a tip watcher and change text based on when // things are selected/not selected. This is started and // commented out in the inventory controller within the watchers. diff --git a/awx/ui/client/src/lists/InventoryHosts.js b/awx/ui/client/src/lists/InventoryHosts.js index b26627adbf..7022c3922c 100644 --- a/awx/ui/client/src/lists/InventoryHosts.js +++ b/awx/ui/client/src/lists/InventoryHosts.js @@ -100,8 +100,9 @@ export default dataPlacement: 'top', awFeature: 'system_tracking', actionClass: 'btn List-buttonDefault system-tracking', - ngShow: 'hostsSelected', - ngDisabled: 'systemTrackingDisabled' + ngDisabled: 'systemTrackingDisabled || !hostsSelected', + showTipWhenDisabled: true, + tooltipInnerClass: "Tooltip-wide" }, refresh: { mode: 'all', diff --git a/awx/ui/client/src/shared/list-generator/list-actions.partial.html b/awx/ui/client/src/shared/list-generator/list-actions.partial.html index ed82c52c11..485ead4e07 100644 --- a/awx/ui/client/src/shared/list-generator/list-actions.partial.html +++ b/awx/ui/client/src/shared/list-generator/list-actions.partial.html @@ -1,23 +1,35 @@ - - +
+ +
+ + +