From be0aed82e3d89cd702663ca1e6d52ae0a830b9bc Mon Sep 17 00:00:00 2001 From: frikky Date: Thu, 27 Oct 2022 18:00:04 +0200 Subject: [PATCH] Cleaned up how keys are handled for duplicates and published workflows. Further changes APIs to use the correct one again for OpenAPI loading --- backend/app_sdk/app_base.py | 4 +- frontend/src/views/AngularWorkflow.jsx | 7 ++-- frontend/src/views/AppCreator.jsx | 55 +++++++++++++------------- frontend/src/views/Workflows.jsx | 9 ++++- 4 files changed, 41 insertions(+), 34 deletions(-) diff --git a/backend/app_sdk/app_base.py b/backend/app_sdk/app_base.py index d77315f6..5a8a76d3 100644 --- a/backend/app_sdk/app_base.py +++ b/backend/app_sdk/app_base.py @@ -3424,7 +3424,7 @@ class AppBase: errorstring = f"{e}" if "the JSON object must be" in errorstring: - self.logger.info("[ERROR] Something is wrong with the input for this function. Are lists and JSON data handled parsed properly?") + self.logger.info("[ERROR] Something is wrong with the input for this function. Are lists and JSON data handled parsed properly (0)?") try: e = json.loads(f"{e}") except: @@ -3454,7 +3454,7 @@ class AppBase: }) break except Exception as e: - self.logger.info("[ERROR] Something is wrong with the input for this function. Are lists and JSON data handled parsed properly?") + self.logger.info("[ERROR] Something is wrong with the input for this function. Are lists and JSON data handled parsed properly (1)?") try: e = json.loads(f"{e}") diff --git a/frontend/src/views/AngularWorkflow.jsx b/frontend/src/views/AngularWorkflow.jsx index f10240dd..33813a34 100644 --- a/frontend/src/views/AngularWorkflow.jsx +++ b/frontend/src/views/AngularWorkflow.jsx @@ -1,5 +1,6 @@ import React, { useState, useEffect, useLayoutEffect } from "react"; import ReactDOM from "react-dom" + import { useInterval } from "react-powerhooks"; import { makeStyles, useTheme } from "@material-ui/core/styles"; @@ -1400,7 +1401,6 @@ const AngularWorkflow = (defaultprops) => { setVisited([]) setExecutionRequest({}) stop() - }) var curelements = cy.elements(); for (var i = 0; i < curelements.length; i++) { @@ -1476,6 +1476,7 @@ const AngularWorkflow = (defaultprops) => { setExecutionRequestStarted(false) console.log("Execute workflow err: ", error.toString()); }); + }) }; // This can be used to only show prioritzed ones later @@ -13858,7 +13859,7 @@ const AngularWorkflow = (defaultprops) => { Execution Variable - Execution Variables are TEMPORARY variables that you can ony be set + Execution Variables are TEMPORARY variables that you can only be set and used during execution. Learn more{" "} { const variable = execution.execution_variables.find( (data) => data.name === newVariableName - ); + ) if (variable === undefined || variable.value === undefined) { return null; } diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index 05a57944..81538b8f 100644 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -393,35 +393,36 @@ const AppCreator = (defaultprops) => { return; } - handleEditApp(urlParams.get("id")) + //handleEditApp(urlParams.get("id")) - //fetch(globalUrl + "/api/v1/get_openapi/" + urlParams.get("id"), { - // method: "GET", - // headers: { - // "Content-Type": "application/json", - // Accept: "application/json", - // }, - // credentials: "include", - //}) - // .then((response) => { - // if (response.status !== 200) { - // throw new Error("NOT 200 :O"); - // } + // THIS has to stay due to ID may not exist as normal app yet + fetch(globalUrl + "/api/v1/get_openapi/" + urlParams.get("id"), { + method: "GET", + headers: { + "Content-Type": "application/json", + Accept: "application/json", + }, + credentials: "include", + }) + .then((response) => { + if (response.status !== 200) { + throw new Error("NOT 200 :O"); + } - // return response.json(); - // }) - // .then((responseJson) => { - // setIsAppLoaded(true); - // if (!responseJson.success) { - // alert.error("Failed to verify"); - // } else { - // parseIncomingOpenapiData(responseJson); - // } - // }) - // .catch((error) => { - // console.log("Error: ", error.toString()); - // alert.error(error.toString()); - // }); + return response.json(); + }) + .then((responseJson) => { + setIsAppLoaded(true); + if (!responseJson.success) { + alert.error("Failed to get app config. Do you have access?"); + } else { + parseIncomingOpenapiData(responseJson); + } + }) + .catch((error) => { + console.log("Error: ", error.toString()); + alert.error(error.toString()); + }); }; const setFileFromb64 = () => { diff --git a/frontend/src/views/Workflows.jsx b/frontend/src/views/Workflows.jsx index 7aeda1ca..224e717a 100644 --- a/frontend/src/views/Workflows.jsx +++ b/frontend/src/views/Workflows.jsx @@ -1274,8 +1274,12 @@ const Workflows = (props) => { for (var subkey in data.actions[key].parameters) { const param = data.actions[key].parameters[subkey]; + + // Removed October 10th, 2022 as key usually isn't + // containing anything secret, but rather necessary configurations. + // param.name.includes("key") || + // if ( - param.name.includes("key") || param.name.includes("user") || param.name.includes("pass") || param.name.includes("api") || @@ -1322,8 +1326,9 @@ const Workflows = (props) => { ) { for (key in data.workflow_variables) { const param = data.workflow_variables[key]; + //param.name.includes("key") || + if ( - param.name.includes("key") || param.name.includes("user") || param.name.includes("pass") || param.name.includes("api") ||