From c51501223ccd9592681efe9e969f6498f82da77f Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 31 Mar 2016 12:00:28 -0700 Subject: [PATCH] Fixing scope passed to CodeMirror factory on hosts route --- .../manage-groups.directive.controller.js | 4 ++-- .../manage-hosts.directive.controller.js | 22 ++++++++++--------- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/awx/ui/client/src/inventories/manage/manage-groups/directive/manage-groups.directive.controller.js b/awx/ui/client/src/inventories/manage/manage-groups/directive/manage-groups.directive.controller.js index 158d6653ec..7aac4efb9d 100644 --- a/awx/ui/client/src/inventories/manage/manage-groups/directive/manage-groups.directive.controller.js +++ b/awx/ui/client/src/inventories/manage/manage-groups/directive/manage-groups.directive.controller.js @@ -453,7 +453,7 @@ function manageGroupsDirectiveController($filter, $rootScope, $location, $log, $ // Cancel modal_scope.cancelPanel = function() { Wait('stop'); - $state.go('inventoryManage', {}, {reload: true}) + $state.go('inventoryManage', {}, {reload: true}); }; // Save @@ -539,7 +539,7 @@ function manageGroupsDirectiveController($filter, $rootScope, $location, $log, $ angular.extend(vm, { cancelPanel : modal_scope.cancelPanel, saveGroup: modal_scope.saveGroup - }) + }); } export default ['$filter', '$rootScope', '$location', '$log', '$stateParams', '$compile', '$state', '$scope', 'Rest', 'Alert', 'GroupForm', 'GenerateForm', diff --git a/awx/ui/client/src/inventories/manage/manage-hosts/directive/manage-hosts.directive.controller.js b/awx/ui/client/src/inventories/manage/manage-hosts/directive/manage-hosts.directive.controller.js index 90190143f3..b14bed39e6 100644 --- a/awx/ui/client/src/inventories/manage/manage-hosts/directive/manage-hosts.directive.controller.js +++ b/awx/ui/client/src/inventories/manage/manage-hosts/directive/manage-hosts.directive.controller.js @@ -40,16 +40,6 @@ function manageHostsDirectiveController($rootScope, $location, $log, $stateParam cancelButton: false }); generator.reset(); - console.info(angular.element(document.getElementById('host_variables'))); - - $scope.parseType = 'yaml'; - ParseTypeChange({ - scope: form_scope, - variable: 'variables', - parse_variable: 'parseType', - field_id: 'host_variables' - }); - // Retrieve detail record and prepopulate the form if (mode === 'edit') { @@ -75,6 +65,12 @@ function manageHostsDirectiveController($rootScope, $location, $log, $stateParam } scope.variable_url = data.related.variable_data; scope.has_inventory_sources = data.has_inventory_sources; + scope.parseType = 'yaml'; + ParseTypeChange({ + scope: scope, + field_id: 'host_variables', + }); + }) .error(function(data, status) { ProcessErrors(parent_scope, data, status, form, { @@ -99,6 +95,12 @@ function manageHostsDirectiveController($rootScope, $location, $log, $stateParam scope.variables = '---'; defaultUrl = data.related.hosts; //scope.$emit('hostVariablesLoaded'); + scope.parseType = 'yaml'; + ParseTypeChange({ + scope: scope, + field_id: 'host_variables', + }); + }) .error(function(data, status) { ProcessErrors(parent_scope, data, status, form, {