From de76cbf2b466362cf03fda3b2c52b74d4d96dd10 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 27 Nov 2021 13:40:55 -0600 Subject: display state as yaml --- src/web/src/components/System/Info.js | 27 +++++++++++++++++---------- src/web/src/components/System/System.css | 6 +++++- 2 files changed, 22 insertions(+), 11 deletions(-) (limited to 'src') diff --git a/src/web/src/components/System/Info.js b/src/web/src/components/System/Info.js index ee132aec..8d7db123 100644 --- a/src/web/src/components/System/Info.js +++ b/src/web/src/components/System/Info.js @@ -1,13 +1,20 @@ -import React, { Component } from 'react'; - -class Info extends Component { - render = () => { - return ( -
-
{JSON.stringify(this.props.state, null, 2)}
-
- ); - } +import React from 'react'; +import YAML from 'yaml'; + +import CodeEditor from '../Shared/CodeEditor'; + +const Info = ({ state }) => { + const stateAsYaml = YAML.stringify(state, { simpleKeys: true, sortMapEntries: true }) + + return ( +
+ +
+ ); } export default Info; \ No newline at end of file diff --git a/src/web/src/components/System/System.css b/src/web/src/components/System/System.css index 3d1594b7..1e9c4a5d 100644 --- a/src/web/src/components/System/System.css +++ b/src/web/src/components/System/System.css @@ -38,11 +38,15 @@ text-align: right; } -.view-code-container, .edit-code-container, .edit-code-container-error { +.state-code-editor, .view-code-container, .edit-code-container, .edit-code-container-error { border: 1px solid #d4d4d5; overflow: auto; } +.state-code-container { + height: calc(100vh - 204px); +} + .view-code-container { height: calc(100vh - 254px); } -- cgit v1.2.3