1
0
mirror of https://github.com/ansible/awx.git synced 2024-11-01 08:21:15 +03:00

fix CodeMirror vars in host add/edit view, resolves #2518 (#2590)

This commit is contained in:
Leigh Johnson 2016-06-23 09:52:05 -04:00 committed by GitHub
parent a22cbebcb9
commit e7615edd91
2 changed files with 3 additions and 7 deletions

View File

@ -10,7 +10,6 @@
var generator = GenerateForm, var generator = GenerateForm,
form = HostForm; form = HostForm;
$scope.parseType = 'yaml'; $scope.parseType = 'yaml';
$scope.extraVars = '---';
$scope.formCancel = function(){ $scope.formCancel = function(){
$state.go('^'); $state.go('^');
}; };
@ -19,7 +18,7 @@
}; };
$scope.formSave = function(){ $scope.formSave = function(){
var params = { var params = {
variables: $scope.extraVars === '---' || $scope.extraVars === '{}' ? null : $scope.extraVars, variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
name: $scope.name, name: $scope.name,
description: $scope.description, description: $scope.description,
enabled: $scope.host.enabled, enabled: $scope.host.enabled,
@ -43,7 +42,6 @@
ParseTypeChange({ ParseTypeChange({
scope: $scope, scope: $scope,
field_id: 'host_variables', field_id: 'host_variables',
variable: 'extraVars',
}); });
}; };
init(); init();

View File

@ -19,7 +19,7 @@
$scope.formSave = function(){ $scope.formSave = function(){
var host = { var host = {
id: $scope.host.id, id: $scope.host.id,
variables: $scope.extraVars === '---' || $scope.extraVars === '{}' ? null : $scope.extraVars, variables: $scope.variables === '---' || $scope.variables === '{}' ? null : $scope.variables,
name: $scope.name, name: $scope.name,
description: $scope.description, description: $scope.description,
enabled: $scope.host.enabled enabled: $scope.host.enabled
@ -30,15 +30,13 @@
}; };
var init = function(){ var init = function(){
$scope.host = host; $scope.host = host;
$scope.extraVars = host.variables === '' ? '---' : host.variables;
generator.inject(form, {mode: 'edit', related: false, id: 'Inventory-hostManage--panel', scope: $scope}); generator.inject(form, {mode: 'edit', related: false, id: 'Inventory-hostManage--panel', scope: $scope});
$scope.extraVars = $scope.host.variables === '' ? '---' : $scope.host.variables; $scope.variables = host.variables === '' ? '---' : host.variables;
$scope.name = host.name; $scope.name = host.name;
$scope.description = host.description; $scope.description = host.description;
ParseTypeChange({ ParseTypeChange({
scope: $scope, scope: $scope,
field_id: 'host_variables', field_id: 'host_variables',
variable: 'extraVars',
}); });
}; };
init(); init();