diff --git a/awx/ui/static/js/controllers/Inventories.js b/awx/ui/static/js/controllers/Inventories.js index 688f1f1fd4..84b496d8e6 100644 --- a/awx/ui/static/js/controllers/Inventories.js +++ b/awx/ui/static/js/controllers/Inventories.js @@ -895,18 +895,29 @@ export function InventoriesManage ($log, $scope, $rootScope, $location, // you need this so that the event doesn't bubble to the watcher above // for the host list e.stopPropagation(); - if (selection.length > 0) { - $scope.hostsSelected = true; - // $scope.adhocButtonTipContents = "Launch adhoc command for the " - // + "selected groups and hosts."; - } else { + if (selection.length === 0) { $scope.hostsSelected = false; - // $scope.adhocButtonTipContents = "Launch adhoc command for the " - // + "inventory."; + } else if (selection.length === 1) { + $scope.systemTrackingTooltip = "Compare host over time"; + $scope.hostsSelected = true; + $scope.systemTrackingDisabled = false; + } else if (selection.length === 2) { + $scope.systemTrackingTooltip = "Compare hosts against each other"; + $scope.hostsSelected = true; + $scope.systemTrackingDisabled = false; + } else { + $scope.hostsSelected = true; + $scope.systemTrackingDisabled = true; } $scope.hostsSelectedItems = selection.selectedItems; }); + $scope.systemTracking = function() { + $location.path('/inventories/' + $scope.inventory.id + + '/system-tracking/' + + _.pluck($scope.hostsSelectedItems, "id").join(",")); + }; + // populates host patterns based on selected hosts/groups $scope.populateAdhocForm = function() { var host_patterns = "all"; diff --git a/awx/ui/static/js/lists/InventoryHosts.js b/awx/ui/static/js/lists/InventoryHosts.js index bbc3ba4c31..1f92d55907 100644 --- a/awx/ui/static/js/lists/InventoryHosts.js +++ b/awx/ui/static/js/lists/InventoryHosts.js @@ -87,6 +87,16 @@ export default }, actions: { + system_tracking: { + label: 'System Tracking', + ngClick: 'systemTracking()', //'editInventoryProperties(inventory.id)', + awToolTip: "{{ systemTrackingTooltip }}", + dataTipWatch: "systemTrackingTooltip", + dataPlacement: 'top', + awFeature: 'system_tracking', + ngDisabled: 'systemTrackingDisabled', + ngShow: 'hostsSelected' + }, create: { mode: 'all', ngClick: "createHost()", @@ -103,7 +113,7 @@ export default awToolTip: "View Activity Stream", mode: 'all', awFeature: 'activity_streams' - } + }, } }); diff --git a/awx/ui/static/js/shared/generator-helpers.js b/awx/ui/static/js/shared/generator-helpers.js index 5979185474..40622dcffa 100644 --- a/awx/ui/static/js/shared/generator-helpers.js +++ b/awx/ui/static/js/shared/generator-helpers.js @@ -103,6 +103,9 @@ angular.module('GeneratorHelpers', [systemStatus.name]) action = params.action, size = params.size; switch (action) { + case 'system_tracking': + icon = "fa-crosshairs"; + break; case 'help': icon = "fa-question-circle"; break; diff --git a/awx/ui/static/js/shared/list-generator/list-actions.partial.html b/awx/ui/static/js/shared/list-generator/list-actions.partial.html index e59af015cc..cd75004527 100644 --- a/awx/ui/static/js/shared/list-generator/list-actions.partial.html +++ b/awx/ui/static/js/shared/list-generator/list-actions.partial.html @@ -12,6 +12,7 @@ class="options.class" data-title="{{options.dataTitle}}" icon-size="{{options.iconSize}}" + ng-disabled="{{options.ngDisabled}}" ng-click="$eval(options.ngClick)" ng-hide="isHiddenByOptions(options) || hiddenOnCurrentPage(options.basePaths) ||