From f17d2a0d5858efb49a38515a7caf01373279a0fa Mon Sep 17 00:00:00 2001 From: Frikky Date: Thu, 20 Jun 2024 12:01:24 +0200 Subject: [PATCH] Last little workflow fixes before ui merge fix yay --- frontend/src/components/Files.jsx | 12 ++++---- frontend/src/components/ParsedAction.jsx | 28 ++++++++++++------- .../src/components/ShuffleCodeEditor1.jsx | 7 +++-- frontend/src/views/AngularWorkflow.jsx | 15 +++++----- frontend/src/views/Workflows.jsx | 2 +- 5 files changed, 38 insertions(+), 26 deletions(-) diff --git a/frontend/src/components/Files.jsx b/frontend/src/components/Files.jsx index 4ad5292a..60e7da79 100644 --- a/frontend/src/components/Files.jsx +++ b/frontend/src/components/Files.jsx @@ -410,6 +410,7 @@ const Files = (props) => { ) { toast("Failed to delete file: " + responseJson.reason); } + setTimeout(() => { getFiles(selectedCategory) }, 1500); @@ -697,13 +698,14 @@ const Files = (props) => { //setFile(fileObject) //const files = event.target.files[0] uploadFiles(event.target.files); + }} /> @@ -846,7 +848,7 @@ const Files = (props) => { /> { { disabled={file.status !== "active"} style = {{padding: "6px"}} onClick={() => { - deleteFile(file); + deleteFile(file) }} > { if (workflowExecutions.length > 0) { // Look for the ID var found = false; + var curResult = null for (let [key,keyval] in Object.entries(workflowExecutions)) { if (workflowExecutions[key].results === undefined || workflowExecutions[key].results === null) { - continue; + continue } var foundResult = workflowExecutions[key].results.find( @@ -3133,10 +3134,10 @@ const ParsedAction = (props) => { ) if (foundResult === undefined || foundResult === null) { - continue; + continue } - const oldstartnode = cy.getElementById(selectedAction.id); + const oldstartnode = cy.getElementById(selectedAction.id) if (oldstartnode !== undefined && oldstartnode !== null) { const foundname = oldstartnode.data("label") if (foundname !== undefined && foundname !== null) { @@ -3144,14 +3145,21 @@ const ParsedAction = (props) => { } } - setSelectedResult(foundResult); - if (setCodeModalOpen !== undefined) { - setCodeModalOpen(true); - - found = true - } + // Not breaking unless necessary + curResult = foundResult + found = true - break; + if (curResult.status === "SUCCESS") { + break + } + } + + if (curResult !== null) { + setSelectedResult(curResult) + + if (setCodeModalOpen !== undefined) { + setCodeModalOpen(true) + } } if (!found) { diff --git a/frontend/src/components/ShuffleCodeEditor1.jsx b/frontend/src/components/ShuffleCodeEditor1.jsx index 33c3c6c5..1dc0ecaa 100644 --- a/frontend/src/components/ShuffleCodeEditor1.jsx +++ b/frontend/src/components/ShuffleCodeEditor1.jsx @@ -1581,7 +1581,8 @@ const CodeEditor = (props) => { >
- Expected Output + + {selectedAction === undefined ? "" : selectedAction.name === "execute_python" ? "Code to run" : "Expected Output"}
@@ -1598,7 +1599,7 @@ const CodeEditor = (props) => { border: `1px solid ${theme.palette.primary.main}`, position: "absolute", top: 24, - right: 65, + right: 100, maxHeight: 35, minWidth: 70, }} @@ -1609,7 +1610,7 @@ const CodeEditor = (props) => { {executing ? : - Try it + {selectedAction === undefined ? "" : selectedAction.name === "execute_python" ? "Run Python Code" : "Try it"} } diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index a2ef33d2..7197f7d6 100755 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -2105,8 +2105,8 @@ const AngularWorkflow = (defaultprops) => { }) .catch((error) => { setSavingState(0); - //toast(error.toString()); console.log("Save workflow error: ", error.toString()); + toast.warn("Failed to save the workflow. Is the network down?") }); if (originalWorkflow.id === undefined || originalWorkflow.id === null || originalWorkflow.id.length === 0 || useworkflow.id === originalWorkflow.id) { @@ -8297,7 +8297,7 @@ const AngularWorkflow = (defaultprops) => { }) }} > - New execution variable + New Runtime variable @@ -8601,7 +8601,8 @@ const AngularWorkflow = (defaultprops) => { } if (parsedApp === undefined || parsedApp === null || parsedApp.data === undefined || parsedApp.data === null) { - toast("Failed to add trigger. Please try again.") + toast("Failed to add node. Please try again.") + console.log("Failed to add node. Please try again. Parsed app:", parsedApp) return } @@ -19052,7 +19053,7 @@ const AngularWorkflow = (defaultprops) => { data.value = data.value.substring(2) } - if (!data.value.startsWith("http") || (data.value.startsWith("/") && data.value.includes("?"))) { + if (data.value.startsWith("http") || (data.value.startsWith("/") && data.value.includes("?"))) { showlink = true } } @@ -19348,7 +19349,7 @@ const AngularWorkflow = (defaultprops) => { const result = execution.results.find((data) => data.status === "SUCCESS" && data.action.id === selectedResult.action.id) if (result !== undefined) { - const oldstartnode = cy.getElementById(selectedResult.action.id); + const oldstartnode = cy.getElementById(selectedResult.action.id) if (oldstartnode !== undefined && oldstartnode !== null) { const foundname = oldstartnode.data("label") if (foundname !== undefined && foundname !== null) { @@ -19356,8 +19357,8 @@ const AngularWorkflow = (defaultprops) => { } } - setSelectedResult(result); - setUpdate(Math.random()); + setSelectedResult(result) + setUpdate(Math.random()) break; } } diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index b742157a..299e0c2d 100755 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -130,7 +130,6 @@ export const GetIconInfo = (action) => { // Finds the icon based on the action. Should be verbs. const iconList = [ { key: "cases", values: ["cases"] }, - { key: "communication", values: ["communication", "comms", "email",] }, { key: "cache_add", values: ["set_cache"] }, { key: "cache_get", values: ["get_cache"] }, { key: "filter", values: ["filter"] }, @@ -200,6 +199,7 @@ export const GetIconInfo = (action) => { values: ["compare", "convert", "to", "filter", "translate", "parse"], }, { key: "close", values: ["close", "stop", "cancel", "block"] }, + { key: "communication", values: ["communication", "comms", "email", "mail",] }, ]; var selectedKey = ""