From b505e7ae41abfb629c485dc330533bf7ef86bb53 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Tue, 16 Sep 2014 12:34:04 -0400 Subject: [PATCH] changed the values for some forms thats have select drop down input fields --- awx/ui/static/js/forms/Credentials.js | 2 +- awx/ui/static/js/forms/HostGroups.js | 2 +- awx/ui/static/js/forms/Projects.js | 2 +- awx/ui/static/js/forms/Source.js | 2 +- awx/ui/static/lib/ansible/RestServices.js | 26 +++++++++++++++++++ awx/ui/static/lib/ansible/form-generator.js | 1 + .../static/lib/ansible/generator-helpers.js | 2 +- 7 files changed, 32 insertions(+), 5 deletions(-) diff --git a/awx/ui/static/js/forms/Credentials.js b/awx/ui/static/js/forms/Credentials.js index b87ba6a4c5..9fa67d70b4 100644 --- a/awx/ui/static/js/forms/Credentials.js +++ b/awx/ui/static/js/forms/Credentials.js @@ -87,7 +87,7 @@ angular.module('CredentialFormDefinition', []) label: 'Type', excludeModal: true, type: 'select', - ngOptions: 'kind.label for kind in credential_kind_options', + ngOptions: 'kind.label for kind in credential_kind_options track by kind.value', // select as label for value in array 'kind.label for kind in credential_kind_options', ngChange: 'kindChange()', addRequired: true, editRequired: true, diff --git a/awx/ui/static/js/forms/HostGroups.js b/awx/ui/static/js/forms/HostGroups.js index 8db8bd3dae..07b32cec08 100644 --- a/awx/ui/static/js/forms/HostGroups.js +++ b/awx/ui/static/js/forms/HostGroups.js @@ -25,7 +25,7 @@ angular.module('HostGroupsFormDefinition', []) label: 'Groups', type: 'select', multiple: true, - ngOptions: 'group.name for group in inventory_groups', + ngOptions: 'group.name for group in inventory_groups track by group.value', addRequired: true, editRequired: true, awPopOver: "

Provide a host name, ip address, or ip address:port. Examples include:

" + diff --git a/awx/ui/static/js/forms/Projects.js b/awx/ui/static/js/forms/Projects.js index 5b45499e4d..d667f0c4b2 100644 --- a/awx/ui/static/js/forms/Projects.js +++ b/awx/ui/static/js/forms/Projects.js @@ -83,7 +83,7 @@ angular.module('ProjectFormDefinition', ['SchedulesListDefinition']) scm_type: { label: 'SCM Type', type: 'select', - ngOptions: 'type.label for type in scm_type_options', + ngOptions: 'type.label for type in scm_type_options track by type.value', ngChange: 'scmChange()', addRequired: true, editRequired: true diff --git a/awx/ui/static/js/forms/Source.js b/awx/ui/static/js/forms/Source.js index 222fb46ad4..ca4b225302 100644 --- a/awx/ui/static/js/forms/Source.js +++ b/awx/ui/static/js/forms/Source.js @@ -25,7 +25,7 @@ angular.module('SourceFormDefinition', []) source: { label: 'Source', type: 'select', - ngOptions: 'source.label for source in source_type_options', + ngOptions: 'source.label for source in source_type_options track by source.value', ngChange: 'sourceChange()', addRequired: false, editRequired: false diff --git a/awx/ui/static/lib/ansible/RestServices.js b/awx/ui/static/lib/ansible/RestServices.js index 4edc1af206..3a0f6a68d6 100644 --- a/awx/ui/static/lib/ansible/RestServices.js +++ b/awx/ui/static/lib/ansible/RestServices.js @@ -188,6 +188,32 @@ angular.module('RestServices', ['ngCookies', 'AuthService']) }, 401); } }, + patch: function (data) { + var token = Authorization.getToken(), + expired = this.checkExpired(); + if (expired) { + return this.createResponse({ + detail: 'Token is expired' + }, 401); + } else if (token) { + this.setHeader({ + Authorization: 'Token ' + token + }); + this.setHeader({ + "X-Auth-Token": 'Token ' + token + }); + return $http({ + method: 'PATCH', + url: this.url, + headers: this.headers, + data: data + }); + } else { + return this.createResponse({ + detail: 'Invalid token' + }, 401); + } + }, destroy: function (data) { var token = Authorization.getToken(), expired = this.checkExpired(); diff --git a/awx/ui/static/lib/ansible/form-generator.js b/awx/ui/static/lib/ansible/form-generator.js index 0da4a74e97..741e15263a 100644 --- a/awx/ui/static/lib/ansible/form-generator.js +++ b/awx/ui/static/lib/ansible/form-generator.js @@ -637,6 +637,7 @@ angular.module('FormGenerator', ['GeneratorHelpers', 'Utilities', 'ListGenerator html += (field.falseValue !== undefined) ? Attr(field, 'falseValue') : ""; html += (field.checked) ? "checked " : ""; html += (field.readonly) ? "disabled " : ""; + html += (field.ngChange) ? "ng-change=\"" +field.ngChange + "\" " : ""; html += (field.ngDisabled) ? "ng-disabled=\"" + field.ngDisabled + "\" " : ""; html += " > "; diff --git a/awx/ui/static/lib/ansible/generator-helpers.js b/awx/ui/static/lib/ansible/generator-helpers.js index cd7a54326e..a075ac1921 100644 --- a/awx/ui/static/lib/ansible/generator-helpers.js +++ b/awx/ui/static/lib/ansible/generator-helpers.js @@ -769,7 +769,7 @@ angular.module('GeneratorHelpers', []) html += "\n";