mirror of
https://github.com/ansible/awx.git
synced 2026-03-26 21:35:01 -02:30
Fixed smart inv button bug navigating to page 2 of hosts. Added tooltip when button is disabled.
This commit is contained in:
@@ -104,12 +104,14 @@ export default ['i18n', function(i18n) {
|
|||||||
smart_inventory: {
|
smart_inventory: {
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
ngClick: "smartInventory()",
|
ngClick: "smartInventory()",
|
||||||
awToolTip: i18n._("Create a new Smart Inventory from search results."),
|
awToolTip: "{{ smartInventoryButtonTooltip }}",
|
||||||
|
dataTipWatch: 'smartInventoryButtonTooltip',
|
||||||
actionClass: 'btn List-buttonDefault',
|
actionClass: 'btn List-buttonDefault',
|
||||||
buttonContent: i18n._('SMART INVENTORY'),
|
buttonContent: i18n._('SMART INVENTORY'),
|
||||||
ngShow: 'canAdd && (hosts.length > 0 || !(searchTags | isEmpty))',
|
ngShow: 'canAdd && (hosts.length > 0 || !(searchTags | isEmpty))',
|
||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
ngDisabled: '!enableSmartInventoryButton'
|
ngDisabled: '!enableSmartInventoryButton',
|
||||||
|
showTipWhenDisabled: true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd) {
|
HostsService, SetStatus, canAdd, InventoryHostsStrings) {
|
||||||
|
|
||||||
let list = HostsList;
|
let list = HostsList;
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
function init(){
|
function init(){
|
||||||
$scope.canAdd = canAdd;
|
$scope.canAdd = canAdd;
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
|
|
||||||
// Search init
|
// Search init
|
||||||
$scope.list = list;
|
$scope.list = list;
|
||||||
@@ -37,14 +38,16 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
if(toParams && toParams.host_search) {
|
if(toParams && toParams.host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(toParams.host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size' && key !== 'page') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
||||||
|
$scope.smartInventoryButtonTooltip = hasMoreThanDefaultKeys ? InventoryHostsStrings.get('smartinventorybutton.ENABLED_INSTRUCTIONS') : InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -114,5 +117,5 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
|
|
||||||
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'HostsList', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', HostsList
|
'HostsService', 'SetStatus', 'canAdd', 'InventoryHostsStrings', HostsList
|
||||||
];
|
];
|
||||||
|
|||||||
@@ -6,10 +6,10 @@
|
|||||||
|
|
||||||
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData',
|
'HostsService', 'SetStatus', 'canAdd', 'GroupsService', 'ProcessErrors', 'groupData', 'inventoryData', 'InventoryHostsStrings',
|
||||||
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
|
function($scope, NestedHostsListDefinition, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData) {
|
HostsService, SetStatus, canAdd, GroupsService, ProcessErrors, groupData, inventoryData, InventoryHostsStrings) {
|
||||||
|
|
||||||
let list = NestedHostsListDefinition;
|
let list = NestedHostsListDefinition;
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePat
|
|||||||
$scope.canAdd = canAdd;
|
$scope.canAdd = canAdd;
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
$scope.disassociateFrom = groupData;
|
$scope.disassociateFrom = groupData;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
|
|
||||||
// Search init
|
// Search init
|
||||||
$scope.list = list;
|
$scope.list = list;
|
||||||
@@ -50,14 +51,16 @@ export default ['$scope', 'NestedHostsListDefinition', '$rootScope', 'GetBasePat
|
|||||||
if(toParams && toParams.host_search) {
|
if(toParams && toParams.host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(toParams.host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size' && key !== 'page') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
||||||
|
$scope.smartInventoryButtonTooltip = hasMoreThanDefaultKeys ? InventoryHostsStrings.get('smartinventorybutton.ENABLED_INSTRUCTIONS') : InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -7,10 +7,10 @@
|
|||||||
// import HostsService from './../hosts/host.service';
|
// import HostsService from './../hosts/host.service';
|
||||||
export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
||||||
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
'rbacUiControlService', 'Dataset', '$state', '$filter', 'Prompt', 'Wait',
|
||||||
'HostsService', 'SetStatus', 'canAdd', 'i18n',
|
'HostsService', 'SetStatus', 'canAdd', 'i18n', 'InventoryHostsStrings',
|
||||||
function($scope, ListDefinition, $rootScope, GetBasePath,
|
function($scope, ListDefinition, $rootScope, GetBasePath,
|
||||||
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
rbacUiControlService, Dataset, $state, $filter, Prompt, Wait,
|
||||||
HostsService, SetStatus, canAdd, i18n) {
|
HostsService, SetStatus, canAdd, i18n, InventoryHostsStrings) {
|
||||||
|
|
||||||
let list = ListDefinition;
|
let list = ListDefinition;
|
||||||
|
|
||||||
@@ -19,6 +19,7 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
|||||||
function init(){
|
function init(){
|
||||||
$scope.canAdd = canAdd;
|
$scope.canAdd = canAdd;
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
|
|
||||||
// Search init
|
// Search init
|
||||||
$scope.list = list;
|
$scope.list = list;
|
||||||
@@ -45,14 +46,16 @@ export default ['$scope', 'ListDefinition', '$rootScope', 'GetBasePath',
|
|||||||
if(toParams && toParams.host_search) {
|
if(toParams && toParams.host_search) {
|
||||||
let hasMoreThanDefaultKeys = false;
|
let hasMoreThanDefaultKeys = false;
|
||||||
angular.forEach(toParams.host_search, function(value, key) {
|
angular.forEach(toParams.host_search, function(value, key) {
|
||||||
if(key !== 'order_by' && key !== 'page_size') {
|
if(key !== 'order_by' && key !== 'page_size' && key !== 'page') {
|
||||||
hasMoreThanDefaultKeys = true;
|
hasMoreThanDefaultKeys = true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
$scope.enableSmartInventoryButton = hasMoreThanDefaultKeys ? true : false;
|
||||||
|
$scope.smartInventoryButtonTooltip = hasMoreThanDefaultKeys ? InventoryHostsStrings.get('smartinventorybutton.ENABLED_INSTRUCTIONS') : InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$scope.enableSmartInventoryButton = false;
|
$scope.enableSmartInventoryButton = false;
|
||||||
|
$scope.smartInventoryButtonTooltip = InventoryHostsStrings.get('smartinventorybutton.DISABLED_INSTRUCTIONS');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,11 @@ function InventoryHostsStrings (BaseString) {
|
|||||||
MISSING_PERMISSIONS: t.s('You do not have sufficient permissions to edit the host filter.')
|
MISSING_PERMISSIONS: t.s('You do not have sufficient permissions to edit the host filter.')
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ns.smartinventorybutton = {
|
||||||
|
DISABLED_INSTRUCTIONS: "Please enter at least one search term to create a new Smart Inventory.",
|
||||||
|
ENABLED_INSTRUCTIONS: "Create a new Smart Inventory from search results."
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
InventoryHostsStrings.$inject = ['BaseStringService'];
|
InventoryHostsStrings.$inject = ['BaseStringService'];
|
||||||
|
|||||||
Reference in New Issue
Block a user