feat: delete the edge on the classification node anchor when the anch… (#1297)

### What problem does this PR solve?

feat: delete the edge on the classification node anchor when the anchor
is connected to other nodes #918

### Type of change

- [x] New Feature (non-breaking change which adds functionality)
This commit is contained in:
balibabu
2024-06-27 15:48:11 +08:00
committed by GitHub
parent fbb8cbfc67
commit 5a1e01d96f
2 changed files with 23 additions and 3 deletions

View File

@@ -167,13 +167,13 @@ export const buildDslComponentsByGraph = (
return components;
};
export const getOperatorType = (id: string | null) => {
export const getOperatorTypeFromId = (id: string | null) => {
return id?.split(':')[0] as Operator | undefined;
};
// restricted lines cannot be connected successfully.
export const isValidConnection = (connection: Connection) => {
return RestrictedUpstreamMap[
getOperatorType(connection.source) as Operator
]?.every((x) => x !== getOperatorType(connection.target));
getOperatorTypeFromId(connection.source) as Operator
]?.every((x) => x !== getOperatorTypeFromId(connection.target));
};