mirror of
https://github.com/ansible/awx.git
synced 2026-01-21 22:48:02 -03:30
Pass host filter through to the smart inv form. Fixed inventory list name link
This commit is contained in:
parent
e411d5c69b
commit
9131ee59a2
@ -115,7 +115,20 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
||||
};
|
||||
|
||||
$scope.smartInventory = function() {
|
||||
$state.go('inventories.addSmartInventory');
|
||||
// Gather up search terms and pass them to the add smart inventory form
|
||||
let stateParamsCopy = angular.copy($state.params.host_search);
|
||||
let defaults = _.find($state.$current.path, (step) => {
|
||||
if(step && step.params && step.params.hasOwnProperty(`host_search`)){
|
||||
return step.params.hasOwnProperty(`host_search`);
|
||||
}
|
||||
}).params[`host_search`].config.value;
|
||||
|
||||
// Strip defaults out of the state params copy
|
||||
angular.forEach(Object.keys(defaults), function(value) {
|
||||
delete stateParamsCopy[value];
|
||||
});
|
||||
|
||||
$state.go('inventories.addSmartInventory', {hostfilter: JSON.stringify(stateParamsCopy)});
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ export default ['i18n', function(i18n) {
|
||||
modalColumnClass: 'col-md-11',
|
||||
awToolTip: "{{ inventory.description }}",
|
||||
awTipPlacement: "top"
|
||||
linkTo: '/#/inventories/{{inventory.id}}'
|
||||
linkTo: '/#/inventories/basic_inventory/{{inventory.id}}'
|
||||
},
|
||||
organization: {
|
||||
label: i18n._('Organization'),
|
||||
|
||||
@ -59,7 +59,7 @@ angular.module('inventory', [
|
||||
|
||||
let smartInventoryAdd = stateDefinitions.generateTree({
|
||||
name: 'inventories.addSmartInventory', // top-most node in the generated tree (will replace this state definition)
|
||||
url: '/smart_inventory/add',
|
||||
url: '/smart_inventory/add?hostfilter',
|
||||
modes: ['add'],
|
||||
form: 'SmartInventoryForm',
|
||||
controllers: {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user