mirror of
https://github.com/ansible/awx.git
synced 2026-01-18 21:21:21 -03:30
use code-mirror directive for host facts
This commit is contained in:
parent
5583af2a58
commit
b6d8f9c6f6
@ -77,6 +77,14 @@ function atCodeMirrorController (
|
||||
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 === '{}') {
|
||||
return '---';
|
||||
} else if (IsJsonString(str)) {
|
||||
|
||||
@ -4,25 +4,17 @@
|
||||
* All Rights Reserved
|
||||
*************************************************/
|
||||
|
||||
function AnsibleFacts($scope, Facts, ParseTypeChange, ParseVariableString) {
|
||||
function AnsibleFacts($scope, Facts) {
|
||||
|
||||
function init() {
|
||||
$scope.facts = ParseVariableString(Facts);
|
||||
$scope.facts = Facts;
|
||||
let rows = (_.isEmpty(Facts)) ? 6 : 20;
|
||||
$("#host_facts").attr("rows", rows);
|
||||
$scope.parseType = 'yaml';
|
||||
ParseTypeChange({
|
||||
scope: $scope,
|
||||
variable: 'facts',
|
||||
parse_variable: 'parseType',
|
||||
field_id: 'host_facts',
|
||||
readOnly: true
|
||||
});
|
||||
}
|
||||
|
||||
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="">
|
||||
<div class="form-group Form-formGroup Form-formGroup--fullWidth">
|
||||
<label class="Form-inputLabelContainer " for="facts">
|
||||
<span class="Form-inputLabel" translate>FACTS</span>
|
||||
</label>
|
||||
<div>
|
||||
<textarea rows="6" ng-model="facts" name="facts" class="form-control Form-textArea Form-formGroup--fullWidth" id="host_facts"></textarea>
|
||||
</div>
|
||||
<at-code-mirror
|
||||
id="host_facts"
|
||||
name="facts"
|
||||
class="Form-textArea Form-formGroup--fullWidth"
|
||||
label="facts"
|
||||
variables="facts"
|
||||
tooltip=""
|
||||
disabled="true"
|
||||
></at-code-mirror>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user