Fixed inventory codemirrors and tweaked delete source warning

This commit is contained in:
Michael Abashian 2017-04-27 13:47:28 -04:00 committed by Jared Tabor
parent 832e55f964
commit 5c79561b7d
4 changed files with 13 additions and 17 deletions

View File

@ -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) {

View File

@ -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({

View File

@ -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',

View File

@ -82,7 +82,7 @@
$state.go('inventories.edit.inventory_sources.edit', {inventory_source_id: id});
};
$scope.deleteSource = function(inventory_source){
var body = '<div class=\"Prompt-bodyQuery\">Are you sure you want to permanently delete the inventory source below from the inventory?</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
var body = '<div class=\"Prompt-bodyQuery\">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.</div><div class=\"Prompt-bodyTarget\">' + $filter('sanitize')(inventory_source.name) + '</div>';
var action = function(){
delete $rootScope.promptActionBtnClass;
Wait('start');