1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

Added network credential to job template form

This commit is contained in:
Michael Abashian 2016-06-27 15:15:53 -04:00
parent 80b044580d
commit 1b8693f666
3 changed files with 52 additions and 0 deletions

View File

@ -154,6 +154,20 @@ export default
dataPlacement: 'right',
dataContainer: "body"
},
network_credential: {
label: 'Network Credential',
type: 'lookup',
sourceModel: 'network_credential',
sourceField: 'name',
ngClick: 'lookUpNetworkcredential()',
addRequired: false,
editRequired: false,
column: 1,
awPopOver: "<p>Network credentials are used by Ansible networking modules to connect to and manage networking devices.</p>",
dataTitle: 'Network Credential',
dataPlacement: 'right',
dataContainer: "body"
},
forks: {
label: 'Forks',
id: 'forks-number',

View File

@ -173,6 +173,25 @@ angular.module('JobTemplatesHelper', ['Utilities'])
input_type: "radio"
});
var NetworkCredentialList = {};
// Clone the CredentialList object for use with network_credential. Cloning
// and changing properties to avoid collision.
jQuery.extend(true, NetworkCredentialList, CredentialList);
NetworkCredentialList.name = 'networkcredentials';
NetworkCredentialList.iterator = 'networkcredential';
NetworkCredentialList.basePath = '/api/v1/credentials?kind=net';
LookUpInit({
url: GetBasePath('credentials') + '?kind=net',
scope: scope,
form: form,
current_item: data.network_credential,
list: NetworkCredentialList,
field: 'network_credential',
hdr: 'Select Network Credential',
input_type: "radio"
});
LookUpInit({
scope: scope,
form: form,

View File

@ -28,6 +28,7 @@
generator = GenerateForm,
master = {},
CloudCredentialList = {},
NetworkCredentialList = {},
selectPlaybook, checkSCMStatus,
callback,
base = $location.path().replace(/^\//, '').split('/')[0],
@ -74,6 +75,13 @@
CloudCredentialList.iterator = 'cloudcredential';
CloudCredentialList.basePath = '/api/v1/credentials?cloud=true';
// Clone the CredentialList object for use with network_credential. Cloning
// and changing properties to avoid collision.
jQuery.extend(true, NetworkCredentialList, CredentialList);
NetworkCredentialList.name = 'networkcredentials';
NetworkCredentialList.iterator = 'networkcredential';
NetworkCredentialList.basePath = '/api/v1/credentials?kind=net';
SurveyControllerInit({
scope: $scope,
parent_scope: $scope
@ -94,6 +102,17 @@
input_type: 'radio'
});
LookUpInit({
url: GetBasePath('credentials') + '?kind=net',
scope: $scope,
form: form,
current_item: null,
list: NetworkCredentialList,
field: 'network_credential',
hdr: 'Select Network Credential',
input_type: 'radio'
});
LookUpInit({
url: GetBasePath('credentials') + '?kind=ssh',
scope: $scope,