mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-27 18:36:08 +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);
|
||||
};
|
||||
|
||||
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 = (
|
||||
fromNode,
|
||||
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' }, () => {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
@ -323,6 +375,14 @@ describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
||||
PIPELINE_ITEMS[0],
|
||||
true
|
||||
);
|
||||
|
||||
editPipelineEdgeDescription(
|
||||
sourceEntity,
|
||||
targetEntity,
|
||||
PIPELINE_ITEMS[0],
|
||||
'Test Description'
|
||||
);
|
||||
|
||||
cy.get('[data-testid="edit-lineage"]').click();
|
||||
deleteNode(targetEntity);
|
||||
});
|
||||
@ -336,6 +396,10 @@ describe('Lineage verification', { tags: 'DataAssets' }, () => {
|
||||
activateColumnLayer();
|
||||
// Add column lineage
|
||||
addColumnLineage(sourceEntity, targetEntity);
|
||||
|
||||
cy.get('[data-testid="edit-lineage"]').click();
|
||||
removeColumnLineage(sourceEntity, targetEntity);
|
||||
|
||||
cy.get('[data-testid="edit-lineage"]').click();
|
||||
deleteNode(targetEntity);
|
||||
cy.goToHomePage();
|
||||
|
@ -72,7 +72,7 @@ describe('Test EntityLineageUtils utility', () => {
|
||||
sqlQuery: 'SELECT * FROM table',
|
||||
columns: ['column1', 'column2'],
|
||||
description: 'This is a test',
|
||||
pipeline: 'Test Pipeline',
|
||||
pipeline: undefined,
|
||||
source: 'Test Source',
|
||||
},
|
||||
},
|
||||
@ -84,7 +84,7 @@ describe('Test EntityLineageUtils utility', () => {
|
||||
sqlQuery: 'SELECT * FROM table',
|
||||
columnsLineage: ['column1', 'column2'],
|
||||
description: 'This is a test',
|
||||
pipeline: 'Test Pipeline',
|
||||
pipeline: undefined,
|
||||
source: 'Test Source',
|
||||
});
|
||||
|
||||
|
@ -90,7 +90,7 @@ import { EntityReference } from '../generated/type/entityReference';
|
||||
import { TagSource } from '../generated/type/tagLabel';
|
||||
import { addLineage, deleteLineageEdge } from '../rest/miscAPI';
|
||||
import { getPartialNameFromTableFQN } from './CommonUtils';
|
||||
import { getEntityName } from './EntityUtils';
|
||||
import { getEntityName, getEntityReferenceFromEntity } from './EntityUtils';
|
||||
import Fqn from './Fqn';
|
||||
import { jsonToCSV } from './StringsUtils';
|
||||
import { showErrorToast } from './ToastUtils';
|
||||
@ -792,13 +792,14 @@ export const getColumnLineageData = (
|
||||
data: Edge
|
||||
) => {
|
||||
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 = {
|
||||
...curr,
|
||||
fromColumns:
|
||||
curr.fromColumns?.filter(
|
||||
(column) => column !== data.data?.sourceHandle
|
||||
) ?? [],
|
||||
curr.fromColumns?.filter((column) => column !== sourceHandle) ?? [],
|
||||
};
|
||||
if (newCol.fromColumns?.length) {
|
||||
return [...col, newCol];
|
||||
@ -871,13 +872,19 @@ export const getLineageDetailsObject = (edge: Edge): LineageDetails => {
|
||||
description = '',
|
||||
pipeline,
|
||||
source,
|
||||
pipelineEntityType,
|
||||
} = edge.data?.edge || {};
|
||||
|
||||
return {
|
||||
sqlQuery,
|
||||
columnsLineage: columns,
|
||||
description,
|
||||
pipeline,
|
||||
pipeline: pipeline
|
||||
? getEntityReferenceFromEntity(
|
||||
pipeline,
|
||||
pipelineEntityType ?? EntityType.PIPELINE
|
||||
)
|
||||
: undefined,
|
||||
source,
|
||||
};
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user