Added YAML support to Host and Group variable data. User can enter variables in either format, UI will parse it and send to API as JSON. Fixed post to /hosts/N/variable_data and /groups/N/variable_data so that JSON is sent as an object rather than a string.

This commit is contained in:
chouseknecht
2013-06-11 17:23:08 -04:00
parent 65c8176507
commit c8c9e62b4c
10 changed files with 180 additions and 52 deletions

View File

@@ -34,14 +34,13 @@ angular.module('GroupFormDefinition', [])
addRequired: false,
editRequird: false,
rows: 10,
"class": 'modal-input-xlarge',
"default": "\{\}",
dataTitle: 'Group Variables',
dataPlacement: 'right',
awPopOver: '<p>Enter variables as JSON. Both the key and value must be wrapped in double quotes. ' +
'Separate variables with commas, and wrap the entire string with { }. ' +
'&nbsp;For example:</p><p>{<br\>&quot;ntp_server&quot;: &quot;ntp.example.com&quot;,<br \>' +
'&quot;proxy&quot;: &quot;proxy.example.com&quot;<br \>}</p><p>See additional JSON examples at <a href="' +
'http://www.json.org" target="_blank">www.json.org</a></p>'
awPopOver: "<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
'<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
'<p>View YAML examples at <a href="http://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansiblewors.com</a></p>'
}
},

View File

@@ -39,12 +39,11 @@ angular.module('HostFormDefinition', [])
addRequired: false,
editRequird: false,
rows: 10,
"class": "modal-input-xlarge",
"default": "\{\}",
awPopOver: "<p>Enter variables as JSON. Both the key and value must be wrapped in double quotes. " +
"Separate variables with commas, and wrap the entire string with { }. " +
"&nbsp;For example:</p><p>{<br\>&quot;ntp_server&quot;: &quot;ntp.example.com&quot;,<br \>" +
'&quot;proxy&quot;: &quot;proxy.example.com&quot;<br \>}</p><p>See additional JSON examples at <a href="' +
'http://www.json.org" target="_blank">www.json.org</a></p>',
awPopOver: "<p>Enter variables using either JSON or YAML syntax. Use the radio button to toggle between the two.</p>" +
'<p>View JSON examples at <a href="http://www.json.org" target="_blank">www.json.org</a></p>' +
'<p>View YAML examples at <a href="http://www.ansibleworks.com/docs/YAMLSyntax.html" target="_blank">ansiblewors.com</a></p>',
dataTitle: 'Host Variables',
dataPlacement: 'right'
}