From db12f96e20afdb90eb54015579692def67b19851 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 19 Nov 2021 10:02:29 -0600 Subject: improve layout of edit/view --- src/web/src/components/System/Options/Edit.js | 16 ++++++++------ src/web/src/components/System/Options/View.js | 32 ++++++++++++++++++++++----- src/web/src/components/System/System.css | 10 +++++++++ 3 files changed, 46 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/web/src/components/System/Options/Edit.js b/src/web/src/components/System/Options/Edit.js index 6623e034..dfcb0072 100644 --- a/src/web/src/components/System/Options/Edit.js +++ b/src/web/src/components/System/Options/Edit.js @@ -56,23 +56,25 @@ const Edit = ({ cancelAction }) => { return ( <> -
- - -
- {yamlError && {yamlError}} update(e.target.value)} padding={10} style={{ - marginTop: 14, border: '1px solid #d4d4d5', - backgroundColor: '#f5f5f5', + backgroundColor: 'rgb(250, 250, 250)', + fontSize: '1em', fontFamily: 'ui-monospace,SFMono-Regular,SF Mono,Consolas,Liberation Mono,Menlo,monospace', + overflow: 'auto', + height: yamlError ? 'calc(100vh - 316px)' : 'calc(100vh - 254px)' }} /> + {yamlError && {yamlError}} +
+ + +
); } diff --git a/src/web/src/components/System/Options/View.js b/src/web/src/components/System/Options/View.js index f232c61d..980a90d8 100644 --- a/src/web/src/components/System/Options/View.js +++ b/src/web/src/components/System/Options/View.js @@ -1,15 +1,37 @@ import React from 'react'; -import { Button, Table } from 'semantic-ui-react'; +import yaml from 'yaml'; + +import { Icon, Button } from 'semantic-ui-react'; +import CodeEditor from '@uiw/react-textarea-code-editor'; const View = ({ options, editAction }) => { const { remoteConfiguration } = options; + const doc = new yaml.Document(); + doc.contents = options; + + const optionsAsYaml = doc.toString(); + return ( <> - {remoteConfiguration &&
- -
} -
{JSON.stringify(options, null, 2)}
+ +
+ {remoteConfiguration ? + : + } +
); } diff --git a/src/web/src/components/System/System.css b/src/web/src/components/System/System.css index 63817287..3a930667 100644 --- a/src/web/src/components/System/System.css +++ b/src/web/src/components/System/System.css @@ -26,4 +26,14 @@ .full-height { height: calc(100vh - 175px); +} + +.yaml-error { + white-space: nowrap; + overflow: overlay; +} + +.footer-buttons { + margin-top: 14px; + text-align: right; } \ No newline at end of file -- cgit v1.2.3