Skip to content

Commit

Permalink
Fixing data quality display.
Browse files Browse the repository at this point in the history
Signed-off-by: phixMe <[email protected]>
  • Loading branch information
phixMe committed Oct 21, 2024
1 parent d9ec368 commit 287e838
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions web/src/components/datasets/DatasetDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import StorageIcon from '@mui/icons-material/Storage'
interface StateProps {
lineageDataset: LineageDataset
dataset: Dataset
isDatasetLoading: boolean
initVersions: DatasetVersion[]
initVersionsLoading: boolean
datasets: IState['datasets']
Expand Down Expand Up @@ -86,6 +87,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
const {
datasets,
dataset,
isDatasetLoading,
display,
fetchDataset,
resetDataset,
Expand Down Expand Up @@ -118,7 +120,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
useEffect(() => {
fetchInitialDatasetVersions(lineageDataset.namespace, lineageDataset.name)
fetchDataset(lineageDataset.namespace, lineageDataset.name)
}, [lineageDataset.name, showTags])
}, [lineageDataset.name])

// if the dataset is deleted then redirect to datasets end point
useEffect(() => {
Expand All @@ -131,7 +133,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
setTabIndex(newValue)
}

if (initVersionsLoading && initVersions.length === 0) {
if (!dataset || isDatasetLoading || (initVersionsLoading && initVersions.length === 0)) {
return (
<Box display={'flex'} justifyContent={'center'} mt={2}>
<CircularProgress color='primary' />
Expand All @@ -144,10 +146,9 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
}

const firstVersion = initVersions[0]
const { name, tags, description } = firstVersion
const facetsStatus = datasetFacetsStatus(firstVersion.facets)

const assertions = datasetFacetsQualityAssertions(firstVersion.facets)
const { name, tags, description } = dataset
const facetsStatus = datasetFacetsStatus(dataset.facets)
const assertions = datasetFacetsQualityAssertions(dataset.facets)

return (
<Box px={2}>
Expand Down Expand Up @@ -229,21 +230,21 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
<MqInfo
icon={<CalendarIcon color={'disabled'} />}
label={'Updated at'.toUpperCase()}
value={formatUpdatedAt(firstVersion.createdAt)}
value={formatUpdatedAt(dataset.createdAt)}
/>
</Grid>
<Grid item xs={6}>
<MqInfo
icon={<StorageIcon color={'disabled'} />}
label={'Dataset Type'.toUpperCase()}
value={<MqText font={'mono'}>{firstVersion.type}</MqText>}
value={<MqText font={'mono'}>{dataset.type}</MqText>}
/>
</Grid>
<Grid item xs={6}>
<MqInfo
icon={<ListIcon color={'disabled'} />}
label={'Fields'.toUpperCase()}
value={`${firstVersion.fields.length} columns`}
value={`${dataset.fields.length} columns`}
/>
</Grid>
<Grid item xs={6}>
Expand Down Expand Up @@ -338,8 +339,8 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
{tabIndex === 0 && (
<DatasetInfo
dataset={dataset}
datasetFields={firstVersion.fields}
facets={firstVersion.facets}
datasetFields={dataset.fields}
facets={dataset.facets}
run={firstVersion.createdByRun}
showTags={showTags}
isCurrentVersion
Expand All @@ -353,6 +354,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
const mapStateToProps = (state: IState) => ({
datasets: state.datasets,
dataset: state.dataset.result,
isDatasetLoading: state.dataset.isLoading,
display: state.display,
initVersions: state.datasetVersions.initDsVersion.versions,
initVersionsLoading: state.datasetVersions.isInitDsVerLoading,
Expand Down

0 comments on commit 287e838

Please sign in to comment.