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

Data Quality Panel Fix #2937

Merged
merged 1 commit into from
Oct 21, 2024
Merged
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
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
Loading