mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 13:25:02 -02:30
Disable the SMART INVENTORY button until the user performs a search on the host list
This commit is contained in:
committed by
Jared Tabor
parent
2dd1901649
commit
3727c3a9a5
@@ -103,11 +103,12 @@ export default ['i18n', function(i18n) {
|
|||||||
smart_inventory: {
|
smart_inventory: {
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
ngClick: "smartInventory()",
|
ngClick: "smartInventory()",
|
||||||
awToolTip: "Create a new Smart Inventory from results.",
|
awToolTip: "Create a new Smart Inventory from search results.",
|
||||||
actionClass: 'btn List-buttonDefault',
|
actionClass: 'btn List-buttonDefault',
|
||||||
buttonContent: 'SMART INVENTORY',
|
buttonContent: 'SMART INVENTORY',
|
||||||
ngShow: 'canAdd',
|
ngShow: 'canAdd',
|
||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
|
ngDisabled: '!activeHostSearch'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
|
|
||||||
function init(){
|
function init(){
|
||||||
$scope.canAdd = false;
|
$scope.canAdd = false;
|
||||||
|
$scope.activeHostSearch = false;
|
||||||
|
|
||||||
rbacUiControlService.canAdd('hosts')
|
rbacUiControlService.canAdd('hosts')
|
||||||
.then(function(canAdd) {
|
.then(function(canAdd) {
|
||||||
@@ -37,6 +38,21 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
setJobStatus();
|
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(){
|
function setJobStatus(){
|
||||||
|
|||||||
Reference in New Issue
Block a user