Fixed issues with names in conditions when changing
This commit is contained in:
@@ -2025,7 +2025,6 @@ class AppBase:
|
||||
errors = False
|
||||
error_msg = ""
|
||||
try:
|
||||
#self.logger.info("In liquid")
|
||||
if len(template) > 10000000:
|
||||
self.logger.info("[DEBUG] Skipping liquid - size too big (%d)" % len(template))
|
||||
return template
|
||||
@@ -2240,7 +2239,6 @@ class AppBase:
|
||||
#self.logger.info("STATIC PARSED: %s" % actualitem)
|
||||
#self.logger.info("[INFO] Done with regex matching")
|
||||
if len(actualitem) > 0:
|
||||
#self.logger.info("[DEBUG] Matches: ", actualitem)
|
||||
for replace in actualitem:
|
||||
try:
|
||||
to_be_replaced = replace[0]
|
||||
@@ -2798,7 +2796,7 @@ class AppBase:
|
||||
}))
|
||||
|
||||
if parameter["name"] == "body":
|
||||
self.logger.info("[INFO] Should debug field with liquid and other checks as it's BODY: %s" % value)
|
||||
self.logger.info(f"[INFO] Should debug field with liquid and other checks as it's BODY: {value}")
|
||||
|
||||
# Custom format for ${name[0,1,2,...]}$
|
||||
#submatch = "([${]{2}([0-9a-zA-Z_-]+)(\[.*\])[}$]{2})"
|
||||
|
||||
@@ -2666,6 +2666,117 @@ const ParsedAction = (props) => {
|
||||
|
||||
// Change in actions, triggers & conditions
|
||||
// Highlight the changes somehow with a glow?
|
||||
//
|
||||
// Should make it a function lol
|
||||
if (workflow.branches !== undefined && workflow.branches !== null) {
|
||||
for (var key in workflow.branches) {
|
||||
for (var subkey in workflow.branches[key].conditions) {
|
||||
const condition = workflow.branches[key].conditions[subkey]
|
||||
const sourceparam = condition.source
|
||||
const destinationparam = condition.destination
|
||||
|
||||
// Should have a smarter way of discovering node names
|
||||
// Finding index(es) and replacing at the location
|
||||
if (sourceparam.value.includes("$")) {
|
||||
try {
|
||||
var cnt = -1
|
||||
var previous = 0
|
||||
while (true) {
|
||||
cnt += 1
|
||||
// Need to make sure e.g. changing the first here doesn't change the 2nd
|
||||
// $change_me
|
||||
// $change_me_2
|
||||
|
||||
const foundindex = sourceparam.value.toLowerCase().indexOf(parsedBaseLabel, previous)
|
||||
if (foundindex === previous && foundindex !== 0) {
|
||||
break
|
||||
}
|
||||
|
||||
if (foundindex >= 0) {
|
||||
previous = foundindex+newname.length
|
||||
// Need to add diff of length to word
|
||||
|
||||
// Check location:
|
||||
// If it's a-zA-Z_ then don't replace
|
||||
if (sourceparam.value.length > foundindex+parsedBaseLabel.length) {
|
||||
const regex = /[a-zA-Z0-9_]/g;
|
||||
const match = sourceparam.value[foundindex+parsedBaseLabel.length].match(regex);
|
||||
if (match !== null) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Old found: ", workflow.branches[key].conditions[subkey].source.value)
|
||||
const extralength = newname.length-parsedBaseLabel.length
|
||||
sourceparam.value = sourceparam.value.substring(0, foundindex) + newname + sourceparam.value.substring(foundindex-extralength+newname.length, sourceparam.value.length)
|
||||
|
||||
console.log("New: ", workflow.branches[key].conditions[subkey].source.value)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Break no matter what after 5 replaces. May need to increase
|
||||
if (cnt >= 5) {
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Failed value replacement based on index: ", e)
|
||||
}
|
||||
}
|
||||
|
||||
if (destinationparam.value.includes("$")) {
|
||||
try {
|
||||
var cnt = -1
|
||||
var previous = 0
|
||||
while (true) {
|
||||
cnt += 1
|
||||
// Need to make sure e.g. changing the first here doesn't change the 2nd
|
||||
// $change_me
|
||||
// $change_me_2
|
||||
|
||||
const foundindex = destinationparam.value.toLowerCase().indexOf(parsedBaseLabel, previous)
|
||||
if (foundindex === previous && foundindex !== 0) {
|
||||
break
|
||||
}
|
||||
|
||||
if (foundindex >= 0) {
|
||||
previous = foundindex+newname.length
|
||||
// Need to add diff of length to word
|
||||
|
||||
// Check location:
|
||||
// If it's a-zA-Z_ then don't replace
|
||||
if (destinationparam.value.length > foundindex+parsedBaseLabel.length) {
|
||||
const regex = /[a-zA-Z0-9_]/g;
|
||||
const match = destinationparam.value[foundindex+parsedBaseLabel.length].match(regex);
|
||||
if (match !== null) {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
console.log("Old found: ", workflow.branches[key].conditions[subkey].destination.value)
|
||||
const extralength = newname.length-parsedBaseLabel.length
|
||||
destinationparam.value = destinationparam.value.substring(0, foundindex) + newname + destinationparam.value.substring(foundindex-extralength+newname.length, destinationparam.value.length)
|
||||
|
||||
console.log("New: ", workflow.branches[key].conditions[subkey].destination.value)
|
||||
} else {
|
||||
break
|
||||
}
|
||||
|
||||
// Break no matter what after 5 replaces. May need to increase
|
||||
if (cnt >= 5) {
|
||||
break
|
||||
}
|
||||
|
||||
}
|
||||
} catch (e) {
|
||||
console.log("Failed value replacement based on index: ", e)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (var key in workflow.actions) {
|
||||
if (workflow.actions[key].id === selectedAction.id) {
|
||||
@@ -2681,6 +2792,7 @@ const ParsedAction = (props) => {
|
||||
// Should have a smarter way of discovering node names
|
||||
// Do regex?
|
||||
// Finding index(es) and replacing at the location
|
||||
//
|
||||
|
||||
try {
|
||||
var cnt = -1
|
||||
|
||||
@@ -7055,8 +7055,10 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
|
||||
var currentedge = cy.getElementById(selectedEdge.id);
|
||||
if (currentedge !== undefined && currentedge !== null) {
|
||||
currentedge.data().label = label;
|
||||
if (currentedge !== undefined && currentedge !== null && label !== undefined) {
|
||||
currentedge.data("label", label)
|
||||
//.label = label;
|
||||
//oldstartnode[0].data("isStartNode", false);
|
||||
}
|
||||
|
||||
setSelectedEdge(selectedEdge);
|
||||
|
||||
Reference in New Issue
Block a user