Skip to content

Commit b7277d7

Browse files
authored
Dataset Version call simplification (#2938)
* Fixing data quality display. Signed-off-by: phixMe <[email protected]> * Fixing dataset version calls. Signed-off-by: phixMe <[email protected]> --------- Signed-off-by: phixMe <[email protected]>
1 parent b4b6da9 commit b7277d7

File tree

3 files changed

+10
-74
lines changed

3 files changed

+10
-74
lines changed

web/src/components/datasets/DatasetDetailPage.tsx

Lines changed: 3 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
} from '@mui/material'
1616
import { CalendarIcon } from '@mui/x-date-pickers'
1717
import { CircularProgress } from '@mui/material'
18-
import { Dataset, DatasetVersion } from '../../types/api'
18+
import { Dataset } from '../../types/api'
1919
import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'
2020
import { IState } from '../../store/reducers'
2121
import { LineageDataset } from '../../types/lineage'
@@ -28,7 +28,6 @@ import {
2828
deleteDataset,
2929
dialogToggle,
3030
fetchDataset,
31-
fetchInitialDatasetVersions,
3231
resetDataset,
3332
resetDatasetVersions,
3433
setTabIndex,
@@ -57,15 +56,12 @@ interface StateProps {
5756
lineageDataset: LineageDataset
5857
dataset: Dataset
5958
isDatasetLoading: boolean
60-
initVersions: DatasetVersion[]
61-
initVersionsLoading: boolean
6259
datasets: IState['datasets']
6360
display: IState['display']
6461
tabIndex: IState['lineage']['tabIndex']
6562
}
6663

6764
interface DispatchProps {
68-
fetchInitialDatasetVersions: typeof fetchInitialDatasetVersions
6965
fetchDataset: typeof fetchDataset
7066
resetDatasetVersions: typeof resetDatasetVersions
7167
resetDataset: typeof resetDataset
@@ -92,11 +88,8 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
9288
fetchDataset,
9389
resetDataset,
9490
resetDatasetVersions,
95-
fetchInitialDatasetVersions,
9691
deleteDataset,
9792
dialogToggle,
98-
initVersions,
99-
initVersionsLoading,
10093
lineageDataset,
10194
tabIndex,
10295
setTabIndex,
@@ -118,7 +111,6 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
118111

119112
// might need to map first version to its own state
120113
useEffect(() => {
121-
fetchInitialDatasetVersions(lineageDataset.namespace, lineageDataset.name)
122114
fetchDataset(lineageDataset.namespace, lineageDataset.name)
123115
}, [lineageDataset.name])
124116

@@ -133,19 +125,14 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
133125
setTabIndex(newValue)
134126
}
135127

136-
if (!dataset || isDatasetLoading || (initVersionsLoading && initVersions.length === 0)) {
128+
if (!dataset || isDatasetLoading) {
137129
return (
138130
<Box display={'flex'} justifyContent={'center'} mt={2}>
139131
<CircularProgress color='primary' />
140132
</Box>
141133
)
142134
}
143135

144-
if (initVersions.length === 0) {
145-
return null
146-
}
147-
148-
const firstVersion = initVersions[0]
149136
const { name, tags, description } = dataset
150137
const facetsStatus = datasetFacetsStatus(dataset.facets)
151138
const assertions = datasetFacetsQualityAssertions(dataset.facets)
@@ -328,7 +315,7 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
328315
checked={showTags}
329316
onChange={() => setShowTags(!showTags)}
330317
inputProps={{ 'aria-label': 'toggle show tags' }}
331-
disabled={initVersionsLoading}
318+
disabled={isDatasetLoading}
332319
/>
333320
}
334321
label={i18next.t('datasets.show_field_tags')}
@@ -341,7 +328,6 @@ const DatasetDetailPage: FunctionComponent<IProps> = (props) => {
341328
dataset={dataset}
342329
datasetFields={dataset.fields}
343330
facets={dataset.facets}
344-
run={firstVersion.createdByRun}
345331
showTags={showTags}
346332
isCurrentVersion
347333
/>
@@ -356,15 +342,12 @@ const mapStateToProps = (state: IState) => ({
356342
dataset: state.dataset.result,
357343
isDatasetLoading: state.dataset.isLoading,
358344
display: state.display,
359-
initVersions: state.datasetVersions.initDsVersion.versions,
360-
initVersionsLoading: state.datasetVersions.isInitDsVerLoading,
361345
tabIndex: state.lineage.tabIndex,
362346
})
363347

364348
const mapDispatchToProps = (dispatch: Redux.Dispatch) =>
365349
bindActionCreators(
366350
{
367-
fetchInitialDatasetVersions: fetchInitialDatasetVersions,
368351
fetchDataset: fetchDataset,
369352
resetDatasetVersions: resetDatasetVersions,
370353
resetDataset: resetDataset,

web/src/components/datasets/DatasetInfo.tsx

Lines changed: 7 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,32 @@
11
// Copyright 2018-2024 contributors to the Marquez project
22
// SPDX-License-Identifier: Apache-2.0
3-
import * as Redux from 'redux'
43
import { Box, Chip, Table, TableBody, TableCell, TableHead, TableRow } from '@mui/material'
5-
import { Dataset, Field, Run } from '../../types/api'
6-
import { IState } from '../../store/reducers'
4+
import { Dataset, Field } from '../../types/api'
75
import { Link } from 'react-router-dom'
8-
import { connect, useSelector } from 'react-redux'
96
import { encodeQueryString } from '../../routes/column-level/ColumnLineageColumnNode'
10-
import { fetchJobFacets, resetFacets } from '../../store/actionCreators'
117
import DatasetTags from './DatasetTags'
128
import IconButton from '@mui/material/IconButton'
139
import MQTooltip from '../core/tooltip/MQTooltip'
1410
import MqEmpty from '../core/empty/MqEmpty'
1511
import MqJsonView from '../core/json-view/MqJsonView'
1612
import MqText from '../core/text/MqText'
17-
import React, { FunctionComponent, useEffect } from 'react'
13+
import React, { FunctionComponent } from 'react'
1814
import SplitscreenIcon from '@mui/icons-material/Splitscreen'
1915

20-
export interface DispatchProps {
21-
fetchJobFacets: typeof fetchJobFacets
22-
resetFacets: typeof resetFacets
23-
}
24-
25-
interface JobFacets {
26-
[key: string]: object
27-
}
28-
2916
export interface JobFacetsProps {
30-
jobFacets: JobFacets
3117
isCurrentVersion?: boolean
3218
dataset: Dataset
3319
}
3420

3521
type DatasetInfoProps = {
3622
datasetFields: Field[]
3723
facets?: object
38-
run?: Run
3924
showTags?: boolean
40-
} & JobFacetsProps &
41-
DispatchProps
25+
} & JobFacetsProps
4226

4327
const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
44-
const { datasetFields, facets, run, dataset, fetchJobFacets, resetFacets, showTags } = props
28+
const { datasetFields, facets, dataset, showTags } = props
4529
const i18next = require('i18next')
46-
const dsNamespace = useSelector(
47-
(state: IState) => state.datasetVersions.initDsVersion.versions[0].namespace
48-
)
49-
const dsName = useSelector(
50-
(state: IState) => state.datasetVersions.initDsVersion.versions[0].name
51-
)
52-
53-
useEffect(() => {
54-
run && fetchJobFacets(run.id)
55-
}, [run])
56-
57-
useEffect(
58-
() => () => {
59-
resetFacets()
60-
},
61-
[]
62-
)
6330

6431
return (
6532
<Box>
@@ -159,8 +126,8 @@ const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
159126
{showTags && (
160127
<TableCell align='left'>
161128
<DatasetTags
162-
namespace={dsNamespace}
163-
datasetName={dsName}
129+
namespace={dataset.namespace}
130+
datasetName={dataset.name}
164131
datasetTags={field.tags}
165132
datasetField={field.name}
166133
/>
@@ -186,17 +153,4 @@ const DatasetInfo: FunctionComponent<DatasetInfoProps> = (props) => {
186153
)
187154
}
188155

189-
const mapStateToProps = (state: IState) => ({
190-
jobFacets: state.facets.result,
191-
})
192-
193-
const mapDispatchToProps = (dispatch: Redux.Dispatch) =>
194-
Redux.bindActionCreators(
195-
{
196-
fetchJobFacets: fetchJobFacets,
197-
resetFacets: resetFacets,
198-
},
199-
dispatch
200-
)
201-
202-
export default connect(mapStateToProps, mapDispatchToProps)(DatasetInfo)
156+
export default DatasetInfo

web/src/components/datasets/DatasetVersions.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ const DatasetVersions: FunctionComponent<DatasetVersionsProps & DispatchProps> =
9696
dataset={dataset}
9797
datasetFields={infoView.fields}
9898
facets={infoView.facets}
99-
run={infoView.createdByRun}
10099
/>
101100
</>
102101
)

0 commit comments

Comments
 (0)