From 9b4b952d585cdc1205b9cf93b99071052413f399 Mon Sep 17 00:00:00 2001 From: Jordan Krage Date: Wed, 26 Oct 2022 17:31:48 -0500 Subject: [PATCH] ConfigurationV2Card: swap out toml table for code block --- .../ConfigurationV2Card.tsx | 41 ++++--------------- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx b/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx index db5fae05..bb23057d 100644 --- a/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx +++ b/src/screens/Configuration/ConfigurationV2Card/ConfigurationV2Card.tsx @@ -4,8 +4,6 @@ import { gql, useQuery } from '@apollo/client' import Card from '@material-ui/core/Card' import CardHeader from '@material-ui/core/CardHeader' -import Table from '@material-ui/core/Table' -import TableBody from '@material-ui/core/TableBody' import TableCell from '@material-ui/core/TableCell' import TableRow from '@material-ui/core/TableRow' import Grid from '@material-ui/core/Grid' @@ -26,23 +24,6 @@ export const ConfigurationV2Card = () => { fetchPolicy: 'cache-and-network', }) - var user: string[] = [] - if (data != undefined) { - user = data?.configv2.user.split(/\n/).map((l) => { - return l - }) - } else { - user = [] - } - var effective: string[] = [] - if (data != undefined) { - effective = data?.configv2.effective.split(/\n/).map((l) => { - return l - }) - } else { - effective = [] - } - return ( <> @@ -50,7 +31,7 @@ export const ConfigurationV2Card = () => { title="TOML Configuration (user-specified)" error={error?.message} loading={loading} - entries={user} + toml={data?.configv2.user} showHead /> @@ -59,7 +40,7 @@ export const ConfigurationV2Card = () => { title="TOML Configuration (effective)" error={error?.message} loading={loading} - entries={effective} + toml={data?.configv2.effective} showHead /> @@ -68,7 +49,7 @@ export const ConfigurationV2Card = () => { } interface Props { - entries: Array + toml?: string loading: boolean showHead?: boolean title?: string @@ -87,7 +68,7 @@ const FetchingRow = () => ... const ErrorRow: React.FC = ({ children }) => {children} -const TOMLCard = ({ loading, entries, error = '', title }: Props) => { +const TOMLCard = ({ loading, toml, error = '', title }: Props) => { if (error) { return {error} } @@ -96,18 +77,14 @@ const TOMLCard = ({ loading, entries, error = '', title }: Props) => { return } + let styles = {marginLeft: '1em'}; + return ( {title && } - - - {entries.map((k, i) => ( - - {k} - - ))} - -
+
+          {toml}
+        
) }