mirror of
https://github.com/ansible/awx.git
synced 2026-01-15 11:50:42 -03:30
Disable the SMART INVENTORY button until the user performs a search on the host list
This commit is contained in:
parent
2dd1901649
commit
3727c3a9a5
@ -103,11 +103,12 @@ export default ['i18n', function(i18n) {
|
||||
smart_inventory: {
|
||||
mode: 'all',
|
||||
ngClick: "smartInventory()",
|
||||
awToolTip: "Create a new Smart Inventory from results.",
|
||||
awToolTip: "Create a new Smart Inventory from search results.",
|
||||
actionClass: 'btn List-buttonDefault',
|
||||
buttonContent: 'SMART INVENTORY',
|
||||
ngShow: 'canAdd',
|
||||
dataPlacement: "top",
|
||||
ngDisabled: '!activeHostSearch'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -15,6 +15,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
|
||||
function init(){
|
||||
$scope.canAdd = false;
|
||||
$scope.activeHostSearch = false;
|
||||
|
||||
rbacUiControlService.canAdd('hosts')
|
||||
.then(function(canAdd) {
|
||||
@ -37,6 +38,21 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
setJobStatus();
|
||||
});
|
||||
|
||||
$rootScope.$on('$stateChangeSuccess', function(event, toState, toParams) {
|
||||
if(toParams && toParams.host_search) {
|
||||
let hasMoreThanDefaultKeys = false;
|
||||
angular.forEach(toParams.host_search, function(value, key) {
|
||||
if(key !== 'order_by' && key !== 'page_size') {
|
||||
hasMoreThanDefaultKeys = true;
|
||||
}
|
||||
});
|
||||
$scope.activeHostSearch = hasMoreThanDefaultKeys ? true : false;
|
||||
}
|
||||
else {
|
||||
$scope.activeHostSearch = false;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function setJobStatus(){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user