diff --git a/awx/ui/static/js/controllers/Credentials.js b/awx/ui/static/js/controllers/Credentials.js index 3031afdc42..18470deceb 100644 --- a/awx/ui/static/js/controllers/Credentials.js +++ b/awx/ui/static/js/controllers/Credentials.js @@ -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 }); diff --git a/awx/ui/static/js/controllers/Projects.js b/awx/ui/static/js/controllers/Projects.js index 3e4b3fcabe..c43bbce9d0 100644 --- a/awx/ui/static/js/controllers/Projects.js +++ b/awx/ui/static/js/controllers/Projects.js @@ -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' diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index b4686edeef..42b93da95c 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -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.
", dataTitle: 'Owner', dataPlacement: 'right', - dataContainer: "body", + dataContainer: "body" }, user: { label: 'User', diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index 255eb6d94f..e2246bb63b 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -135,7 +135,7 @@ angular.module('ProjectFormDefinition', []) sourceField: 'name', ngClick: 'lookUpCredential()', addRequired: false, - editRequired: false, + editRequired: false }, checkbox_group: { label: 'SCM Options', diff --git a/awx/ui/static/js/helpers/Groups.js b/awx/ui/static/js/helpers/Groups.js index 25fd8beb1f..70f8050d04 100644 --- a/awx/ui/static/js/helpers/Groups.js +++ b/awx/ui/static/js/helpers/Groups.js @@ -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' }); diff --git a/awx/ui/static/js/helpers/Lookup.js b/awx/ui/static/js/helpers/Lookup.js index f09c7fc211..be6cb6eff1 100644 --- a/awx/ui/static/js/helpers/Lookup.js +++ b/awx/ui/static/js/helpers/Lookup.js @@ -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 + diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 517451030c..e93dd1185f 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -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 + '' + "\n"; + html += "" + field.label + '' + "\n"; html += (field.awPopOver && field.awPopOverRight) ? this.attr(field, 'awPopOver', fld) : ""; html += "\n"; html += "