mirror of
https://github.com/ansible/awx.git
synced 2024-11-02 18:21:12 +03:00
Fixed create operation on Credentials. Credential lookups on Groups and Projects now working.
This commit is contained in:
parent
41b5d8b9ad
commit
72aacfd972
@ -131,7 +131,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
|
||||
if (!Empty($routeParams.user_id)) {
|
||||
// Get the username based on incoming route
|
||||
scope['owner'] == 'user';
|
||||
scope['owner'] = 'user';
|
||||
scope['user'] = $routeParams.user_id;
|
||||
var url = GetBasePath('users') + $routeParams.user_id + '/';
|
||||
Rest.setUrl(url);
|
||||
@ -146,7 +146,7 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
}
|
||||
else if (!Empty($routeParams.team_id)) {
|
||||
// Get the username based on incoming route
|
||||
scope['owner'] == 'team';
|
||||
scope['owner'] = 'team';
|
||||
scope['team'] = $routeParams.team_id;
|
||||
var url = GetBasePath('teams') + $routeParams.team_id + '/';
|
||||
Rest.setUrl(url);
|
||||
@ -157,12 +157,9 @@ function CredentialsAdd ($scope, $rootScope, $compile, $location, $log, $routePa
|
||||
.error( function(data, status, headers, config) {
|
||||
ProcessErrors(scope, data, status, null,
|
||||
{ hdr: 'Error!', msg: 'Failed to retrieve team. GET status: ' + status });
|
||||
});
|
||||
});
|
||||
}
|
||||
else {
|
||||
scope['owner'] = 'team';
|
||||
}
|
||||
|
||||
|
||||
// Handle Kind change
|
||||
scope.kindChange = function () {
|
||||
KindChange({ scope: scope, form: form, reset: true });
|
||||
|
@ -279,6 +279,7 @@ function ProjectsAdd ($scope, $rootScope, $compile, $location, $log, $routeParam
|
||||
|
||||
LookUpInit({
|
||||
scope: scope,
|
||||
url: GetBasePath('credentials') + '?kind=scm',
|
||||
form: form,
|
||||
list: CredentialList,
|
||||
field: 'credential'
|
||||
@ -498,8 +499,8 @@ function ProjectsEdit ($scope, $rootScope, $compile, $location, $log, $routePara
|
||||
|
||||
// Load the list of options for Kind
|
||||
GetChoices({
|
||||
url: GetBasePath('credentials') + '?kind=scm',
|
||||
scope: scope,
|
||||
url: defaultUrl,
|
||||
field: 'scm_type',
|
||||
variable: 'scm_type_options',
|
||||
callback: 'choicesReady'
|
||||
|
@ -32,6 +32,8 @@ angular.module('CredentialFormDefinition', [])
|
||||
label: 'Owned By?',
|
||||
type: 'radio',
|
||||
ngChange: "ownerChange()",
|
||||
addRequired: true,
|
||||
editRequired: true,
|
||||
options: [
|
||||
{ label: 'User', value: 'user' },
|
||||
{ label: 'Team', value: 'team' }
|
||||
@ -40,7 +42,7 @@ angular.module('CredentialFormDefinition', [])
|
||||
"to the credential. Choosing a team shares the credential with all team members.</p>",
|
||||
dataTitle: 'Owner',
|
||||
dataPlacement: 'right',
|
||||
dataContainer: "body",
|
||||
dataContainer: "body"
|
||||
},
|
||||
user: {
|
||||
label: 'User',
|
||||
|
@ -135,7 +135,7 @@ angular.module('ProjectFormDefinition', [])
|
||||
sourceField: 'name',
|
||||
ngClick: 'lookUpCredential()',
|
||||
addRequired: false,
|
||||
editRequired: false,
|
||||
editRequired: false
|
||||
},
|
||||
checkbox_group: {
|
||||
label: 'SCM Options',
|
||||
|
@ -609,12 +609,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
throw "failed to return an object!";
|
||||
}
|
||||
|
||||
var data = {}
|
||||
for (var fld in form.fields) {
|
||||
if (fld != 'variables') {
|
||||
data[fld] = scope[fld];
|
||||
}
|
||||
}
|
||||
var data = {
|
||||
name: form.name,
|
||||
description: form.description,
|
||||
scm_tags: '' };
|
||||
|
||||
if (inventory_id) {
|
||||
data['inventory'] = inventory_id;
|
||||
@ -794,9 +792,10 @@ angular.module('GroupsHelper', [ 'RestServices', 'Utilities', 'ListGenerator', '
|
||||
}
|
||||
|
||||
LookUpInit({
|
||||
url: GetBasePath('credentials') + '?cloud=true',
|
||||
scope: scope,
|
||||
form: form,
|
||||
list: CredentialList,
|
||||
list: CredentialList,
|
||||
field: 'credential'
|
||||
});
|
||||
|
||||
|
@ -24,10 +24,18 @@ angular.module('LookUpHelper', [ 'RestServices', 'Utilities', 'SearchHelper', 'P
|
||||
var list = params.list; // list object
|
||||
var field = params.field; // form field
|
||||
var postAction = params.postAction //action to perform post user selection
|
||||
|
||||
var defaultUrl;
|
||||
if (params.url) {
|
||||
// pass in a url value to override the default
|
||||
defaultUrl = params.url;
|
||||
}
|
||||
else {
|
||||
defaultUrl = (list.name == 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
|
||||
}
|
||||
|
||||
// Show pop-up
|
||||
var name = list.iterator.charAt(0).toUpperCase() + list.iterator.substring(1);
|
||||
var defaultUrl = (list.name == 'inventories') ? GetBasePath('inventory') : GetBasePath(list.name);
|
||||
var hdr = (params.hdr) ? params.hdr : 'Select ' + name;
|
||||
|
||||
$('input[name="' + form.fields[field].sourceModel + '_' + form.fields[field].sourceField + '"]').attr('data-url',defaultUrl +
|
||||
|
@ -101,13 +101,22 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
$(window).unbind('resize');
|
||||
|
||||
// Prepend an asterisk to required field label
|
||||
$('.form-control[required]').each(function() {
|
||||
$('.form-control[required], input[type="radio"][required]').each(function() {
|
||||
var label = $(this).parent().parent().find('label');
|
||||
if (label && !label.hasClass('prepend-asterisk')) {
|
||||
label.addClass('prepend-asterisk');
|
||||
if ($(this).attr('type') == 'radio') {
|
||||
label = $(this).parent().parent().parent().find('label').first();
|
||||
}
|
||||
if (label) {
|
||||
var span = label.find('span');
|
||||
if (span && !span.hasClass('prepend-asterisk')) {
|
||||
span.addClass('prepend-asterisk');
|
||||
}
|
||||
else if (!label.hasClass('prepend-asterisk') && !label.find('.prepend-asterisk')) {
|
||||
label.addClass('prepend-asterisk');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
try {
|
||||
$('#help-modal').empty().dialog('destroy');
|
||||
}
|
||||
@ -454,7 +463,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.labelBind) ? "ng-bind=\"" + field.labelBind + "\" " : "";
|
||||
html += "for=\"" + fld + '">';
|
||||
html += (field.icon) ? this.icon(field.icon) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += "<span>" + field.label + '</span></label>' + "\n";
|
||||
html += (field.awPopOver && field.awPopOverRight) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += "</div>\n";
|
||||
html += "<div ";
|
||||
@ -767,7 +776,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
html += (field.labelBind) ? "ng-bind=\"" + field.labelBind + "\" " : "";
|
||||
html += "for=\"" + fld + '">';
|
||||
html += (field.icon) ? this.icon(field.icon) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += '<span>' + field.label + '</span></label>' + "\n";
|
||||
html += (field.awPopOver && field.awPopOverRight) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += "</div>\n";
|
||||
html += "<div ";
|
||||
@ -782,7 +791,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'ngCookies'])
|
||||
if (field.type == 'radio') {
|
||||
html += "<label class=\"control-label " + getLabelWidth() + "\" for=\"" + fld + '">';
|
||||
html += (field.awPopOver) ? this.attr(field, 'awPopOver', fld) : "";
|
||||
html += field.label + '</label>' + "\n";
|
||||
html += '<span>' + field.label + '</span></label>' + "\n";
|
||||
html += "<div ";
|
||||
html += "id=\"" + this.form.name + "_" + fld + "_radio_grp\" ";
|
||||
html += (field.controlNGClass) ? "ng-class=\"" + field.controlNGClass + "\" " : "";
|
||||
|
Loading…
Reference in New Issue
Block a user