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

Merge pull request #2668 from mabashian/2611

Added network credential to Job Templates form
This commit is contained in:
Michael Abashian 2016-06-27 17:37:57 -04:00 committed by GitHub
commit 358f267e14
5 changed files with 67 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

@ -579,6 +579,14 @@ export default
scope.cloud_credential_name = "";
}
if (data.summary_fields.cloud_credential) {
scope.network_credential_name = data.summary_fields.network_credential.name;
scope.network_credential_url = data.related.network_credential
.replace('api/v1', '#');
} else {
scope.network_credential_name = "";
}
for (i=0; i < verbosity_options.length; i++) {
if (verbosity_options[i].value === data.verbosity) {
scope.verbosity = verbosity_options[i].label;

View File

@ -127,6 +127,13 @@
</div>
</div>
<div class="form-group JobDetail-resultRow toggle-show" ng-show="network_credential_name">
<label class="JobDetail-resultRowLabel col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Network Credential</label>
<div class="JobDetail-resultRowText">
<a href="{{ network_credential_url }}" aw-tool-tip="Edit the credential" data-placement="top">{{ network_credential_name }}</a>
</div>
</div>
<div class="form-group JobDetail-resultRow toggle-show" ng-show="job.forks">
<label class="JobDetail-resultRowLabel col-lg-2 col-md-2 col-sm-2 col-xs-3 control-label">Forks</label>
<div class="JobDetail-resultRowText">{{ job.forks }}</div>

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,