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