From 2084999e78756335646e6a0e26f135852116d35d Mon Sep 17 00:00:00 2001 From: Leigh Johnson Date: Wed, 2 Nov 2016 18:53:59 -0400 Subject: [PATCH] Fixes errors thrown when saving groups add / edit forms Fixes incorrect ng-required statement affecting group form validity --- awx/ui/client/src/forms/Groups.js | 9 +++++---- .../inventories/manage/groups/groups-add.controller.js | 4 ++-- .../inventories/manage/groups/groups-edit.controller.js | 2 +- .../src/inventories/manage/inventory-manage.route.js | 6 ++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/awx/ui/client/src/forms/Groups.js b/awx/ui/client/src/forms/Groups.js index 68a4d086eb..ea6efacb7a 100644 --- a/awx/ui/client/src/forms/Groups.js +++ b/awx/ui/client/src/forms/Groups.js @@ -76,7 +76,6 @@ export default ngShow: "source && source.value !== '' && source.value !== 'custom'", sourceModel: 'credential', sourceField: 'name', - ngClick: 'lookupCredential()', awRequiredWhen: { reqExpression: "cloudCredentialRequired", init: "false" @@ -146,12 +145,14 @@ export default label : "Custom Inventory Script", type: 'lookup', basePath: 'inventory_scripts', - list: 'InventoryScriptList', + list: 'InventoryScriptsList', ngShow: "source && source.value === 'custom'", sourceModel: 'inventory_script', sourceField: 'name', - ngClick: 'lookUpInventory_script()' , - ngRequired: "source && source.value === 'custom'", + awRequiredWhen: { + reqExpression: "source && source.value === 'custom'", + init: "false" + }, ngDisabled: '!(group_obj.summary_fields.user_capabilities.edit || canAdd)', }, custom_variables: { diff --git a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js index ede9a6ef26..2cea262a67 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-add.controller.js @@ -12,7 +12,7 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList form = GroupForm(); init(); - function init() {n + function init() { // apply form definition's default field values GenerateForm.applyDefaults(form, $scope); @@ -45,7 +45,7 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', 'CredentialList }; $scope.formSave = function() { - var params, source; + var params, source, json_data; json_data = ToJSON($scope.parseType, $scope.variables, true); // group fields var group = { diff --git a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js index 623e8036f4..0f4da392f0 100644 --- a/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js +++ b/awx/ui/client/src/inventories/manage/groups/groups-edit.controller.js @@ -61,7 +61,7 @@ export default ['$state', '$stateParams', '$scope', 'ToggleNotification', 'Parse $state.go('^'); }; $scope.formSave = function() { - var params, source; + var params, source, json_data; json_data = ToJSON($scope.parseType, $scope.variables, true); // group fields var group = { diff --git a/awx/ui/client/src/inventories/manage/inventory-manage.route.js b/awx/ui/client/src/inventories/manage/inventory-manage.route.js index fad6c87a62..ddcbf85e1d 100644 --- a/awx/ui/client/src/inventories/manage/inventory-manage.route.js +++ b/awx/ui/client/src/inventories/manage/inventory-manage.route.js @@ -31,7 +31,8 @@ export default { page: '1', order_by: 'name', }, - squash: true + squash: true, + dynamic: true }, host_search: { value: { @@ -39,7 +40,8 @@ export default { page: '1', order_by: 'name', }, - squash: true + squash: true, + dynamic: true } }, ncyBreadcrumb: {