From 5c79561b7df88dbb2df91576b91a373786d6c5f2 Mon Sep 17 00:00:00 2001 From: Michael Abashian Date: Thu, 27 Apr 2017 13:47:28 -0400 Subject: [PATCH] Fixed inventory codemirrors and tweaked delete source warning --- .../edit/inventory-edit.controller.js | 17 ++++++----------- .../groups/add/groups-add.controller.js | 8 ++++---- awx/ui/client/src/inventories/inventory.form.js | 3 ++- .../sources/list/sources-list.controller.js | 2 +- 4 files changed, 13 insertions(+), 17 deletions(-) diff --git a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js index 69ac5ccec3..0558be203a 100644 --- a/awx/ui/client/src/inventories/edit/inventory-edit.controller.js +++ b/awx/ui/client/src/inventories/edit/inventory-edit.controller.js @@ -20,7 +20,7 @@ function InventoriesEdit($scope, $location, form = InventoryForm, inventory_id = $stateParams.inventory_id, master = {}, - fld, json_data, data; + fld, data; ClearScope(); init(); @@ -45,9 +45,9 @@ function InventoriesEdit($scope, $location, .success(function(data) { var fld; for (fld in form.fields) { - if (fld === 'variables') { - $scope.variables = ParseVariableString(data.variables); - master.variables = $scope.variables; + if (fld === 'inventory_variables') { + $scope.inventory_variables = ParseVariableString(data.variables); + master.inventory_variables = $scope.variables; } else if (fld === 'inventory_name') { $scope[fld] = data.name; master[fld] = $scope[fld]; @@ -71,9 +71,9 @@ function InventoriesEdit($scope, $location, $scope.parseType = 'yaml'; ParseTypeChange({ scope: $scope, - variable: 'variables', + variable: 'inventory_variables', parse_variable: 'parseType', - field_id: 'inventory_variables' + field_id: 'inventory_inventory_variables' }); OrgAdminLookup.checkForAdminAccess({organization: data.organization}) @@ -83,8 +83,6 @@ function InventoriesEdit($scope, $location, $scope.inventory_obj = data; $scope.name = data.name; - - $scope.$emit('inventoryLoaded'); }) .error(function(data, status) { ProcessErrors($scope, data, status, null, { @@ -96,9 +94,6 @@ function InventoriesEdit($scope, $location, $scope.formSave = function() { Wait('start'); - // Make sure we have valid variable data - json_data = ToJSON($scope.parseType, $scope.variables); - data = {}; for (fld in form.fields) { if (form.fields[fld].realName) { diff --git a/awx/ui/client/src/inventories/groups/add/groups-add.controller.js b/awx/ui/client/src/inventories/groups/add/groups-add.controller.js index e8b8426c03..6b5f849b40 100644 --- a/awx/ui/client/src/inventories/groups/add/groups-add.controller.js +++ b/awx/ui/client/src/inventories/groups/add/groups-add.controller.js @@ -20,10 +20,10 @@ export default ['$state', '$stateParams', '$scope', 'GroupForm', // apply form definition's default field values GenerateForm.applyDefaults(form, $scope); - rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups") - .then(function(canAdd) { - $scope.canAdd = canAdd; - }); + rbacUiControlService.canAdd(GetBasePath('inventory') + $stateParams.inventory_id + "/groups") + .then(function(canAdd) { + $scope.canAdd = canAdd; + }); $scope.parseType = 'yaml'; $scope.envParseType = 'yaml'; ParseTypeChange({ diff --git a/awx/ui/client/src/inventories/inventory.form.js b/awx/ui/client/src/inventories/inventory.form.js index c79be281f4..822f561163 100644 --- a/awx/ui/client/src/inventories/inventory.form.js +++ b/awx/ui/client/src/inventories/inventory.form.js @@ -75,7 +75,8 @@ function(i18n, buildGroupsListState, buildGroupsAddState, buildGroupsEditState, ngDisabled: '!(inventory_obj.summary_fields.user_capabilities.edit || canAdd) || !canEditOrg', awLookupWhen: '(inventory_obj.summary_fields.user_capabilities.edit || canAdd) && canEditOrg' }, - variables: { + inventory_variables: { + realName: 'variables', label: i18n._('Variables'), type: 'textarea', class: 'Form-formGroup--fullWidth', diff --git a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js index 78411433d1..e6cfe4a51b 100644 --- a/awx/ui/client/src/inventories/sources/list/sources-list.controller.js +++ b/awx/ui/client/src/inventories/sources/list/sources-list.controller.js @@ -82,7 +82,7 @@ $state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id}); }; $scope.deleteSource = function(inventory_source){ - var body = '
Are you sure you want to permanently delete the inventory source below from the inventory?
' + $filter('sanitize')(inventory_source.name) + '
'; + var body = '
Are you sure you want to permanently delete the inventory source below from the inventory? Hosts generated by this inventory source will also be deleted.
' + $filter('sanitize')(inventory_source.name) + '
'; var action = function(){ delete $rootScope.promptActionBtnClass; Wait('start');