use code-mirror directive for host facts

This commit is contained in:
Keith Grant
2019-03-19 15:07:10 -04:00
parent 5583af2a58
commit b6d8f9c6f6
3 changed files with 20 additions and 17 deletions

View File

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