Skip to content

Commit

Permalink
Refactoring for display column lineage JSON (#2301)
Browse files Browse the repository at this point in the history
* refactoring for display column lineage JSON

Signed-off-by: tito1212 <vladyslav.sedenko@getindata.com>

* request api after click

Signed-off-by: tito1212 <vladyslav.sedenko@getindata.com>

Signed-off-by: tito1212 <vladyslav.sedenko@getindata.com>
Co-authored-by: tito1212 <vladyslav.sedenko@getindata.com>
  • Loading branch information
tito12 and tito1212 authored Dec 8, 2022
1 parent c003400 commit 51fae37
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions web/src/components/datasets/DatasetDetailPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ interface StateProps {
versions: DatasetVersion[]
dataset: Dataset
versionsLoading: boolean
isDatasetInit: boolean
}

interface DispatchProps {
Expand Down Expand Up @@ -94,6 +95,13 @@ const DatasetDetailPage: FunctionComponent<IProps> = props => {
setTab(newValue)
}

const handleFetchDataset = () => {
if(!props.isDatasetInit) {
fetchDataset(props.lineageDataset.namespace, props.lineageDataset.name)
}
return true
}

if (versionsLoading) {
return (
<Box display={'flex'} justifyContent={'center'}>
Expand Down Expand Up @@ -148,7 +156,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = props => {
/>
)}
{tab === 1 && <DatasetVersions versions={props.versions} />}
{tab === 2 && <DatasetColumnLineage columnLineage={props.dataset.columnLineage} />}
{tab === 2 && handleFetchDataset() && <DatasetColumnLineage columnLineage={props.dataset.columnLineage} />}
</Box>
)
}
Expand All @@ -157,7 +165,8 @@ const mapStateToProps = (state: IState) => ({
datasets: state.datasets.result,
versions: state.datasetVersions.result.versions,
dataset: state.dataset.result,
versionsLoading: state.datasetVersions.isLoading
versionsLoading: state.datasetVersions.isLoading,
isDatasetInit: state.dataset.init,
})

const mapDispatchToProps = (dispatch: Redux.Dispatch) =>
Expand Down

0 comments on commit 51fae37

Please sign in to comment.