Skip to content

Commit 857b87e

Browse files
committed
Show facets even when dataset has no fields.
Signed-off-by: Jakub Dardzinski <kuba0221@gmail.com>
1 parent db92c4f commit 857b87e

1 file changed

Lines changed: 33 additions & 27 deletions

File tree

web/src/components/datasets/DatasetInfo.tsx

Lines changed: 33 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -21,38 +21,44 @@ interface DatasetInfoProps {
2121
const DatasetInfo: FunctionComponent<DatasetInfoProps> = props => {
2222
const { datasetFields, facets, run } = props
2323

24+
let datasetFieldsBox;
25+
26+
2427
if (datasetFields.length === 0) {
25-
return <MqEmpty title={'No Fields'} body={'Try adding dataset fields.'} />
28+
datasetFieldsBox = <MqEmpty title={'No Fields'} body={'Try adding dataset fields.'} />
29+
}
30+
else {
31+
datasetFieldsBox = <Table size='small'>
32+
<TableHead>
33+
<TableRow>
34+
{DATASET_COLUMNS.map(column => {
35+
return (
36+
<TableCell key={column} align='left'>
37+
<MqText subheading inline>
38+
{column}
39+
</MqText>
40+
</TableCell>
41+
)
42+
})}
43+
</TableRow>
44+
</TableHead>
45+
<TableBody>
46+
{datasetFields.map(field => {
47+
return (
48+
<TableRow key={field.name}>
49+
<TableCell align='left'>{field.name}</TableCell>
50+
<TableCell align='left'>{field.type}</TableCell>
51+
<TableCell align='left'>{field.description || 'no description'}</TableCell>
52+
</TableRow>
53+
)
54+
})}
55+
</TableBody>
56+
</Table>
2657
}
2758

2859
return (
2960
<Box>
30-
<Table size='small'>
31-
<TableHead>
32-
<TableRow>
33-
{DATASET_COLUMNS.map(column => {
34-
return (
35-
<TableCell key={column} align='left'>
36-
<MqText subheading inline>
37-
{column}
38-
</MqText>
39-
</TableCell>
40-
)
41-
})}
42-
</TableRow>
43-
</TableHead>
44-
<TableBody>
45-
{datasetFields.map(field => {
46-
return (
47-
<TableRow key={field.name}>
48-
<TableCell align='left'>{field.name}</TableCell>
49-
<TableCell align='left'>{field.type}</TableCell>
50-
<TableCell align='left'>{field.description || 'no description'}</TableCell>
51-
</TableRow>
52-
)
53-
})}
54-
</TableBody>
55-
</Table>
61+
{datasetFieldsBox}
5662
{facets && (
5763
<Box mt={2}>
5864
<Box mb={1}>

0 commit comments

Comments
 (0)