From 32cb18fc857641077c372bfaa486b87ffe7bd094 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Fri, 10 Nov 2017 16:09:00 -0800 Subject: [PATCH] removing codemirror instantiation from $transition event --- .../groups/edit/groups-edit.controller.js | 17 ++++++----------- .../edit/smart-inventory-edit.controller.js | 19 ++++++++----------- .../edit/inventory-edit.controller.js | 19 +++++++------------ 3 files changed, 21 insertions(+), 34 deletions(-) diff --git a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js index 149381f22a..b185bf9c99 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/related/groups/edit/groups-edit.controller.js @@ -6,10 +6,8 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbacUiControlService', 'ToJSON', 'ParseTypeChange', 'GroupsService', 'GetChoices', 'GetBasePath', 'CreateSelect2', 'groupData', '$rootScope', - '$transitions', function($state, $stateParams, $scope, ParseVariableString, rbacUiControlService, ToJSON, - ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope, - $transitions) { + ParseTypeChange, GroupsService, GetChoices, GetBasePath, CreateSelect2, groupData, $rootScope) { init(); @@ -32,14 +30,11 @@ export default ['$state', '$stateParams', '$scope', 'ParseVariableString', 'rbac $scope.parseType = 'yaml'; $scope.envParseType = 'yaml'; - $transitions.onSuccess({}, function(trans) { - if(trans.to().name === 'inventories.edit.groups.edit') { - ParseTypeChange({ - scope: $scope, - field_id: 'group_group_variables', - variable: 'group_variables', - }); - } + + ParseTypeChange({ + scope: $scope, + field_id: 'group_group_variables', + variable: 'group_variables', }); } diff --git a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js index 7890b7b19c..7af348d0d1 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/smart-inventory/edit/smart-inventory-edit.controller.js @@ -8,7 +8,7 @@ function SmartInventoryEdit($scope, $location, $stateParams, InventoryForm, Rest, ProcessErrors, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, $state, OrgAdminLookup, resourceData, - $rootScope, InstanceGroupsService, InstanceGroupsData, $transitions) { + $rootScope, InstanceGroupsService, InstanceGroupsData) { // Inject dynamic view var defaultUrl = GetBasePath('inventory'), @@ -37,15 +37,12 @@ function SmartInventoryEdit($scope, $location, $scope.parseType = 'yaml'; - $transitions.onSuccess({}, function(trans) { - if(trans.to().name === 'inventories.editSmartInventory') { - ParseTypeChange({ - scope: $scope, - variable: 'smartinventory_variables', - parse_variable: 'parseType', - field_id: 'smartinventory_smartinventory_variables' - }); - } + + ParseTypeChange({ + scope: $scope, + variable: 'smartinventory_variables', + parse_variable: 'parseType', + field_id: 'smartinventory_smartinventory_variables' }); OrgAdminLookup.checkForAdminAccess({organization: inventoryData.organization}) @@ -109,5 +106,5 @@ export default [ '$scope', '$location', 'ProcessErrors', 'GetBasePath', 'ParseTypeChange', 'Wait', 'ToJSON', 'ParseVariableString', '$state', 'OrgAdminLookup', 'resourceData', - '$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', '$transitions', SmartInventoryEdit + '$rootScope', 'InstanceGroupsService', 'InstanceGroupsData', SmartInventoryEdit ]; diff --git a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js index f6fb23cb56..37911d6afe 100644 --- a/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories-hosts/inventories/standard-inventory/edit/inventory-edit.controller.js @@ -14,8 +14,7 @@ function InventoriesEdit($scope, $location, $stateParams, InventoryForm, Rest, ProcessErrors, GetBasePath, ParseTypeChange, Wait, ToJSON, ParseVariableString, $state, OrgAdminLookup, $rootScope, resourceData, - CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate, - $transitions) { + CreateSelect2, InstanceGroupsService, InstanceGroupsData, CanRemediate) { // Inject dynamic view let defaultUrl = GetBasePath('inventory'), @@ -41,15 +40,11 @@ function InventoriesEdit($scope, $location, $scope.instance_groups = InstanceGroupsData; $scope.canRemediate = CanRemediate; - $transitions.onSuccess({}, function(trans) { - if(trans.to().name === 'inventories.edit') { - ParseTypeChange({ - scope: $scope, - variable: 'inventory_variables', - parse_variable: 'parseType', - field_id: 'inventory_inventory_variables' - }); - } + ParseTypeChange({ + scope: $scope, + variable: 'inventory_variables', + parse_variable: 'parseType', + field_id: 'inventory_inventory_variables' }); OrgAdminLookup.checkForAdminAccess({organization: inventoryData.organization}) @@ -120,5 +115,5 @@ export default ['$scope', '$location', 'ToJSON', 'ParseVariableString', '$state', 'OrgAdminLookup', '$rootScope', 'resourceData', 'CreateSelect2', 'InstanceGroupsService', 'InstanceGroupsData', 'CanRemediate', - '$transitions', InventoriesEdit, + InventoriesEdit, ];