22// SPDX-License-Identifier: Apache-2.0
33
44import * as Redux from 'redux'
5- import { Box , Button , Switch , Tab , Tabs , createTheme } from '@mui/material'
5+ import {
6+ Box ,
7+ Button ,
8+ Divider ,
9+ FormControlLabel ,
10+ Grid ,
11+ Switch ,
12+ Tab ,
13+ Tabs ,
14+ createTheme ,
15+ } from '@mui/material'
16+ import { CalendarIcon } from '@mui/x-date-pickers'
617import { CircularProgress } from '@mui/material'
718import { DatasetVersion } from '../../types/api'
819import { IState } from '../../store/reducers'
920import { LineageDataset } from '../lineage/types'
21+ import { MqInfo } from '../core/info/MqInfo'
1022import { alpha } from '@mui/material/styles'
1123import { bindActionCreators } from 'redux'
1224import { connect } from 'react-redux'
@@ -19,19 +31,20 @@ import {
1931 resetDatasetVersions ,
2032 setTabIndex ,
2133} from '../../store/actionCreators'
34+ import { formatUpdatedAt } from '../../helpers'
2235import { useNavigate , useSearchParams } from 'react-router-dom'
2336import { useTheme } from '@emotion/react'
2437import CloseIcon from '@mui/icons-material/Close'
25- import DatasetColumnLineage from './DatasetColumnLineage'
2638import DatasetInfo from './DatasetInfo'
2739import DatasetTags from './DatasetTags'
2840import DatasetVersions from './DatasetVersions'
2941import Dialog from '../Dialog'
3042import IconButton from '@mui/material/IconButton'
31- import Io from '../io/Io '
43+ import ListIcon from '@mui/icons-material/List '
3244import MqStatus from '../core/status/MqStatus'
3345import MqText from '../core/text/MqText'
3446import React , { ChangeEvent , FunctionComponent , useEffect , useState } from 'react'
47+ import StorageIcon from '@mui/icons-material/Storage'
3548
3649interface StateProps {
3750 lineageDataset : LineageDataset
@@ -95,7 +108,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
95108 } , [ lineageDataset . name ] )
96109
97110 useEffect ( ( ) => {
98- if ( showTags === true ) {
111+ if ( showTags ) {
99112 fetchDatasetVersions ( lineageDataset . namespace , lineageDataset . name )
100113 }
101114 } , [ showTags ] )
@@ -111,9 +124,9 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
111124 setTabIndex ( newValue )
112125 }
113126
114- if ( versionsLoading ) {
127+ if ( versionsLoading && versions . length === 0 ) {
115128 return (
116- < Box display = { 'flex' } justifyContent = { 'center' } >
129+ < Box display = { 'flex' } justifyContent = { 'center' } mt = { 2 } >
117130 < CircularProgress color = 'primary' />
118131 </ Box >
119132 )
@@ -145,6 +158,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
145158 < Box mr = { 1 } >
146159 < Button
147160 variant = 'outlined'
161+ size = { 'small' }
148162 sx = { {
149163 borderColor : theme . palette . error . main ,
150164 color : theme . palette . error . main ,
@@ -174,55 +188,86 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
174188 </ IconButton >
175189 </ Box >
176190 </ Box >
177- < Box display = { 'flex' } justifyContent = { 'space-between' } mb = { 2 } >
178- < Box sx = { { borderBottom : 1 , borderColor : 'divider' , width : '100%' } } >
179- < Tabs
180- value = { tabIndex }
181- onChange = { handleChange }
182- textColor = 'primary'
183- indicatorColor = 'primary'
184- >
185- < Tab
186- label = { i18next . t ( 'datasets.latest_tab' ) }
187- { ...a11yProps ( 0 ) }
188- disableRipple = { true }
189- />
190- < Tab label = { 'I/O' } { ...a11yProps ( 1 ) } disableRipple = { true } />
191- < Tab
192- label = { i18next . t ( 'datasets.history_tab' ) }
193- { ...a11yProps ( 2 ) }
194- disableRipple = { true }
195- />
196- < Tab
197- label = { i18next . t ( 'datasets.column_lineage_tab' ) }
198- { ...a11yProps ( 3 ) }
199- disableRipple = { true }
200- />
201- </ Tabs >
202- </ Box >
203- </ Box >
204- < Box display = { 'flex' } alignItems = { 'center' } justifyContent = { 'space-between' } >
191+ < Box display = { 'flex' } alignItems = { 'center' } justifyContent = { 'space-between' } my = { 2 } >
205192 { facetsStatus && (
206193 < Box mr = { 1 } >
207194 < MqStatus label = { 'Quality' } color = { facetsStatus } />
208195 </ Box >
209196 ) }
210- < MqText heading font = { 'mono' } >
211- { name }
212- </ MqText >
213- < Box ml = { 1 } display = { 'flex' } alignItems = { 'center' } >
214- < MqText subheading > { i18next . t ( 'datasets.show_field_tags' ) } </ MqText >
215- < Switch
216- checked = { showTags }
217- onChange = { ( ) => setShowTags ( ! showTags ) }
218- inputProps = { { 'aria-label' : 'toggle show tags' } }
219- />
197+ < Box display = { 'flex' } alignItems = { 'center' } >
198+ < MqText heading font = { 'mono' } >
199+ { name }
200+ </ MqText >
201+ < Box ml = { 1 } >
202+ < MqText
203+ small
204+ link
205+ linkTo = { `/datasets/column-level/${ encodeURIComponent (
206+ encodeURIComponent ( firstVersion . id . namespace )
207+ ) } /${ encodeURIComponent ( firstVersion . id . name ) } `}
208+ >
209+ COLUMN LEVEL
210+ </ MqText >
211+ </ Box >
220212 </ Box >
213+ { tabIndex === 0 && (
214+ < Box ml = { 1 } display = { 'flex' } alignItems = { 'center' } >
215+ < FormControlLabel
216+ control = {
217+ < Switch
218+ size = { 'small' }
219+ checked = { showTags }
220+ onChange = { ( ) => setShowTags ( ! showTags ) }
221+ inputProps = { { 'aria-label' : 'toggle show tags' } }
222+ />
223+ }
224+ label = { i18next . t ( 'datasets.show_field_tags' ) }
225+ />
226+ </ Box >
227+ ) }
221228 </ Box >
222- < Box mb = { 2 } >
229+ < Box >
223230 < MqText subdued > { description } </ MqText >
224231 </ Box >
225232 </ Box >
233+ < Divider sx = { { my : 1 } } />
234+ < Grid container spacing = { 2 } >
235+ < Grid item xs = { 4 } >
236+ < MqInfo
237+ icon = { < CalendarIcon color = { 'disabled' } /> }
238+ label = { 'Updated at' }
239+ value = { formatUpdatedAt ( firstVersion . createdAt ) }
240+ />
241+ </ Grid >
242+ < Grid item xs = { 4 } >
243+ < MqInfo
244+ icon = { < StorageIcon color = { 'disabled' } /> }
245+ label = { 'Dataset Type' }
246+ value = { firstVersion . type }
247+ />
248+ </ Grid >
249+ < Grid item xs = { 4 } >
250+ < MqInfo
251+ icon = { < ListIcon color = { 'disabled' } /> }
252+ label = { 'Fields' }
253+ value = { `${ firstVersion . fields . length } columns` }
254+ />
255+ </ Grid >
256+ </ Grid >
257+ < Divider sx = { { mt : 1 } } />
258+ < Box display = { 'flex' } justifyContent = { 'space-between' } mb = { 2 } >
259+ < Box sx = { { borderBottom : 1 , borderColor : 'divider' , width : '100%' } } >
260+ < Tabs
261+ value = { tabIndex }
262+ onChange = { handleChange }
263+ textColor = 'primary'
264+ indicatorColor = 'primary'
265+ >
266+ < Tab label = { i18next . t ( 'datasets.latest_tab' ) } { ...a11yProps ( 0 ) } disableRipple = { true } />
267+ < Tab label = { i18next . t ( 'datasets.history_tab' ) } { ...a11yProps ( 2 ) } disableRipple = { true } />
268+ </ Tabs >
269+ </ Box >
270+ </ Box >
226271 { tabIndex === 0 && (
227272 < DatasetInfo
228273 datasetFields = { firstVersion . fields }
@@ -231,9 +276,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
231276 showTags = { showTags }
232277 />
233278 ) }
234- { tabIndex === 1 && < Io /> }
235- { tabIndex === 2 && < DatasetVersions versions = { props . versions } /> }
236- { tabIndex === 3 && < DatasetColumnLineage lineageDataset = { props . lineageDataset } /> }
279+ { tabIndex === 1 && < DatasetVersions versions = { props . versions } /> }
237280 </ Box >
238281 )
239282}
0 commit comments