From 5dd8c3ace2e4b85c04712b8707a0b50cd93e73dd Mon Sep 17 00:00:00 2001 From: AlanCoding Date: Mon, 10 Dec 2018 07:10:18 -0500 Subject: [PATCH] Allow SCM overwrite vars in the UI --- .../related/sources/add/sources-add.controller.js | 5 +---- .../related/sources/edit/sources-edit.controller.js | 8 +------- .../inventories/related/sources/sources.form.js | 2 +- 3 files changed, 3 insertions(+), 12 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js index f1515a81c9..c4c7521859 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/add/sources-add.controller.js @@ -185,10 +185,6 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', if (source === 'scm') { $scope.projectBasePath = GetBasePath('projects') + '?not__status=never updated'; - $scope.overwrite_vars = true; - $scope.inventory_source_form.inventory_file.$setPristine(); - } else { - $scope.overwrite_vars = false; } // reset fields @@ -201,6 +197,7 @@ export default ['$state', '$stateParams', '$scope', 'SourcesFormDefinition', $scope.credential_name = null; $scope.group_by = null; $scope.group_by_choices = []; + $scope.overwrite_vars = false; initRegionSelect(); }; // region / source options callback diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js index 6f3997fea0..0b18e937c8 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/edit/sources-edit.controller.js @@ -392,13 +392,6 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', }); } - if (source === 'scm') { - $scope.overwrite_vars = true; - $scope.inventory_source_form.inventory_file.$setPristine(); - } else { - $scope.overwrite_vars = false; - } - // reset fields $scope.group_by_choices = source === 'ec2' ? $scope.ec2_group_by : null; // azure_rm regions choices are keyed as "azure" in an OPTIONS request to the inventory_sources endpoint @@ -409,6 +402,7 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', $scope.credential_name = null; $scope.group_by = null; $scope.group_by_choices = []; + $scope.overwrite_vars = false; initRegionSelect(); diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js index 15a972c522..be72be5c19 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/sources/sources.form.js @@ -367,7 +367,7 @@ return { dataTitle: i18n._('Overwrite Variables'), dataContainer: 'body', dataPlacement: 'right', - ngDisabled: "(!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd) || source.value === 'scm')" + ngDisabled: "(!(inventory_source_obj.summary_fields.user_capabilities.edit || canAdd))" }, { name: 'update_on_launch', label: i18n._('Update on Launch'),