mirror of
https://github.com/ansible/awx.git
synced 2026-05-17 06:17:36 -02:30
Pass host filter through to the smart inv form. Fixed inventory list name link
This commit is contained in:
committed by
Jared Tabor
parent
e411d5c69b
commit
9131ee59a2
@@ -115,7 +115,20 @@ function HostsList($scope, HostsList, $rootScope, GetBasePath,
|
|||||||
};
|
};
|
||||||
|
|
||||||
$scope.smartInventory = function() {
|
$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',
|
modalColumnClass: 'col-md-11',
|
||||||
awToolTip: "{{ inventory.description }}",
|
awToolTip: "{{ inventory.description }}",
|
||||||
awTipPlacement: "top"
|
awTipPlacement: "top"
|
||||||
linkTo: '/#/inventories/{{inventory.id}}'
|
linkTo: '/#/inventories/basic_inventory/{{inventory.id}}'
|
||||||
},
|
},
|
||||||
organization: {
|
organization: {
|
||||||
label: i18n._('Organization'),
|
label: i18n._('Organization'),
|
||||||
|
|||||||
@@ -59,7 +59,7 @@ angular.module('inventory', [
|
|||||||
|
|
||||||
let smartInventoryAdd = stateDefinitions.generateTree({
|
let smartInventoryAdd = stateDefinitions.generateTree({
|
||||||
name: 'inventories.addSmartInventory', // top-most node in the generated tree (will replace this state definition)
|
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'],
|
modes: ['add'],
|
||||||
form: 'SmartInventoryForm',
|
form: 'SmartInventoryForm',
|
||||||
controllers: {
|
controllers: {
|
||||||
|
|||||||
Reference in New Issue
Block a user