Skip to content

Commit

Permalink
Show facets even when dataset has no fields.
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Dardzinski <[email protected]>
  • Loading branch information
JDarDagran committed Oct 26, 2022
1 parent db92c4f commit 857b87e
Showing 1 changed file with 33 additions and 27 deletions.
60 changes: 33 additions & 27 deletions web/src/components/datasets/DatasetInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,38 +21,44 @@ interface DatasetInfoProps {
const DatasetInfo: FunctionComponent<DatasetInfoProps> = props => {
const { datasetFields, facets, run } = props

let datasetFieldsBox;


if (datasetFields.length === 0) {
return <MqEmpty title={'No Fields'} body={'Try adding dataset fields.'} />
datasetFieldsBox = <MqEmpty title={'No Fields'} body={'Try adding dataset fields.'} />
}
else {
datasetFieldsBox = <Table size='small'>
<TableHead>
<TableRow>
{DATASET_COLUMNS.map(column => {
return (
<TableCell key={column} align='left'>
<MqText subheading inline>
{column}
</MqText>
</TableCell>
)
})}
</TableRow>
</TableHead>
<TableBody>
{datasetFields.map(field => {
return (
<TableRow key={field.name}>
<TableCell align='left'>{field.name}</TableCell>
<TableCell align='left'>{field.type}</TableCell>
<TableCell align='left'>{field.description || 'no description'}</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
}

return (
<Box>
<Table size='small'>
<TableHead>
<TableRow>
{DATASET_COLUMNS.map(column => {
return (
<TableCell key={column} align='left'>
<MqText subheading inline>
{column}
</MqText>
</TableCell>
)
})}
</TableRow>
</TableHead>
<TableBody>
{datasetFields.map(field => {
return (
<TableRow key={field.name}>
<TableCell align='left'>{field.name}</TableCell>
<TableCell align='left'>{field.type}</TableCell>
<TableCell align='left'>{field.description || 'no description'}</TableCell>
</TableRow>
)
})}
</TableBody>
</Table>
{datasetFieldsBox}
{facets && (
<Box mt={2}>
<Box mb={1}>
Expand Down

0 comments on commit 857b87e

Please sign in to comment.