mirror of
https://github.com/ansible/awx.git
synced 2026-05-08 01:47:35 -02:30
use code-mirror directive for host facts
This commit is contained in:
@@ -77,6 +77,14 @@ function atCodeMirrorController (
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (typeof str !== 'string') {
|
||||||
|
const yamlStr = jsyaml.safeDump(str);
|
||||||
|
// jsyaml.safeDump doesn't process an empty object correctly
|
||||||
|
if (yamlStr === '{}\n') {
|
||||||
|
return '---';
|
||||||
|
}
|
||||||
|
return yamlStr;
|
||||||
|
}
|
||||||
if (str === '' || str === '{}') {
|
if (str === '' || str === '{}') {
|
||||||
return '---';
|
return '---';
|
||||||
} else if (IsJsonString(str)) {
|
} else if (IsJsonString(str)) {
|
||||||
|
|||||||
@@ -4,25 +4,17 @@
|
|||||||
* All Rights Reserved
|
* All Rights Reserved
|
||||||
*************************************************/
|
*************************************************/
|
||||||
|
|
||||||
function AnsibleFacts($scope, Facts, ParseTypeChange, ParseVariableString) {
|
function AnsibleFacts($scope, Facts) {
|
||||||
|
|
||||||
function init() {
|
function init() {
|
||||||
$scope.facts = ParseVariableString(Facts);
|
$scope.facts = Facts;
|
||||||
let rows = (_.isEmpty(Facts)) ? 6 : 20;
|
let rows = (_.isEmpty(Facts)) ? 6 : 20;
|
||||||
$("#host_facts").attr("rows", rows);
|
$("#host_facts").attr("rows", rows);
|
||||||
$scope.parseType = 'yaml';
|
$scope.parseType = 'yaml';
|
||||||
ParseTypeChange({
|
|
||||||
scope: $scope,
|
|
||||||
variable: 'facts',
|
|
||||||
parse_variable: 'parseType',
|
|
||||||
field_id: 'host_facts',
|
|
||||||
readOnly: true
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init();
|
init();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export default ['$scope', 'Facts', 'ParseTypeChange', 'ParseVariableString', AnsibleFacts
|
export default ['$scope', 'Facts', AnsibleFacts];
|
||||||
];
|
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
<form class="Form ng-pristine ng-valid ng-valid-required" name="host_form" id="host_form" autocomplete="off" novalidate="">
|
<form class="Form ng-pristine ng-valid ng-valid-required" name="host_form" id="host_form" autocomplete="off" novalidate="">
|
||||||
<div class="form-group Form-formGroup Form-formGroup--fullWidth">
|
<div class="form-group Form-formGroup Form-formGroup--fullWidth">
|
||||||
<label class="Form-inputLabelContainer " for="facts">
|
<at-code-mirror
|
||||||
<span class="Form-inputLabel" translate>FACTS</span>
|
id="host_facts"
|
||||||
</label>
|
name="facts"
|
||||||
<div>
|
class="Form-textArea Form-formGroup--fullWidth"
|
||||||
<textarea rows="6" ng-model="facts" name="facts" class="form-control Form-textArea Form-formGroup--fullWidth" id="host_facts"></textarea>
|
label="facts"
|
||||||
</div>
|
variables="facts"
|
||||||
|
tooltip=""
|
||||||
|
disabled="true"
|
||||||
|
></at-code-mirror>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in New Issue
Block a user