Not unselecting when clicking copy, delete or startnode anymore
This commit is contained in:
@@ -1787,82 +1787,111 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onUnselect = (event) => {
|
const onUnselect = (event) => {
|
||||||
console.time("UNSELECT");
|
|
||||||
|
|
||||||
const nodedata = event.target.data();
|
const nodedata = event.target.data();
|
||||||
if (nodedata.app_name === undefined && nodedata.source === undefined) {
|
console.log("UNSELECT: ", nodedata);
|
||||||
return;
|
//if (nodedata.type === "ACTION") {
|
||||||
}
|
// setLastSelected(nodedata)
|
||||||
event.target.removeClass("selected");
|
//}
|
||||||
|
//
|
||||||
|
|
||||||
// Attempt at rewrite of name in other actions in following nodes.
|
// Wait for new node to possibly be selected
|
||||||
// Should probably be done in the onBlur for the textfield instead
|
setTimeout(() => {
|
||||||
/*
|
const typeIds = cy.elements('node:selected').jsons();
|
||||||
if (event.target.data().type === "ACTION") {
|
console.log("Found: ", typeIds)
|
||||||
const nodeaction = event.target.data()
|
for (var idkey in typeIds) {
|
||||||
const curaction = workflow.actions.find(a => a.id === nodeaction.id)
|
const item = typeIds[idkey]
|
||||||
console.log("workflowaction: ", curaction)
|
console.log("items: ", item)
|
||||||
console.log("nodeaction: ", nodeaction)
|
if (item.data.isButton === true) {
|
||||||
if (nodeaction.label !== curaction.label) {
|
console.log("Reselect old node & return - or just return?")
|
||||||
console.log("BEACH!")
|
|
||||||
|
|
||||||
var params = []
|
if (item.data.buttonType === "delete" && item.data.attachedTo === nodedata.id) {
|
||||||
const fixedName = "$"+curaction.label.toLowerCase().replace(" ", "_")
|
console.log("delete of same node!")
|
||||||
for (var actionkey in workflow.actions) {
|
|
||||||
if (workflow.actions[actionkey].id === curaction.id) {
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for (var paramkey in workflow.actions[actionkey].parameters) {
|
//if (nodedata.app_name === undefined && nodedata.source === undefined) {
|
||||||
const param = workflow.actions[actionkey].parameters[paramkey]
|
// return;
|
||||||
if (param.value === null || param.value === undefined || !param.value.includes("$")) {
|
//}
|
||||||
|
//event.target.removeClass("selected");
|
||||||
|
//
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//// If button is clicked, select current node
|
||||||
|
|
||||||
|
// Attempt at rewrite of name in other actions in following nodes.
|
||||||
|
// Should probably be done in the onBlur for the textfield instead
|
||||||
|
/*
|
||||||
|
if (event.target.data().type === "ACTION") {
|
||||||
|
const nodeaction = event.target.data()
|
||||||
|
const curaction = workflow.actions.find(a => a.id === nodeaction.id)
|
||||||
|
console.log("workflowaction: ", curaction)
|
||||||
|
console.log("nodeaction: ", nodeaction)
|
||||||
|
if (nodeaction.label !== curaction.label) {
|
||||||
|
console.log("BEACH!")
|
||||||
|
|
||||||
|
var params = []
|
||||||
|
const fixedName = "$"+curaction.label.toLowerCase().replace(" ", "_")
|
||||||
|
for (var actionkey in workflow.actions) {
|
||||||
|
if (workflow.actions[actionkey].id === curaction.id) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
const innername = param.value.toLowerCase().replace(" ", "_")
|
for (var paramkey in workflow.actions[actionkey].parameters) {
|
||||||
if (innername.includes(fixedName)) {
|
const param = workflow.actions[actionkey].parameters[paramkey]
|
||||||
//workflow.actions[actionkey].parameters[paramkey].replace(
|
if (param.value === null || param.value === undefined || !param.value.includes("$")) {
|
||||||
//console.log("FOUND!: ", innername)
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
const innername = param.value.toLowerCase().replace(" ", "_")
|
||||||
|
if (innername.includes(fixedName)) {
|
||||||
|
//workflow.actions[actionkey].parameters[paramkey].replace(
|
||||||
|
//console.log("FOUND!: ", innername)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
*/
|
||||||
*/
|
|
||||||
|
|
||||||
//cy.removeListener("select");
|
//cy.removeListener("select");
|
||||||
//cy.on("select", "node", (e) => onNodeSelect(e, appAuthentication));
|
//cy.on("select", "node", (e) => onNodeSelect(e, appAuthentication));
|
||||||
//cy.on("select", "edge", (e) => onEdgeSelect(e));
|
//cy.on("select", "edge", (e) => onEdgeSelect(e));
|
||||||
|
|
||||||
|
|
||||||
// FIXME - check if they have value before overriding like this for no reason.
|
// FIXME - check if they have value before overriding like this for no reason.
|
||||||
// Would save a lot of time (400~ ms -> 30ms)
|
// Would save a lot of time (400~ ms -> 30ms)
|
||||||
//console.log("ACTION: ", selectedAction)
|
//console.log("ACTION: ", selectedAction)
|
||||||
//console.log("APP: ", selectedApp)
|
//console.log("APP: ", selectedApp)
|
||||||
|
|
||||||
ReactDOM.unstable_batchedUpdates(() => {
|
ReactDOM.unstable_batchedUpdates(() => {
|
||||||
setSelectedAction({});
|
setSelectedAction({});
|
||||||
setSelectedApp({});
|
setSelectedApp({});
|
||||||
setSelectedTrigger({});
|
setSelectedTrigger({});
|
||||||
setSelectedComment({})
|
setSelectedComment({})
|
||||||
setSelectedEdge({});
|
setSelectedEdge({});
|
||||||
|
|
||||||
setSelectedEdge({})
|
setSelectedEdge({})
|
||||||
setSelectedActionEnvironment({})
|
setSelectedActionEnvironment({})
|
||||||
setTriggerAuthentication({})
|
setTriggerAuthentication({})
|
||||||
setSelectedTriggerIndex(-1)
|
setSelectedTriggerIndex(-1)
|
||||||
setTriggerFolders([])
|
setTriggerFolders([])
|
||||||
setSubworkflow({})
|
setSubworkflow({})
|
||||||
|
|
||||||
// Can be used for right side view
|
// Can be used for right side view
|
||||||
setRightSideBarOpen(false);
|
setRightSideBarOpen(false);
|
||||||
setScrollConfig({
|
setScrollConfig({
|
||||||
top: 0,
|
top: 0,
|
||||||
left: 0,
|
left: 0,
|
||||||
selected: "",
|
selected: "",
|
||||||
});
|
});
|
||||||
console.timeEnd("UNSELECT");
|
//console.timeEnd("UNSELECT");
|
||||||
})
|
})
|
||||||
|
}, 150)
|
||||||
};
|
};
|
||||||
|
|
||||||
const onEdgeSelect = (event) => {
|
const onEdgeSelect = (event) => {
|
||||||
@@ -2282,6 +2311,7 @@ const AngularWorkflow = (defaultprops) => {
|
|||||||
return
|
return
|
||||||
} else if (data.buttonType === "copy") {
|
} else if (data.buttonType === "copy") {
|
||||||
console.log("COPY!");
|
console.log("COPY!");
|
||||||
|
|
||||||
// 1. Find parent
|
// 1. Find parent
|
||||||
// 2. Find branches for parent
|
// 2. Find branches for parent
|
||||||
// 3. Make a new node that's moved a little bit
|
// 3. Make a new node that's moved a little bit
|
||||||
|
|||||||
Reference in New Issue
Block a user