mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-28 02:46:09 +00:00
Fix#16491 - fix lineage edge description update (#16538)
* fix lineage edge description update * fix tests
This commit is contained in:
parent
d3123c4914
commit
dff0aa8dbe
@ -137,6 +137,35 @@ const applyPipelineFromModal = (fromNode, toNode, pipelineData) => {
|
|||||||
verifyResponseStatusCode('@lineageApi', 200);
|
verifyResponseStatusCode('@lineageApi', 200);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const editPipelineEdgeDescription = (
|
||||||
|
fromNode,
|
||||||
|
toNode,
|
||||||
|
pipelineData,
|
||||||
|
description
|
||||||
|
) => {
|
||||||
|
cy.get(
|
||||||
|
`[data-testid="pipeline-label-${fromNode.fqn}-${toNode.fqn}"]`
|
||||||
|
).click();
|
||||||
|
cy.get('.edge-info-drawer').should('be.visible');
|
||||||
|
cy.get('.edge-info-drawer [data-testid="Edge"] a').contains(
|
||||||
|
pipelineData.name
|
||||||
|
);
|
||||||
|
|
||||||
|
interceptURL('PUT', `/api/v1/lineage`, 'updateLineage');
|
||||||
|
cy.get('.edge-info-drawer [data-testid="edit-description"]').click();
|
||||||
|
|
||||||
|
cy.get('.toastui-editor-md-container > .toastui-editor > .ProseMirror')
|
||||||
|
.click()
|
||||||
|
.clear()
|
||||||
|
.type(description);
|
||||||
|
|
||||||
|
cy.get('[data-testid="save"]').click();
|
||||||
|
verifyResponseStatusCode('@updateLineage', 200);
|
||||||
|
cy.get(
|
||||||
|
'.edge-info-drawer [data-testid="asset-description-container"] [data-testid="viewer-container"]'
|
||||||
|
).should('contain', description);
|
||||||
|
};
|
||||||
|
|
||||||
const verifyPipelineDataInDrawer = (
|
const verifyPipelineDataInDrawer = (
|
||||||
fromNode,
|
fromNode,
|
||||||
toNode,
|
toNode,
|
||||||
@ -231,6 +260,29 @@ const addColumnLineage = (fromNode, toNode, exitEditMode = true) => {
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const removeColumnLineage = (fromNode, toNode) => {
|
||||||
|
interceptURL('PUT', '/api/v1/lineage', 'lineageApi');
|
||||||
|
cy.get(
|
||||||
|
`[data-testid="column-edge-${btoa(fromNode.columns[0])}-${btoa(
|
||||||
|
toNode.columns[0]
|
||||||
|
)}"]`
|
||||||
|
).click({ force: true });
|
||||||
|
cy.get('[data-testid="delete-button"]').click({ force: true });
|
||||||
|
cy.get(
|
||||||
|
'[data-testid="delete-edge-confirmation-modal"] .ant-btn-primary'
|
||||||
|
).click();
|
||||||
|
|
||||||
|
verifyResponseStatusCode('@lineageApi', 200);
|
||||||
|
|
||||||
|
cy.get('[data-testid="edit-lineage"]').click();
|
||||||
|
|
||||||
|
cy.get(
|
||||||
|
`[data-testid="column-edge-${btoa(fromNode.columns[0])}-${btoa(
|
||||||
|
toNode.columns[0]
|
||||||
|
)}"]`
|
||||||
|
).should('not.exist');
|
||||||
|
};
|
||||||
|
|
||||||
describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
cy.login();
|
cy.login();
|
||||||
@ -323,6 +375,14 @@ describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
|||||||
PIPELINE_ITEMS[0],
|
PIPELINE_ITEMS[0],
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
|
editPipelineEdgeDescription(
|
||||||
|
sourceEntity,
|
||||||
|
targetEntity,
|
||||||
|
PIPELINE_ITEMS[0],
|
||||||
|
'Test Description'
|
||||||
|
);
|
||||||
|
|
||||||
cy.get('[data-testid="edit-lineage"]').click();
|
cy.get('[data-testid="edit-lineage"]').click();
|
||||||
deleteNode(targetEntity);
|
deleteNode(targetEntity);
|
||||||
});
|
});
|
||||||
@ -336,6 +396,10 @@ describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
|||||||
activateColumnLayer();
|
activateColumnLayer();
|
||||||
// Add column lineage
|
// Add column lineage
|
||||||
addColumnLineage(sourceEntity, targetEntity);
|
addColumnLineage(sourceEntity, targetEntity);
|
||||||
|
|
||||||
|
cy.get('[data-testid="edit-lineage"]').click();
|
||||||
|
removeColumnLineage(sourceEntity, targetEntity);
|
||||||
|
|
||||||
cy.get('[data-testid="edit-lineage"]').click();
|
cy.get('[data-testid="edit-lineage"]').click();
|
||||||
deleteNode(targetEntity);
|
deleteNode(targetEntity);
|
||||||
cy.goToHomePage();
|
cy.goToHomePage();
|
||||||
|
@ -72,7 +72,7 @@ describe('Test EntityLineageUtils utility', () => {
|
|||||||
sqlQuery: 'SELECT * FROM table',
|
sqlQuery: 'SELECT * FROM table',
|
||||||
columns: ['column1', 'column2'],
|
columns: ['column1', 'column2'],
|
||||||
description: 'This is a test',
|
description: 'This is a test',
|
||||||
pipeline: 'Test Pipeline',
|
pipeline: undefined,
|
||||||
source: 'Test Source',
|
source: 'Test Source',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
@ -84,7 +84,7 @@ describe('Test EntityLineageUtils utility', () => {
|
|||||||
sqlQuery: 'SELECT * FROM table',
|
sqlQuery: 'SELECT * FROM table',
|
||||||
columnsLineage: ['column1', 'column2'],
|
columnsLineage: ['column1', 'column2'],
|
||||||
description: 'This is a test',
|
description: 'This is a test',
|
||||||
pipeline: 'Test Pipeline',
|
pipeline: undefined,
|
||||||
source: 'Test Source',
|
source: 'Test Source',
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -90,7 +90,7 @@ import { EntityReference } from '../generated/type/entityReference';
|
|||||||
import { TagSource } from '../generated/type/tagLabel';
|
import { TagSource } from '../generated/type/tagLabel';
|
||||||
import { addLineage, deleteLineageEdge } from '../rest/miscAPI';
|
import { addLineage, deleteLineageEdge } from '../rest/miscAPI';
|
||||||
import { getPartialNameFromTableFQN } from './CommonUtils';
|
import { getPartialNameFromTableFQN } from './CommonUtils';
|
||||||
import { getEntityName } from './EntityUtils';
|
import { getEntityName, getEntityReferenceFromEntity } from './EntityUtils';
|
||||||
import Fqn from './Fqn';
|
import Fqn from './Fqn';
|
||||||
import { jsonToCSV } from './StringsUtils';
|
import { jsonToCSV } from './StringsUtils';
|
||||||
import { showErrorToast } from './ToastUtils';
|
import { showErrorToast } from './ToastUtils';
|
||||||
@ -792,13 +792,14 @@ export const getColumnLineageData = (
|
|||||||
data: Edge
|
data: Edge
|
||||||
) => {
|
) => {
|
||||||
const columnsLineage = columnsData?.reduce((col, curr) => {
|
const columnsLineage = columnsData?.reduce((col, curr) => {
|
||||||
if (curr.toColumn === data.data?.targetHandle) {
|
const sourceHandle = decodeLineageHandles(data.data?.sourceHandle);
|
||||||
|
const targetHandle = decodeLineageHandles(data.data?.targetHandle);
|
||||||
|
|
||||||
|
if (curr.toColumn === targetHandle) {
|
||||||
const newCol = {
|
const newCol = {
|
||||||
...curr,
|
...curr,
|
||||||
fromColumns:
|
fromColumns:
|
||||||
curr.fromColumns?.filter(
|
curr.fromColumns?.filter((column) => column !== sourceHandle) ?? [],
|
||||||
(column) => column !== data.data?.sourceHandle
|
|
||||||
) ?? [],
|
|
||||||
};
|
};
|
||||||
if (newCol.fromColumns?.length) {
|
if (newCol.fromColumns?.length) {
|
||||||
return [...col, newCol];
|
return [...col, newCol];
|
||||||
@ -871,13 +872,19 @@ export const getLineageDetailsObject = (edge: Edge): LineageDetails => {
|
|||||||
description = '',
|
description = '',
|
||||||
pipeline,
|
pipeline,
|
||||||
source,
|
source,
|
||||||
|
pipelineEntityType,
|
||||||
} = edge.data?.edge || {};
|
} = edge.data?.edge || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
sqlQuery,
|
sqlQuery,
|
||||||
columnsLineage: columns,
|
columnsLineage: columns,
|
||||||
description,
|
description,
|
||||||
pipeline,
|
pipeline: pipeline
|
||||||
|
? getEntityReferenceFromEntity(
|
||||||
|
pipeline,
|
||||||
|
pipelineEntityType ?? EntityType.PIPELINE
|
||||||
|
)
|
||||||
|
: undefined,
|
||||||
source,
|
source,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user