feat(lineage): show fully qualified dataset name on expansion (#4562)

* show fully qualified dataset name on expansion

* also pull qualified name
This commit is contained in:
Gabe Lyons 2022-04-01 10:37:51 -07:00 committed by GitHub
parent 40188d27c9
commit 9e06f66b2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 31 additions and 10 deletions

View File

@ -519,7 +519,8 @@ export const dataset6 = {
name: 'Sixth Test Dataset', name: 'Sixth Test Dataset',
urn: 'urn:li:dataset:6', urn: 'urn:li:dataset:6',
properties: { properties: {
name: 'Sixth Test Dataset', name: 'Display Name of Sixth',
qualifiedName: 'Fully Qualified Name of Sixth Test Dataset',
description: 'This and here we have yet another Dataset (YAN). Are there more?', description: 'This and here we have yet another Dataset (YAN). Are there more?',
origin: 'PROD', origin: 'PROD',
customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }], customProperties: [{ key: 'propertyAKey', value: 'propertyAValue' }],

View File

@ -255,9 +255,10 @@ export class DatasetEntity implements Entity<Dataset> {
getLineageVizConfig = (entity: Dataset) => { getLineageVizConfig = (entity: Dataset) => {
return { return {
urn: entity?.urn, urn: entity?.urn,
name: entity.properties?.name || entity.name, name: entity?.properties?.name || entity.name,
expandedName: entity?.properties?.qualifiedName || entity.name,
type: EntityType.Dataset, type: EntityType.Dataset,
subtype: entity.subTypes?.typeNames?.[0] || undefined, subtype: entity?.subTypes?.typeNames?.[0] || undefined,
icon: entity?.platform?.properties?.logoUrl || undefined, icon: entity?.platform?.properties?.logoUrl || undefined,
platform: entity?.platform?.name, platform: entity?.platform?.name,
}; };

View File

@ -104,7 +104,7 @@ export default function LineageEntityNode({
[], [],
); );
const nodeHeight = nodeHeightFromTitleLength(expandTitles ? node.data.name : undefined); const nodeHeight = nodeHeightFromTitleLength(expandTitles ? node.data.expandedName || node.data.name : undefined);
return ( return (
<PointerGroup data-testid={`node-${node.data.urn}-${direction}`} top={node.x} left={node.y}> <PointerGroup data-testid={`node-${node.data.urn}-${direction}`} top={node.x} left={node.y}>
@ -268,7 +268,7 @@ export default function LineageEntityNode({
</UnselectableText> </UnselectableText>
{expandTitles ? ( {expandTitles ? (
<foreignObject x={textX} width="125" height="200"> <foreignObject x={textX} width="125" height="200">
<MultilineTitleText>{node.data.name}</MultilineTitleText> <MultilineTitleText>{node.data.expandedName || node.data.name}</MultilineTitleText>
</foreignObject> </foreignObject>
) : ( ) : (
<UnselectableText <UnselectableText

View File

@ -27,6 +27,7 @@ describe('constructTree', () => {
), ),
).toEqual({ ).toEqual({
name: 'Yet Another Dataset', name: 'Yet Another Dataset',
expandedName: 'Yet Another Dataset',
urn: 'urn:li:dataset:3', urn: 'urn:li:dataset:3',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
@ -60,7 +61,8 @@ describe('constructTree', () => {
testEntityRegistry, testEntityRegistry,
), ),
).toEqual({ ).toEqual({
name: 'Sixth Test Dataset', name: 'Display Name of Sixth',
expandedName: 'Fully Qualified Name of Sixth Test Dataset',
urn: 'urn:li:dataset:6', urn: 'urn:li:dataset:6',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
@ -69,6 +71,7 @@ describe('constructTree', () => {
children: [ children: [
{ {
name: 'Fourth Test Dataset', name: 'Fourth Test Dataset',
expandedName: 'Fourth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:4', urn: 'urn:li:dataset:4',
@ -106,7 +109,8 @@ describe('constructTree', () => {
testEntityRegistry, testEntityRegistry,
), ),
).toEqual({ ).toEqual({
name: 'Sixth Test Dataset', name: 'Display Name of Sixth',
expandedName: 'Fully Qualified Name of Sixth Test Dataset',
urn: 'urn:li:dataset:6', urn: 'urn:li:dataset:6',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
@ -116,6 +120,7 @@ describe('constructTree', () => {
{ {
countercurrentChildrenUrns: [], countercurrentChildrenUrns: [],
name: 'Fifth Test Dataset', name: 'Fifth Test Dataset',
expandedName: 'Fifth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:5', urn: 'urn:li:dataset:5',
@ -154,6 +159,7 @@ describe('constructTree', () => {
), ),
).toEqual({ ).toEqual({
name: 'Yet Another Dataset', name: 'Yet Another Dataset',
expandedName: 'Yet Another Dataset',
urn: 'urn:li:dataset:3', urn: 'urn:li:dataset:3',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
@ -162,6 +168,7 @@ describe('constructTree', () => {
children: [ children: [
{ {
name: 'Fourth Test Dataset', name: 'Fourth Test Dataset',
expandedName: 'Fourth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:4', urn: 'urn:li:dataset:4',
@ -171,7 +178,8 @@ describe('constructTree', () => {
status: null, status: null,
children: [ children: [
{ {
name: 'Sixth Test Dataset', name: 'Display Name of Sixth',
expandedName: 'Fully Qualified Name of Sixth Test Dataset',
type: 'DATASET', type: 'DATASET',
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:6', urn: 'urn:li:dataset:6',
@ -182,6 +190,7 @@ describe('constructTree', () => {
children: [ children: [
{ {
name: 'Fifth Test Dataset', name: 'Fifth Test Dataset',
expandedName: 'Fifth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:5', urn: 'urn:li:dataset:5',
@ -199,6 +208,7 @@ describe('constructTree', () => {
}, },
{ {
name: 'Fifth Test Dataset', name: 'Fifth Test Dataset',
expandedName: 'Fifth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
urn: 'urn:li:dataset:5', urn: 'urn:li:dataset:5',
@ -267,6 +277,7 @@ describe('constructTree', () => {
), ),
).toEqual({ ).toEqual({
name: 'Yet Another Dataset', name: 'Yet Another Dataset',
expandedName: 'Yet Another Dataset',
urn: 'urn:li:dataset:3', urn: 'urn:li:dataset:3',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 0, unexploredChildren: 0,
@ -275,6 +286,7 @@ describe('constructTree', () => {
children: [ children: [
{ {
name: 'Fourth Test Dataset', name: 'Fourth Test Dataset',
expandedName: 'Fourth Test Dataset',
type: EntityType.Dataset, type: EntityType.Dataset,
unexploredChildren: 2, unexploredChildren: 2,
urn: 'urn:li:dataset:4', urn: 'urn:li:dataset:4',

View File

@ -27,6 +27,8 @@ export type LineageExpandParams = {
export type FetchedEntity = { export type FetchedEntity = {
urn: string; urn: string;
name: string; name: string;
// name to be shown on expansion if available
expandedName?: string;
type: EntityType; type: EntityType;
subtype?: string; subtype?: string;
icon?: string; icon?: string;
@ -41,6 +43,8 @@ export type FetchedEntity = {
export type NodeData = { export type NodeData = {
urn?: string; urn?: string;
name: string; name: string;
// name to be shown on expansion if available
expandedName?: string;
type?: EntityType; type?: EntityType;
subtype?: string; subtype?: string;
children?: Array<NodeData>; children?: Array<NodeData>;

View File

@ -21,6 +21,7 @@ export default function constructFetchedNode(
if (fetchedNode && !constructedNodes[urn]) { if (fetchedNode && !constructedNodes[urn]) {
const node: NodeData = { const node: NodeData = {
name: fetchedNode.name, name: fetchedNode.name,
expandedName: fetchedNode.expandedName,
urn: fetchedNode.urn, urn: fetchedNode.urn,
type: fetchedNode.type, type: fetchedNode.type,
subtype: fetchedNode.subtype, subtype: fetchedNode.subtype,

View File

@ -15,6 +15,7 @@ export default function constructTree(
const root: NodeData = { const root: NodeData = {
name: fetchedEntity?.name || '', name: fetchedEntity?.name || '',
expandedName: fetchedEntity?.expandedName || '',
urn: fetchedEntity?.urn, urn: fetchedEntity?.urn,
type: fetchedEntity?.type, type: fetchedEntity?.type,
subtype: fetchedEntity?.subtype, subtype: fetchedEntity?.subtype,

View File

@ -51,7 +51,7 @@ export default function layoutTree(
const layerSize = filteredNodesInCurrentLayer.length; const layerSize = filteredNodesInCurrentLayer.length;
const layerHeight = filteredNodesInCurrentLayer const layerHeight = filteredNodesInCurrentLayer
.map(({ node }) => nodeHeightFromTitleLength(expandTitles ? node.name : undefined)) .map(({ node }) => nodeHeightFromTitleLength(expandTitles ? node.expandedName || node.name : undefined))
.reduce((acc, height) => acc + height, 0); .reduce((acc, height) => acc + height, 0);
maxHeight = Math.max(maxHeight, layerHeight); maxHeight = Math.max(maxHeight, layerHeight);
@ -87,7 +87,8 @@ export default function layoutTree(
y: HORIZONTAL_SPACE_PER_LAYER * currentLayer * xModifier, y: HORIZONTAL_SPACE_PER_LAYER * currentLayer * xModifier,
}; };
currentXPosition += currentXPosition +=
nodeHeightFromTitleLength(expandTitles ? node.name : undefined) + VERTICAL_SPACE_BETWEEN_NODES; nodeHeightFromTitleLength(expandTitles ? node.expandedName || node.name : undefined) +
VERTICAL_SPACE_BETWEEN_NODES;
nodesByUrn[node.urn] = vizNodeForNode; nodesByUrn[node.urn] = vizNodeForNode;
nodesToRender.push(vizNodeForNode); nodesToRender.push(vizNodeForNode);