From 9238d8b55d853b6b72861d3ee39e41b0662ee8b0 Mon Sep 17 00:00:00 2001 From: John Mitchell Date: Tue, 16 Jun 2015 16:15:59 -0400 Subject: [PATCH] disabled the buttons on system tracking page from being clickable --- .../fact-module-filter.block.less | 18 ++++++++++++- .../system-tracking.controller.js | 25 +++++++++++++------ .../system-tracking.partial.html | 2 +- 3 files changed, 35 insertions(+), 10 deletions(-) diff --git a/awx/ui/static/js/system-tracking/fact-module-filter.block.less b/awx/ui/static/js/system-tracking/fact-module-filter.block.less index 9be4bea6fb..e73dd92e48 100644 --- a/awx/ui/static/js/system-tracking/fact-module-filter.block.less +++ b/awx/ui/static/js/system-tracking/fact-module-filter.block.less @@ -18,7 +18,7 @@ @media screen and (max-width: 750px) { flex-basis: 50%; } - &--isActive, &:active, &:focus { + &:active, &:focus { // copied from bootstrap's .btn:focus background-color: @enabled-item-background; border-color: @enabled-item-border; @@ -26,4 +26,20 @@ z-index: 2; } } + + &-module.is-active { + cursor: default; + background-color: @enabled-item-background; + border-color: @enabled-item-border; + color: @enabled-item-text; + z-index: 2; + + &:active, &:focus { + box-shadow: none; + } + + &:hover { + background-color: @enabled-item-background; + } + } } diff --git a/awx/ui/static/js/system-tracking/system-tracking.controller.js b/awx/ui/static/js/system-tracking/system-tracking.controller.js index 154a485e4f..07a20c2b2a 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.controller.js +++ b/awx/ui/static/js/system-tracking/system-tracking.controller.js @@ -136,22 +136,31 @@ function controller($rootScope, } $scope.setActiveModule = function(newModuleName, initialData) { + var isAlreadyActive = false; + for (var i in $scope.modules) { + if ($scope.modules[i].name === newModuleName && + $scope.modules[i].isActive) { + isAlreadyActive = true; + } + } var newModule = _.find($scope.modules, function(module) { return module.name === newModuleName; }); - $scope.modules.forEach(function(module) { - module.isActive = false; - }); + if (!isAlreadyActive) { + $scope.modules.forEach(function(module) { + module.isActive = false; + }); - newModule.isActive = true; + newModule.isActive = true; - $location.replace(); - $location.search('module', newModuleName); + $location.replace(); + $location.search('module', newModuleName); - reloadData({ module: newModule - }, initialData).value(); + reloadData({ module: newModule + }, initialData).value(); + } }; function dateWatcher(dateProperty) { diff --git a/awx/ui/static/js/system-tracking/system-tracking.partial.html b/awx/ui/static/js/system-tracking/system-tracking.partial.html index 5f583485fa..3e75fd7a12 100644 --- a/awx/ui/static/js/system-tracking/system-tracking.partial.html +++ b/awx/ui/static/js/system-tracking/system-tracking.partial.html @@ -21,7 +21,7 @@ ng-class="{ 'btn': true, 'btn-default': true, 'FactModuleFilter-module': true, - 'FactModuleFilter-module--isActive': module.isActive, + 'is-active': module.isActive, }" ng-click="setActiveModule(module.name)" ng-repeat="module in modules | orderBy: 'sortKey'">