fix(datajobs): fetch dataflow properties from a relationship (#3487)

This commit is contained in:
Gabe Lyons 2021-10-28 17:38:16 -07:00 committed by GitHub
parent 1fec105b24
commit c1ca2977f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 84 additions and 8 deletions

View File

@ -895,6 +895,20 @@ export const dataJob1 = {
}, },
], ],
}, },
incoming: null,
outgoing: null,
parentFlow: {
start: 0,
count: 1,
total: 1,
relationships: [
{
type: 'IsPartOf',
direction: RelationshipDirection.Outgoing,
entity: dataFlow1,
},
],
},
} as DataJob; } as DataJob;
export const dataJob2 = { export const dataJob2 = {

View File

@ -0,0 +1,40 @@
import { MockedProvider } from '@apollo/client/testing';
import { render } from '@testing-library/react';
import React from 'react';
import { dataJob1, mocks } from '../../../../../../Mocks';
import { EntityType } from '../../../../../../types.generated';
import TestPageContainer from '../../../../../../utils/test-utils/TestPageContainer';
import { getDataForEntityType } from '../../../containers/profile/utils';
import EntityContext from '../../../EntityContext';
import { DataJobFlowTab } from '../DataJobFlowTab';
describe('DataJobFlowTab', () => {
it('renders fields', async () => {
const { getByText } = render(
<MockedProvider mocks={mocks} addTypename={false}>
<TestPageContainer initialEntries={['/dataset/urn:li:dataset:3']}>
<EntityContext.Provider
value={{
urn: 'urn:li:dataJob:1',
entityType: EntityType.DataJob,
entityData: getDataForEntityType({
data: dataJob1,
entityType: EntityType.DataJob,
getOverrideProperties: () => ({}),
}),
baseEntity: { dataJob: dataJob1 },
updateEntity: jest.fn(),
routeToTab: jest.fn(),
refetch: jest.fn(),
lineage: undefined,
}}
>
<DataJobFlowTab />
</EntityContext.Provider>
</TestPageContainer>
</MockedProvider>,
);
expect(getByText('DataFlowInfoName')).toBeInTheDocument();
expect(getByText('DataFlowInfo1 Description')).toBeInTheDocument();
});
});

View File

@ -54,10 +54,10 @@ const PreviewImage = styled(Image)`
background-color: transparent; background-color: transparent;
`; `;
const EntityTitle = styled(Typography.Text)<{ titleSizePx?: number }>` const EntityTitle = styled(Typography.Text)<{ $titleSizePx?: number }>`
&&& { &&& {
margin-bottom: 0; margin-bottom: 0;
font-size: ${(props) => props.titleSizePx || 16}px; font-size: ${(props) => props.$titleSizePx || 16}px;
font-weight: 600; font-weight: 600;
vertical-align: middle; vertical-align: middle;
} }
@ -154,13 +154,13 @@ export default function DefaultPreviewCard({
<PlatformDivider /> <PlatformDivider />
<PlatformText>{type}</PlatformText> <PlatformText>{type}</PlatformText>
</PlatformInfo> </PlatformInfo>
<Link to={url} onClick={onClick}> <EntityTitle onClick={onClick} $titleSizePx={titleSizePx}>
<EntityTitle titleSizePx={titleSizePx}>{name || ' '}</EntityTitle> {name || ' '}
</EntityTitle>
</Link> </Link>
<TagContainer> <TagContainer>
<TagTermGroup uneditableGlossaryTerms={glossaryTerms} uneditableTags={tags} maxShow={3} /> <TagTermGroup uneditableGlossaryTerms={glossaryTerms} uneditableTags={tags} maxShow={3} />
</TagContainer> </TagContainer>
</Link>
</TitleContainer> </TitleContainer>
{description && description.length > 0 && ( {description && description.length > 0 && (
<DescriptionContainer> <DescriptionContainer>

View File

@ -8,6 +8,28 @@ fragment relationshipFields on Entity {
description description
} }
} }
... on DataFlow {
orchestrator
flowId
cluster
info {
name
description
project
}
ownership {
...ownershipFields
}
globalTags {
...globalTagsFields
}
glossaryTerms {
...glossaryTerms
}
editableProperties {
description
}
}
... on Dashboard { ... on Dashboard {
...dashboardRelationshipsLeaf ...dashboardRelationshipsLeaf
...dashboardFields ...dashboardFields