mirror of
https://github.com/ansible/awx.git
synced 2026-02-23 05:55:59 -03:30
Added inv source add/edit cred and inv script lookup states
This commit is contained in:
@@ -45,6 +45,8 @@ import nestedHostsAdd from './groups/nested-hosts/nested-hosts-add.route';
|
|||||||
import nestedHostsEdit from './groups/nested-hosts/nested-hosts-edit.route';
|
import nestedHostsEdit from './groups/nested-hosts/nested-hosts-edit.route';
|
||||||
import ansibleFactsRoute from './ansible_facts/ansible_facts.route';
|
import ansibleFactsRoute from './ansible_facts/ansible_facts.route';
|
||||||
import insightsRoute from './insights/insights.route';
|
import insightsRoute from './insights/insights.route';
|
||||||
|
import inventorySourcesCredentialRoute from './sources/lookup/sources-lookup-credential.route';
|
||||||
|
import inventorySourcesInventoryScriptRoute from './sources/lookup/sources-lookup-inventory-script.route';
|
||||||
|
|
||||||
export default
|
export default
|
||||||
angular.module('inventory', [
|
angular.module('inventory', [
|
||||||
@@ -147,6 +149,22 @@ angular.module('inventory', [
|
|||||||
let nestedHostsInsights = _.cloneDeep(insightsRoute);
|
let nestedHostsInsights = _.cloneDeep(insightsRoute);
|
||||||
nestedHostsInsights.name = 'inventories.edit.groups.edit.nested_hosts.edit.insights';
|
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([
|
return Promise.all([
|
||||||
basicInventoryAdd,
|
basicInventoryAdd,
|
||||||
basicInventoryEdit,
|
basicInventoryEdit,
|
||||||
@@ -185,7 +203,11 @@ angular.module('inventory', [
|
|||||||
stateExtender.buildDefinition(inventorySourceListRoute),
|
stateExtender.buildDefinition(inventorySourceListRoute),
|
||||||
stateExtender.buildDefinition(inventorySourceAddRoute),
|
stateExtender.buildDefinition(inventorySourceAddRoute),
|
||||||
stateExtender.buildDefinition(inventorySourceEditRoute),
|
stateExtender.buildDefinition(inventorySourceEditRoute),
|
||||||
stateExtender.buildDefinition(inventoryCompletedJobsRoute)
|
stateExtender.buildDefinition(inventoryCompletedJobsRoute),
|
||||||
|
stateExtender.buildDefinition(addSourceCredential),
|
||||||
|
stateExtender.buildDefinition(addSourceInventoryScript),
|
||||||
|
stateExtender.buildDefinition(editSourceCredential),
|
||||||
|
stateExtender.buildDefinition(editSourceInventoryScript)
|
||||||
])
|
])
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -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');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user