Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add available column level tags #2606

Merged
merged 3 commits into from
Sep 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions web/src/components/datasets/DatasetInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ import MqJsonView from '../core/json-view/MqJsonView'
import MqText from '../core/text/MqText'
import React, { FunctionComponent, useEffect } from 'react'
import RunStatus from '../jobs/RunStatus'
import { Chip } from '@mui/material'
import { createTheme } from '@mui/material/styles'
import { useTheme } from '@emotion/react'

export interface DispatchProps {
fetchJobFacets: typeof fetchJobFacets
Expand All @@ -39,6 +42,22 @@ type DatasetInfoProps = {
} & JobFacetsProps &
DispatchProps

const formatColumnTags = (tags: string[]) => {
const theme = createTheme(useTheme())
return (
<>
{tags.map((tag, index) => (
<Chip
key={tag}
label={tag}
size="small"
style={{display: 'inline', marginRight: index < tags.length - 1 ? theme.spacing(1) : 0}}
/>
))}
</>
)
}

const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
const { datasetFields, facets, run, jobFacets, fetchJobFacets, resetFacets } = props
const i18next = require('i18next')
Expand Down Expand Up @@ -82,6 +101,11 @@ const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
{i18next.t('dataset_info_columns.description')}
</MqText>
</TableCell>
<TableCell align='left'>
<MqText subheading inline>
{i18next.t('dataset_info_columns.tags')}
</MqText>
</TableCell>
</TableRow>
</TableHead>
<TableBody>
Expand All @@ -91,6 +115,7 @@ const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
<TableCell align='left'>{field.name}</TableCell>
<TableCell align='left'>{field.type}</TableCell>
<TableCell align='left'>{field.description || 'no description'}</TableCell>
<TableCell align='left'>{formatColumnTags(field.tags)}</TableCell>
</TableRow>
)
})}
Expand Down
12 changes: 8 additions & 4 deletions web/src/i18n/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ i18next
dataset_info_columns: {
name: 'NAME',
type: 'TYPE',
description: 'DESCRIPTION'
description: 'DESCRIPTION',
tags: 'TAGS'
},
dataset_versions_columns: {
version: 'VERSION',
Expand Down Expand Up @@ -244,7 +245,8 @@ i18next
dataset_info_columns: {
name: 'NOM',
type: 'TAPER',
description: 'DESCRIPTION'
description: 'DESCRIPTION',
tags: 'MOTS CLÉS'
},
dataset_versions_columns: {
version: 'VERSION',
Expand Down Expand Up @@ -371,7 +373,8 @@ i18next
dataset_info_columns: {
name: 'NOMBRE',
type: 'ESCRIBE',
description: 'DESCRIPCIÓN'
description: 'DESCRIPCIÓN',
tags: 'ETIQUETAS'
},
dataset_versions_columns: {
version: 'VERSIÓN',
Expand Down Expand Up @@ -498,7 +501,8 @@ i18next
dataset_info_columns: {
name: 'NAZWA',
type: 'RODZAJ',
description: 'OPIS'
description: 'OPIS',
tags: 'TAGI'
},
dataset_versions_columns: {
version: 'WERSJA',
Expand Down
Loading