1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-31 23:51:09 +03:00

fix logic of active module check

This commit is contained in:
John Mitchell 2015-06-16 16:39:20 -04:00
parent 9238d8b55d
commit 4cd5d9ab23

View File

@ -136,31 +136,25 @@ function controller($rootScope,
} }
$scope.setActiveModule = function(newModuleName, initialData) { $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) { var newModule = _.find($scope.modules, function(module) {
return module.name === newModuleName; return module.name === newModuleName;
}); });
if (!isAlreadyActive) { if (newModule.isActive) {
$scope.modules.forEach(function(module) { return;
module.isActive = false;
});
newModule.isActive = true;
$location.replace();
$location.search('module', newModuleName);
reloadData({ module: newModule
}, initialData).value();
} }
$scope.modules.forEach(function(module) {
module.isActive = false;
});
newModule.isActive = true;
$location.replace();
$location.search('module', newModuleName);
reloadData({ module: newModule
}, initialData).value();
}; };
function dateWatcher(dateProperty) { function dateWatcher(dateProperty) {