@@ -4,8 +4,6 @@ import { gql, useQuery } from '@apollo/client'
4
4
5
5
import Card from '@material-ui/core/Card'
6
6
import CardHeader from '@material-ui/core/CardHeader'
7
- import Table from '@material-ui/core/Table'
8
- import TableBody from '@material-ui/core/TableBody'
9
7
import TableCell from '@material-ui/core/TableCell'
10
8
import TableRow from '@material-ui/core/TableRow'
11
9
import Grid from '@material-ui/core/Grid'
@@ -26,31 +24,14 @@ export const ConfigurationV2Card = () => {
26
24
fetchPolicy : 'cache-and-network' ,
27
25
} )
28
26
29
- var user : string [ ] = [ ]
30
- if ( data != undefined ) {
31
- user = data ?. configv2 . user . split ( / \n / ) . map ( ( l ) => {
32
- return l
33
- } )
34
- } else {
35
- user = [ ]
36
- }
37
- var effective : string [ ] = [ ]
38
- if ( data != undefined ) {
39
- effective = data ?. configv2 . effective . split ( / \n / ) . map ( ( l ) => {
40
- return l
41
- } )
42
- } else {
43
- effective = [ ]
44
- }
45
-
46
27
return (
47
28
< >
48
29
< Grid item xs = { 12 } >
49
30
< TOMLCard
50
31
title = "TOML Configuration (user-specified)"
51
32
error = { error ?. message }
52
33
loading = { loading }
53
- entries = { user }
34
+ toml = { data ?. configv2 . user }
54
35
showHead
55
36
/>
56
37
</ Grid >
@@ -59,7 +40,7 @@ export const ConfigurationV2Card = () => {
59
40
title = "TOML Configuration (effective)"
60
41
error = { error ?. message }
61
42
loading = { loading }
62
- entries = { effective }
43
+ toml = { data ?. configv2 . effective }
63
44
showHead
64
45
/>
65
46
</ Grid >
@@ -68,7 +49,7 @@ export const ConfigurationV2Card = () => {
68
49
}
69
50
70
51
interface Props {
71
- entries : Array < string >
52
+ toml ?: string
72
53
loading : boolean
73
54
showHead ?: boolean
74
55
title ?: string
@@ -87,7 +68,7 @@ const FetchingRow = () => <SpanRow>...</SpanRow>
87
68
88
69
const ErrorRow : React . FC = ( { children } ) => < SpanRow > { children } </ SpanRow >
89
70
90
- const TOMLCard = ( { loading, entries , error = '' , title } : Props ) => {
71
+ const TOMLCard = ( { loading, toml , error = '' , title } : Props ) => {
91
72
if ( error ) {
92
73
return < ErrorRow > { error } </ ErrorRow >
93
74
}
@@ -96,18 +77,14 @@ const TOMLCard = ({ loading, entries, error = '', title }: Props) => {
96
77
return < FetchingRow />
97
78
}
98
79
80
+ let styles = { marginLeft : '1em' } ;
81
+
99
82
return (
100
83
< Card >
101
84
{ title && < CardHeader title = { title } /> }
102
- < Table >
103
- < TableBody >
104
- { entries . map ( ( k , i ) => (
105
- < TableRow key = { title + k + i } >
106
- < TableCell > { k } </ TableCell >
107
- </ TableRow >
108
- ) ) }
109
- </ TableBody >
110
- </ Table >
85
+ < pre style = { styles } >
86
+ < code > { toml } </ code >
87
+ </ pre >
111
88
</ Card >
112
89
)
113
90
}
0 commit comments