Fix selection validation and error message
This commit is contained in:
parent
7912f846a6
commit
7d7a980e7c
1 changed files with 12 additions and 1 deletions
|
|
@ -677,6 +677,7 @@ export function validateSelection(
|
||||||
if (selection.edges.length === 0) {
|
if (selection.edges.length === 0) {
|
||||||
selection.edges = edges;
|
selection.edges = edges;
|
||||||
}
|
}
|
||||||
|
|
||||||
// get only edges that are connected to the nodes in the selection
|
// get only edges that are connected to the nodes in the selection
|
||||||
// first creates a set of all the nodes ids
|
// first creates a set of all the nodes ids
|
||||||
let nodesSet = new Set(selection.nodes.map((n) => n.id));
|
let nodesSet = new Set(selection.nodes.map((n) => n.id));
|
||||||
|
|
@ -692,7 +693,17 @@ export function validateSelection(
|
||||||
if (selection.nodes.length < 2) {
|
if (selection.nodes.length < 2) {
|
||||||
errorsArray.push("Please select more than one node");
|
errorsArray.push("Please select more than one node");
|
||||||
}
|
}
|
||||||
|
if (
|
||||||
|
selection.nodes.some(
|
||||||
|
(node) =>
|
||||||
|
isInputNode(node.data as NodeDataType) ||
|
||||||
|
isOutputNode(node.data as NodeDataType)
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
errorsArray.push(
|
||||||
|
"Please select only nodes that are not input or output nodes"
|
||||||
|
);
|
||||||
|
}
|
||||||
//check if there are two or more nodes with free outputs
|
//check if there are two or more nodes with free outputs
|
||||||
if (
|
if (
|
||||||
selection.nodes.filter(
|
selection.nodes.filter(
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue