1
0
mirror of https://github.com/ansible/awx.git synced 2024-10-30 22:21:13 +03:00

Merge branch 'mabashian-inventory-source-states' into devel

This commit is contained in:
Michael Abashian 2017-05-16 08:37:24 -04:00
commit 7fd406eaad
3 changed files with 138 additions and 1 deletions

View File

@ -48,6 +48,8 @@ import ansibleFactsRoute from './ansible_facts/ansible_facts.route';
import insightsRoute from './insights/insights.route';
import hostGroupsRoute from './host-groups/host-groups.route';
import hostGroupsAssociateRoute from './host-groups/host-groups-associate/host-groups-associate.route';
import inventorySourcesCredentialRoute from './sources/lookup/sources-lookup-credential.route';
import inventorySourcesInventoryScriptRoute from './sources/lookup/sources-lookup-inventory-script.route';
export default
angular.module('inventory', [
@ -151,6 +153,22 @@ angular.module('inventory', [
let nestedHostsInsights = _.cloneDeep(insightsRoute);
nestedHostsInsights.name = 'inventories.edit.groups.edit.nested_hosts.edit.insights';
let addSourceCredential = _.cloneDeep(inventorySourcesCredentialRoute);
addSourceCredential.name = 'inventories.edit.inventory_sources.add.credential';
addSourceCredential.url = '/credential';
let addSourceInventoryScript = _.cloneDeep(inventorySourcesInventoryScriptRoute);
addSourceInventoryScript.name = 'inventories.edit.inventory_sources.add.inventory_script';
addSourceInventoryScript.url = '/inventory_script';
let editSourceCredential = _.cloneDeep(inventorySourcesCredentialRoute);
editSourceCredential.name = 'inventories.edit.inventory_sources.edit.credential';
editSourceCredential.url = '/credential';
let editSourceInventoryScript = _.cloneDeep(inventorySourcesInventoryScriptRoute);
editSourceInventoryScript.name = 'inventories.edit.inventory_sources.edit.inventory_script';
editSourceInventoryScript.url = '/inventory_script';
return Promise.all([
basicInventoryAdd,
basicInventoryEdit,
@ -189,7 +207,11 @@ angular.module('inventory', [
stateExtender.buildDefinition(inventorySourceListRoute),
stateExtender.buildDefinition(inventorySourceAddRoute),
stateExtender.buildDefinition(inventorySourceEditRoute),
stateExtender.buildDefinition(inventoryCompletedJobsRoute)
stateExtender.buildDefinition(inventoryCompletedJobsRoute),
stateExtender.buildDefinition(addSourceCredential),
stateExtender.buildDefinition(addSourceInventoryScript),
stateExtender.buildDefinition(editSourceCredential),
stateExtender.buildDefinition(editSourceInventoryScript)
])
};
});

View File

@ -0,0 +1,50 @@
export default {
params: {
credential_search: {
value: {
page_size:"5",
order_by:"name",
role_level:"use_role",
},
dynamic:true,
squash:""
}
},
data: {
basePath:"credentials",
formChildState:true
},
ncyBreadcrumb: {
skip: true
},
views: {
'modal': {
templateProvider: function(ListDefinition, generateList) {
let list_html = generateList.build({
mode: 'lookup',
list: ListDefinition,
input_type: 'radio'
});
return `<lookup-modal>${list_html}</lookup-modal>`;
}
}
},
resolve: {
ListDefinition: ['CredentialList', function(list) {
return list;
}],
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath',
(list, qs, $stateParams, GetBasePath) => {
return qs.search(GetBasePath('credentials'), $stateParams[`${list.iterator}_search`]);
}
]
},
onExit: function($state) {
if ($state.transition) {
$('#form-modal').modal('hide');
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
}
}
};

View File

@ -0,0 +1,65 @@
export default {
params: {
inventory_script_search: {
value: {
page_size: "5",
order_by: "name",
role_level: "admin_role",
},
dynamic: true,
squash: ""
}
},
data: {
basePath: "inventory_scripts",
formChildState: true
},
ncyBreadcrumb: {
skip: true
},
views: {
'modal': {
templateProvider: function(ListDefinition, generateList) {
let list_html = generateList.build({
mode: 'lookup',
list: ListDefinition,
input_type: 'radio'
});
return `<lookup-modal>${list_html}</lookup-modal>`;
}
}
},
resolve: {
ListDefinition: ['InventoryScriptsList', function(list) {
return list;
}],
OrganizationId: ['ListDefinition', 'InventoryManageService', '$stateParams', '$rootScope',
function(list, InventoryManageService, $stateParams, $rootScope){
if($rootScope.$$childTail &&
$rootScope.$$childTail.$resolve &&
$rootScope.$$childTail.$resolve.hasOwnProperty('inventoryData')){
return $rootScope.$$childTail.$resolve.inventoryData.summary_fields.organization.id;
}
else {
return InventoryManageService.getInventory($stateParams.inventory_id).then(res => res.data.summary_fields.organization.id);
}
}],
Dataset: ['ListDefinition', 'QuerySet', '$stateParams', 'GetBasePath', '$interpolate', '$rootScope', '$state', 'OrganizationId',
(list, qs, $stateParams, GetBasePath, $interpolate, $rootScope, $state, OrganizationId) => {
$stateParams[`${list.iterator}_search`].role_level = "admin_role";
$stateParams[`${list.iterator}_search`].organization = OrganizationId;
return qs.search(GetBasePath('inventory_scripts'), $stateParams[`${list.iterator}_search`]);
}
]
},
onExit: function($state) {
if ($state.transition) {
$('#form-modal').modal('hide');
$('.modal-backdrop').remove();
$('body').removeClass('modal-open');
}
}
};