forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(data-contract): Add initial file for data contract on validation…
… tab
- Loading branch information
1 parent
bdd9667
commit a240d12
Showing
3 changed files
with
144 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
118 changes: 118 additions & 0 deletions
118
...hub-web-react/src/app/entity/shared/tabs/Dataset/Validations/contract/DataContractTab.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
import React, { useState } from 'react'; | ||
import styled from 'styled-components'; | ||
// import { useGetDatasetContractQuery } from '../../../../../../../graphql/contract.generated'; | ||
// import { DataContractState } from '../../../../../../../types.generated'; | ||
import { useEntityData } from '../../../../EntityContext'; | ||
// import { DataContractSummary } from './DataContractSummary'; | ||
// import { DataQualityContractSummary } from './DataQualityContractSummary'; | ||
// import { SchemaContractSummary } from './SchemaContractSummary'; | ||
// import { FreshnessContractSummary } from './FreshnessContractSummary'; | ||
// import { DataContractBuilderModal } from './builder/DataContractBuilderModal'; | ||
// import { createBuilderState } from './builder/utils'; | ||
// import { getAssertionsSummary } from '../DatahubUtility'; | ||
|
||
const Container = styled.div` | ||
display: flex; | ||
`; | ||
|
||
const LeftColumn = styled.div` | ||
width: 50%; | ||
`; | ||
|
||
const RightColumn = styled.div` | ||
width: 50%; | ||
`; | ||
|
||
/** | ||
* Component used for rendering the Data Contract Tab on the Assertions parent tab. | ||
*/ | ||
export const DataContractTab = () => { | ||
// const { urn, entityType } = useEntityData(); | ||
|
||
// const { data, refetch } = useGetDatasetContractQuery({ | ||
// variables: { | ||
// urn, | ||
// }, | ||
// }); | ||
// const [showContractBuilder, setShowContractBuilder] = useState(false); | ||
|
||
// const contract = data?.dataset?.contract; | ||
// const schemaContracts = data?.dataset?.contract?.properties?.schema || []; | ||
// const freshnessContracts = data?.dataset?.contract?.properties?.freshness || []; | ||
// const dataQualityContracts = data?.dataset?.contract?.properties?.dataQuality || []; | ||
// const schemaAssertions = schemaContracts.map((c) => c.assertion); | ||
// const freshnessAssertions = freshnessContracts.map((c) => c.assertion); | ||
// const dataQualityAssertions = dataQualityContracts.map((c) => c.assertion); | ||
// const assertionsSummary = getAssertionsSummary([ | ||
// ...schemaAssertions, | ||
// ...freshnessAssertions, | ||
// ...dataQualityAssertions, | ||
// ] as any); | ||
// const contractState = data?.dataset?.contract?.status?.state || DataContractState.Active; | ||
// const hasFreshnessContract = freshnessContracts && freshnessContracts?.length; | ||
// const hasSchemaContract = schemaContracts && schemaContracts?.length; | ||
// const hasDataQualityContract = dataQualityContracts && dataQualityContracts?.length; | ||
// const showLeftColumn = hasFreshnessContract || hasSchemaContract || undefined; | ||
|
||
// const onContractUpdate = () => { | ||
// if (contract) { | ||
// // Contract exists, just refetch. | ||
// refetch(); | ||
// } else { | ||
// // no contract yet, wait for indxing, | ||
// setTimeout(() => refetch(), 3000); | ||
// } | ||
// setShowContractBuilder(false); | ||
// }; | ||
|
||
// return ( | ||
// <> | ||
// {data?.dataset?.contract && ( | ||
// <> | ||
// <DataContractSummary | ||
// state={contractState} | ||
// summary={assertionsSummary} | ||
// showContractBuilder={() => setShowContractBuilder(true)} | ||
// /> | ||
// <Container> | ||
// {showLeftColumn && ( | ||
// <LeftColumn> | ||
// {(hasFreshnessContract && ( | ||
// <FreshnessContractSummary | ||
// contracts={freshnessContracts as any} | ||
// showAction={false} | ||
// /> | ||
// )) || | ||
// undefined} | ||
// {(hasSchemaContract && ( | ||
// <SchemaContractSummary contracts={schemaContracts as any} showAction={false} /> | ||
// )) || | ||
// undefined} | ||
// </LeftColumn> | ||
// )} | ||
// <RightColumn> | ||
// {(hasDataQualityContract && ( | ||
// <DataQualityContractSummary | ||
// contracts={dataQualityContracts as any} | ||
// showAction={false} | ||
// /> | ||
// )) || | ||
// undefined} | ||
// </RightColumn> | ||
// </Container> | ||
// </> | ||
// )} | ||
// {showContractBuilder && ( | ||
// <DataContractBuilderModal | ||
// initialState={createBuilderState(data?.dataset?.contract as any)} | ||
// entityUrn={urn} | ||
// onCancel={() => setShowContractBuilder(false)} | ||
// onPropose={onContractUpdate} | ||
// onSubmit={onContractUpdate} | ||
// entityType={entityType} | ||
// /> | ||
// )} | ||
// </> | ||
// ); | ||
return <div>DataContractTab</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters