diff --git a/awx/ui/client/features/applications/add-applications.controller.js b/awx/ui/client/features/applications/add-applications.controller.js
index 173460157e..23453734fe 100644
--- a/awx/ui/client/features/applications/add-applications.controller.js
+++ b/awx/ui/client/features/applications/add-applications.controller.js
@@ -3,10 +3,8 @@ function AddApplicationsController (models, $state, strings) {
const { application, me, organization } = models;
const omit = [
- 'authorization_grant_type',
'client_id',
'client_secret',
- 'client_type',
'created',
'modified',
'related',
@@ -54,9 +52,7 @@ function AddApplicationsController (models, $state, strings) {
vm.form.save = data => {
const hiddenData = {
- authorization_grant_type: 'implicit',
- user: me.get('id'),
- client_type: 'public'
+ user: me.get('id')
};
const payload = _.merge(data, hiddenData);
diff --git a/awx/ui/client/features/applications/add-edit-applications.view.html b/awx/ui/client/features/applications/add-edit-applications.view.html
index a8d8d68e6c..9f2bbb96d3 100644
--- a/awx/ui/client/features/applications/add-edit-applications.view.html
+++ b/awx/ui/client/features/applications/add-edit-applications.view.html
@@ -15,6 +15,8 @@
+
+
diff --git a/awx/ui/client/features/applications/edit-applications.controller.js b/awx/ui/client/features/applications/edit-applications.controller.js
index 6279b642ee..6b7e21aed4 100644
--- a/awx/ui/client/features/applications/edit-applications.controller.js
+++ b/awx/ui/client/features/applications/edit-applications.controller.js
@@ -4,10 +4,8 @@ function EditApplicationsController (models, $state, strings, $scope) {
const { me, application, organization } = models;
const omit = [
- 'authorization_grant_type',
'client_id',
'client_secret',
- 'client_type',
'created',
'modified',
'related',
@@ -90,9 +88,7 @@ function EditApplicationsController (models, $state, strings, $scope) {
vm.form.save = data => {
const hiddenData = {
- authorization_grant_type: 'implicit',
- user: me.get('id'),
- client_type: 'public'
+ user: me.get('id')
};
const payload = _.merge(data, hiddenData);
diff --git a/awx/ui/client/lib/components/form/form.directive.js b/awx/ui/client/lib/components/form/form.directive.js
index dc19c61e2a..e0ac85c595 100644
--- a/awx/ui/client/lib/components/form/form.directive.js
+++ b/awx/ui/client/lib/components/form/form.directive.js
@@ -76,7 +76,9 @@ function AtFormController (eventService, strings) {
return values;
}
- if (component.state._key && typeof component.state._value === 'object') {
+ if (component.state._format === 'selectFromOptions') {
+ values[component.state.id] = component.state._value[0];
+ } else if (component.state._key && typeof component.state._value === 'object') {
values[component.state.id] = component.state._value[component.state._key];
} else if (component.state._group) {
values[component.state._key] = values[component.state._key] || {};
diff --git a/awx/ui/client/lib/components/input/base.controller.js b/awx/ui/client/lib/components/input/base.controller.js
index 5c27d903f0..75caad2f07 100644
--- a/awx/ui/client/lib/components/input/base.controller.js
+++ b/awx/ui/client/lib/components/input/base.controller.js
@@ -14,7 +14,7 @@ function BaseInputController (strings) {
scope.state._required = scope.state.required || false;
scope.state._isValid = scope.state._isValid || false;
scope.state._disabled = scope.state._disabled || false;
- scope.state._activeModel = '_value';
+ scope.state._activeModel = scope.state._activeModel || '_value';
if (scope.state.ask_at_runtime) {
scope.state._displayPromptOnLaunch = true;
diff --git a/awx/ui/client/lib/components/input/select.directive.js b/awx/ui/client/lib/components/input/select.directive.js
index 8507573a61..ddc0e23766 100644
--- a/awx/ui/client/lib/components/input/select.directive.js
+++ b/awx/ui/client/lib/components/input/select.directive.js
@@ -59,7 +59,9 @@ function AtInputSelectController (baseInputController, eventService) {
};
vm.updateDisplayModel = () => {
- if (scope.state._format === 'array') {
+ if (scope.state._format === 'selectFromOptions') {
+ scope.displayModel = scope.state._value[1];
+ } else if (scope.state._format === 'array') {
scope.displayModel = scope.state._value;
} else if (scope.state._format === 'objects') {
scope.displayModel = scope.state._value[scope.state._display];
diff --git a/awx/ui/client/lib/models/Application.js b/awx/ui/client/lib/models/Application.js
index 5c8cdbd066..1fa79a3661 100644
--- a/awx/ui/client/lib/models/Application.js
+++ b/awx/ui/client/lib/models/Application.js
@@ -1,6 +1,21 @@
let Base;
function createFormSchema (method, config) {
+ function mungeSelectFromOptions (configObj, value) {
+ configObj.choices = [['', '']].concat(configObj.choices);
+ configObj._data = configObj.choices;
+ configObj._exp = 'choice[1] for choice in state._data';
+ configObj._format = 'selectFromOptions';
+
+ configObj._data.forEach((val, i) => {
+ if (val[0] === value) {
+ configObj._value = configObj._data[i];
+ }
+ });
+
+ return configObj;
+ }
+
if (!config) {
config = method;
method = 'GET';
@@ -15,11 +30,25 @@ function createFormSchema (method, config) {
Object.keys(schema).forEach(key => {
schema[key].id = key;
- if (this.has(key)) {
+ if (this.has(key) && schema[key].type !== 'choice') {
schema[key]._value = this.get(key);
}
+
+ if (schema[key].type === 'choice') {
+ schema[key] = mungeSelectFromOptions(schema[key], this.get(key));
+ }
});
+ // necessary because authorization_grant_type is not changeable on update
+ if (method === 'put') {
+ schema.authorization_grant_type = mungeSelectFromOptions(Object.assign({}, this
+ .options('actions.GET.authorization_grant_type')), this
+ .get('authorization_grant_type'));
+
+ schema.authorization_grant_type._required = false;
+ schema.authorization_grant_type._disabled = true;
+ }
+
return schema;
}