diff --git a/core/flow.py b/core/flow.py index c2e8edd0..ee0d5c93 100644 --- a/core/flow.py +++ b/core/flow.py @@ -36,7 +36,7 @@ def flowLogicEval(data,logicVar): def getObjectFromCode(codeFunction): functionName = codeFunction.split("(")[0] - args = regexCommor.split(codeFunction[(len(functionName)+1):-1]) + args = regexCommor.split(codeFunction.strip()[(len(functionName)+1):-1]) classObject = model._model().getAsClass(query={ "name" : functionName })[0].classObject() classObject.enabled = True members = [attr for attr in dir(classObject) if not callable(getattr(classObject, attr)) and not "__" in attr and attr ] @@ -109,12 +109,15 @@ def executeCodifyFlow(eventsData,codifyData): while True: if currentObject: if currentFlow["type"] == "trigger": - outputText+="\nTRIGGER" - outputText+="\n{0}".format(currentFlow["codeLine"]) - outputText+="\npre-data={0}".format(data) + if currentObject.name == "": + outputText+="\nTRIGGER" + else: + outputText+="\n(t) - {0}:".format(currentObject.name) + outputText+="\n\t[function]\n\t\t{0}".format(currentFlow["codeLine"]) + outputText+="\n\t[pre-data]\n\t\t{0}".format(data) objectContinue = True if currentObject.logicString.startswith("if"): - outputText+="\nChecking logic {0} = ".format(currentObject.logicString) + outputText+="\n\t[logic]\n\t\t{0}\n\t\t".format(currentObject.logicString) if logic.ifEval(currentObject.logicString,{ "data" : data}): outputText+="Pass" if currentObject.varDefinitions: @@ -133,27 +136,30 @@ def executeCodifyFlow(eventsData,codifyData): passData = copy.deepcopy(data) processQueue.append({ "flow" : nextFlow, "data" : passData }) passData = None - outputText+="\npost-data={0}".format(data) + outputText+="\n\t[post-data] - \n\t\t{0}".format(data) outputText+="\n" elif currentFlow["type"] == "action": - outputText+="\nACTION" + if currentObject.name == "": + outputText+="\nACTION" + else: + outputText+="\n(a) - {0}:".format(currentObject.name) if currentObject.enabled: - outputText+="\n{0}".format(currentFlow["codeLine"]) - outputText+="\npre-data={0}".format(data) + outputText+="\n\t[function]\n\t\t{0}".format(currentFlow["codeLine"]) + outputText+="\n\t[pre-data]\n\t\t{0}".format(data) logic = currentFlow["logic"][5:] - outputText+="\nChecking Flow logic {0} = ".format(logic) + outputText+="\n\t[link logic]\n\t\t{0}\n\t\t".format(logic) if flowLogicEval(data,helpers.typeCast(logic)): outputText+="Pass" debugText, data["action"] = currentObject.runHandler(data,persistentData,debug=True) if debugText != "": - outputText+="\n{0}".format(debugText) + outputText+="{0}".format(debugText) passData = data for nextFlow in currentFlow["next"]: if not passData: passData = copy.deepcopy(data) processQueue.append({ "flow" : nextFlow, "data" : passData }) passData = None - outputText+="\npost-data={0}".format(data) + outputText+="\n\t[post-data]\n\t\t{0}".format(data) else: outputText+="Failed" outputText+="\n" diff --git a/core/models/action.py b/core/models/action.py index 76b7375c..c5eba22a 100644 --- a/core/models/action.py +++ b/core/models/action.py @@ -61,10 +61,9 @@ def runHandler(self,data,persistentData,debug=False): actionResult = { "result" : False, "rc" : -1, "actionID" : self._id, "data" : {} } self.runHeader(data,persistentData,actionResult) if self.logicString.startswith("if"): - debugText="Checking logic ({0}) = ".format(self.logicString) if debug: logicDebugText, logicResult = logic.ifEval(self.logicString, { "data" : data }, debug=True) - debugText+="{0}\nLogic Debug ({1})".format(logicResult,logicDebugText) + debugText+="\n\t[action logic]\n\t\t{0}\n\t\t{1}\n\t\t({2})".format(self.logicString,logicResult,logicDebugText) else: logicResult = logic.ifEval(self.logicString, { "data" : data }) if logicResult: diff --git a/web/conductEditor.py b/web/conductEditor.py index 1c91f4e3..c26d9de4 100644 --- a/web/conductEditor.py +++ b/web/conductEditor.py @@ -394,6 +394,11 @@ def generateFlow(currentFlow,flowDict,triggers,actions): if flow["type"] == "trigger": flowCode+=generateFlow(flow,flowDict,triggers,actions) + data = request.args + if data: + if "json" in data: + return { "result" : flowCode, "CSRF" : api.g.sessionData["CSRF"] }, 200 + return render_template("blank.html",content=flowCode, CSRF=api.g.sessionData["CSRF"]), 200 @api.webServer.route("/conductEditor//flow//", methods=["DELETE"]) diff --git a/web/static/css/objectProperties.css b/web/static/css/objectProperties.css index fe43e824..a91a5c1a 100644 --- a/web/static/css/objectProperties.css +++ b/web/static/css/objectProperties.css @@ -44,6 +44,10 @@ width: 100%; } +.inputExpand { + height: 80%; +} + .existingPropertiesPanel-SearchResults { display: flex; flex-wrap: wrap; diff --git a/web/static/javascript/triggerObject.js b/web/static/javascript/triggerObject.js index 693fc502..ccea989f 100644 --- a/web/static/javascript/triggerObject.js +++ b/web/static/javascript/triggerObject.js @@ -5,10 +5,13 @@ var triggerObjectHTML = `
- + Events:
+
+ Output:
+
@@ -18,10 +21,14 @@ var triggerExistingPanels = {} function triggerTriggerObjectPanel(panel,flowID) { var conductID = GetURLParameter("conductID") - $.ajax({url: "/conduct/"+conductID+"/forceTrigger/"+flowID+"/", type:"POST", data:JSON.stringify({events: panel.find("#triggerValue").val(), CSRF: CSRF }), contentType:"application/json", success: function ( result ) { - dropdownAlert(panel,"success","Triggered",1000); - } - }); + $('#triggerOutput').text(""); + $.ajax({url: "/conductEditor/"+conductID+"/codify/?json=True", type:"GET", contentType:"application/json", success: function(result) { + $.ajax({url: "/codify/", type:"POST", data:JSON.stringify({ events: $('#triggerValue').val(), code: result["result"], CSRF: CSRF }), contentType:"application/json", success: function(result) { + $('#triggerOutput').text(result["result"]); + } + }); + } + }); } function createTriggerObjectPanel(flowID) { diff --git a/web/templates/conductEditor.html b/web/templates/conductEditor.html index 4df5c776..e19cdf3d 100644 --- a/web/templates/conductEditor.html +++ b/web/templates/conductEditor.html @@ -50,7 +50,7 @@
  • Duplicate
  • -
  • Trigger
  • +
  • Test
  • Modify UI ACL