From b367b4cfb7672898d28b2fca04af815af50bc0d3 Mon Sep 17 00:00:00 2001 From: Frikky Date: Thu, 13 Feb 2025 03:46:14 +0100 Subject: [PATCH] Synced 2.0 fixes for RC6 --- frontend/src/components/EditWorkflow.jsx | 209 ++-- frontend/src/components/LeftSideBar.jsx | 4 +- frontend/src/components/ParsedAction.jsx | 58 +- frontend/src/components/Priorities.jsx | 61 ++ .../src/components/ShuffleCodeEditor1.jsx | 179 +++- frontend/src/theme.jsx | 2 +- frontend/src/views/AngularWorkflow.jsx | 928 ++++++++++++++---- frontend/src/views/Apps2.jsx | 1 - frontend/src/views/Docs.jsx | 16 +- frontend/src/views/Workflows2.jsx | 51 +- 10 files changed, 1107 insertions(+), 402 deletions(-) diff --git a/frontend/src/components/EditWorkflow.jsx b/frontend/src/components/EditWorkflow.jsx index fd53f5eb..cf51720b 100644 --- a/frontend/src/components/EditWorkflow.jsx +++ b/frontend/src/components/EditWorkflow.jsx @@ -71,8 +71,7 @@ const EditWorkflow = (props) => { const [_, setUpdate] = React.useState(""); // Used for rendering, don't remove const [submitLoading, setSubmitLoading] = React.useState(false); - //const [showMoreClicked, setShowMoreClicked] = React.useState(expanded === true ? true : false); - const [showMoreClicked, setShowMoreClicked] = React.useState(true); + const [showMoreClicked, setShowMoreClicked] = React.useState(isEditing !== false ? true : false); const [innerWorkflow, setInnerWorkflow] = React.useState(workflow) @@ -569,12 +568,13 @@ const EditWorkflow = (props) => { - MSSP controls + MSSP & Distribution controls - - MSSP Suborg Distribution (beta - contact support@shuffler.io for more info) + + Multi-Tenant Workflows. Make one workflow, and keep a separate, synced copy in all your tenants. Control distributed auth, runtime locations, files, datastore keys etc. (late beta - contact support@shuffler.io if you want a demo. Please try it!) + {userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ? userdata.orgs.filter(org => org.creator_org === userdata.active_org.id).length === 0 ? userdata.active_org.creator_org === undefined || userdata.active_org.creator_org === null || userdata.active_org.creator_org === "" ? @@ -677,15 +677,12 @@ const EditWorkflow = (props) => { } - {/**/} - - - + Git Backup Repository - Decide where this workflow is backed up in a Git repository. Will create logs and notifications if upload fails. The repository and branch must already have been initialized. Files will show up in the root folder in the format 'orgid/workflow status/workflow id.json' without images. Overrides your default backup repository. Credentials are encrypted. Creates notifications if it fails. + Decide where this workflow is backed up in a Git repository. Will create logs and notifications if upload fails. The repository and branch must already have been initialized. Files will show up in the root folder in the format 'orgid/workflow status/workflow id.json' and be formatted, with removed images, to make diffing easy. Overrides your default backup repository. Credentials are encrypted. Creates notifications if it fails. @@ -1078,122 +1075,106 @@ const EditWorkflow = (props) => { - - : null} - {/*!isEditing ? <> -
- } - label="Create workflow as code" - style={{ marginTop: '12px' }} - onChange={(e) => { - setWorkflowAsCode(e.target.checked) - workflow.workflow_as_code = e.target.checked - setWorkflow(workflow) - setInnerWorkflow(workflow) + + + Publishing + + + Publishing is related to making the workflow itself public. When publishing a workflow, all the details (except sensitive info) become available to everyone. The details below will help a user understand this better. When a workflow is published, you keep the original, and a copy enters the workflow search, and is associated with your creator account, if you have one. You can always unpublish the workflow after. When ready to publish, click the three dots next to a workflow on the main workflow screen. After publishing, you can find it in the Shuffle search engine. + + + + { + setDueDate(newValue) }} /> + -
- : null*/} + + Type + { + console.log("Data: ", e.target.value) - - Publishing - - - Publishing is related to making the workflow itself public. When publishing a workflow, all the details (except sensitive info) become available to everyone. The details below will help a user understand this better. When a workflow is published, you keep the original, and a copy enters the workflow search, and is associated with your creator account, if you have one. You can always unpublish the workflow after. To publish it, click the three dots next to the workflow. - + innerWorkflow.workflow_type = e.target.value + setInnerWorkflow(innerWorkflow) + }} + > + } label="Trigger" /> + } label="Subflow" /> + } label="Standalone" /> - - { - setDueDate(newValue) - }} - /> - + + - - Type - { - console.log("Data: ", e.target.value) - innerWorkflow.workflow_type = e.target.value + { + innerWorkflow.blogpost = event.target.value setInnerWorkflow(innerWorkflow) }} - > - } label="Trigger" /> - } label="Subflow" /> - } label="Standalone" /> - - - - - - { - innerWorkflow.blogpost = event.target.value - setInnerWorkflow(innerWorkflow) - }} - InputProps={{ - style: { - color: "white", - }, - }} - color="primary" - defaultValue={innerWorkflow.blogpost} - placeholder="A blogpost or other reference for how this work workflow was built, and what it's for." - rows="1" - label="blogpost" - margin="dense" - fullWidth - /> - { - innerWorkflow.video = event.target.value - setInnerWorkflow(innerWorkflow) - }} - InputProps={{ - style: { - color: "white", - }, - }} - color="primary" - defaultValue={innerWorkflow.video} - placeholder="A youtube or loom link to the video" - rows="1" - label="Video" - margin="dense" - fullWidth - /> - - - - + + + + + : null} diff --git a/frontend/src/components/LeftSideBar.jsx b/frontend/src/components/LeftSideBar.jsx index d87fc53c..8ee1f1be 100644 --- a/frontend/src/components/LeftSideBar.jsx +++ b/frontend/src/components/LeftSideBar.jsx @@ -524,7 +524,7 @@ useEffect(() => { - Version: 2.0.0-rc5 + Version: 2.0.0-rc6 @@ -1907,4 +1907,4 @@ useEffect(() => { ); }; -export default LeftSideBar; \ No newline at end of file +export default LeftSideBar; diff --git a/frontend/src/components/ParsedAction.jsx b/frontend/src/components/ParsedAction.jsx index a93583f0..10d506ac 100755 --- a/frontend/src/components/ParsedAction.jsx +++ b/frontend/src/components/ParsedAction.jsx @@ -222,6 +222,10 @@ const ParsedAction = (props) => { return } + if (selectedApp !== undefined && selectedApp !== null && selectedApp.generated !== true) { + return + } + // Fixing required fields with a shitty structure :) if (selectedApp !== undefined && selectedApp !== null && selectedApp.generated === true && selectedAction !== undefined && selectedAction !== null && selectedAction.name !== undefined && selectedAction.name !== null && selectedApp.actions !== undefined && selectedApp.actions !== null && selectedApp.actions.length > 0 && (selectedAction.required_body_fields === undefined || selectedAction.required_body_fields === null || selectedAction.required_body_fields.length === 0)) { // Check for required fields @@ -654,8 +658,8 @@ const ParsedAction = (props) => { const valid = validateJson(execArg); if (valid.valid) { newActionList.push({ - type: "Execution Argument", - name: "Execution Argument", + type: "Runtime Argument", + name: "Runtime Argument", value: "$exec", highlight: "exec", autocomplete: "exec", @@ -668,11 +672,11 @@ const ParsedAction = (props) => { } } - // Add default Execution Argument if none were added + // Add default Runtime Argument if none were added if (newActionList.length === 0) { newActionList.push({ - type: "Execution Argument", - name: "Execution Argument", + type: "Runtime Argument", + name: "Runtime Argument", value: "$exec", highlight: "exec", autocomplete: "exec", @@ -749,7 +753,7 @@ const ParsedAction = (props) => { if (parents.length > 1) { const labels = []; for (let parentNode of parents) { - if (parentNode.label !== "Execution Argument" && !labels.includes(parentNode.label)) { + if (parentNode.label !== "Runtime Argument" && !labels.includes(parentNode.label)) { labels.push(parentNode.label); let exampleData = parentNode.example ?? ""; if (!exampleData && workflowExecutions.length > 0) { @@ -1625,15 +1629,17 @@ const ParsedAction = (props) => { //window.open("/apps/${selectedAction.app_id}", "_blank") }} > - - + + + +

@@ -1754,7 +1760,7 @@ const ParsedAction = (props) => { - {selectedAction?.generated === true && selectedAction?.app_version === "1.0.0" ? + {(selectedAction?.generated === true && selectedAction?.app_version === "1.0.0") || (selectedAction?.app_name === "Shuffle Tools" && selectedAction?.app_version !== "1.2.0") ? + { + if (notificationWorkflow === "parent") { + toast.error("Can't open parent org's notification workflow from here.") + return + } + + window.open(`/workflows/${notificationWorkflow}?view=executions`, "_blank") + }} + > + + + + } + Notifications ({ notifications?.filter((notification) => showRead === true || notification.read === false).length }) diff --git a/frontend/src/components/ShuffleCodeEditor1.jsx b/frontend/src/components/ShuffleCodeEditor1.jsx index 98b9ba80..f355fe60 100644 --- a/frontend/src/components/ShuffleCodeEditor1.jsx +++ b/frontend/src/components/ShuffleCodeEditor1.jsx @@ -44,6 +44,7 @@ import { Close as CloseIcon, DragIndicator as DragIndicatorIcon, RestartAlt as RestartAltIcon, + ArrowForward as ArrowForwardIcon, } from '@mui/icons-material'; @@ -100,6 +101,7 @@ const pythonFilters = [ const extensions = [] const CodeEditor = (props) => { const { + cy, workflow, globalUrl, fieldCount, @@ -116,6 +118,7 @@ const CodeEditor = (props) => { parameterName, // selectedAction, // selectedTrigger, + selectedEdge, workflowExecutions, getParents, activeDialog, @@ -128,6 +131,8 @@ const CodeEditor = (props) => { fullScreenMode, environment, fixExample, + userdata, + handleConditionFieldChange, } = props const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata); @@ -149,6 +154,7 @@ const CodeEditor = (props) => { const [currentLine, setCurrentLine] = React.useState(-1); const [selectedAction, setSelectedAction] = React.useState({}); const [selectedTrigger, setSelectedTrigger] = React.useState({}); + const [selectedCondition, setSelectedCondition] = React.useState({}); const [variableOccurences, setVariableOccurences] = React.useState([]); const [currentLocation, setCurrentLocation] = React.useState([]); const [currentVariable, setCurrentVariable] = React.useState(""); @@ -197,6 +203,8 @@ const CodeEditor = (props) => { const triggerId = searchParams.get('trigger_id'); const triggerField = searchParams.get('trigger_field'); const triggerName = searchParams.get('trigger_name'); + const conditionId = searchParams.get('condition_id'); + const conditionField = searchParams.get('field'); useEffect(() => { if (actionId === undefined || actionId === null) { @@ -206,6 +214,9 @@ const CodeEditor = (props) => { const action = workflow?.actions?.find(action => action.id === actionId); setlocalcodedata(editorData?.value); setSelectedAction(action); + + // Update available variables when action changes + updateAvailableVariables(actionlist); }, [actionId, fieldName]) useEffect(() => { @@ -216,16 +227,33 @@ const CodeEditor = (props) => { const trigger = workflow?.triggers?.find(trigger => trigger.id === triggerId); setlocalcodedata(editorData?.value); setSelectedTrigger(trigger); + + // Update available variables when trigger changes + updateAvailableVariables(actionlist); }, [triggerId]) - useEffect(() => { - var allVariables = [] - var tmpVariables = [] + useEffect(() => { + if (conditionId === undefined || conditionId === null) { + return; + } + + const condition = selectedEdge?.conditions?.find(condition => condition.id === conditionId); + setlocalcodedata(editorData?.value); + setSelectedCondition(condition); + // Update available variables when condition changes + updateAvailableVariables(actionlist); + }, [conditionId, fieldName]) + + // Extract variable updating logic into a separate function + const updateAvailableVariables = (actionlist) => { if (actionlist === undefined || actionlist === null) { return } + var allVariables = [] + var tmpVariables = [] + for (var i = 0; i < actionlist.length; i++) { allVariables.push('$' + actionlist[i].autocomplete.toLowerCase()) tmpVariables.push('$' + actionlist[i].autocomplete.toLowerCase()) @@ -265,7 +293,11 @@ const CodeEditor = (props) => { setAvailableVariables(allVariables) setMainVariables(tmpVariables) - expectedOutput(localcodedata) + } + + // Remove the original useEffect for actionlist since we'll update on action/trigger changes + useEffect(() => { + updateAvailableVariables(actionlist) }, []) useEffect(() => { @@ -1378,6 +1410,18 @@ const CodeEditor = (props) => { ) } + var sourceAction = "" + var targetAction = "" + var sourceImage = "" + var targetImage = "" + + if (cy !== undefined && cy !== null) { + sourceAction = cy.getElementById(selectedEdge?.source) + targetAction = cy.getElementById(selectedEdge?.target) + sourceImage = sourceAction?.data()?.large_image + targetImage = targetAction?.data()?.large_image + } + return ( { {isFileEditor ? null :
- {/* - - */} + {userdata !== undefined && userdata !== null && userdata.support === true ? + + : null}
+ const handleConditionFieldChange = (fieldType, fieldName, value) => { + if (fieldType === "source") { + setSourceValue({ + ...sourceValue, + value: value + }); + } else if (fieldType === "destination") { + setDestinationValue({ + ...destinationValue, + value: value + }); + } + }; + const conditionsModal = ( { tmpdata={sourceValue} setData={setSourceValue} type={"source"} + setExpansionModalOpen={setCodeEditorModalOpen} + setActiveDialog={setActiveDialog} + setEditorData={setEditorData} />
{ tmpdata={destinationValue} setData={setDestinationValue} type={"destination"} + setExpansionModalOpen={setCodeEditorModalOpen} + setActiveDialog={setActiveDialog} + setEditorData={setEditorData} />
@@ -13184,6 +13628,7 @@ const AngularWorkflow = (defaultprops) => { variant="text" onClick={() => { setConditionsModalOpen(false); + setCodeEditorModalOpen(false) setSourceValue({}); setConditionValue({}); setDestinationValue({}); @@ -13205,6 +13650,7 @@ const AngularWorkflow = (defaultprops) => { }; setConditionsModalOpen(false); + setCodeEditorModalOpen(false) if (selectedEdge.conditions === undefined || selectedEdge.conditions === null) { selectedEdge.conditions = [data]; } else { @@ -13318,6 +13764,7 @@ const AngularWorkflow = (defaultprops) => { setConditionValue(condition.condition); setDestinationValue(condition.destination); setConditionsModalOpen(true); + setCodeEditorModalOpen(false) }} >
{ const conditionsDisabled = false const conditionId = uuidv4(); + const sourceAction = cy.getElementById(selectedEdge.source) + const targetAction = cy.getElementById(selectedEdge.target) + const sourceImage = sourceAction?.data()?.large_image + const targetImage = targetAction?.data()?.large_image return (
-

- Conditions -

+
+

+ Conditions +

+
+ {selectedEdge?.source && workflow?.actions ? + Source + : null + } + + {/* Add arrow icon */} + { + selectedEdge && Object.keys(selectedEdge).length > 0 ? + + : null + } + + {/* Destination node image */} + {selectedEdge?.target && workflow?.actions ? + Destination + : null + } +
+
{ placeholder={selectedTrigger.label} defaultValue={selectedTrigger?.label} onChange={selectedTriggerChange} + disabled={selectedTrigger?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0} />
@@ -14485,7 +14984,27 @@ const AngularWorkflow = (defaultprops) => { }} >
- Execution Argument + Runtime Argument + + {/*parentParamValue !== undefined && parentParamValue !== null && parentParamValue !== "" && parentParamValue !== data.value ? + + { + selectedActionParameters[count].value = parentParamValue + selectedAction.parameters[count].value = parentParamValue + setSelectedAction(selectedAction) + setUpdate(Math.random()) + }} + /> + + : null*/} + { @@ -14631,7 +15150,7 @@ const AngularWorkflow = (defaultprops) => { }; const handleMouseover = () => { - if (innerdata.type === "Execution Argument") { + if (innerdata.type === "Runtime Argument") { handleExecArgumentHover(true); } else if (innerdata.type === "action") { handleActionHover(true, innerdata.id); @@ -14639,7 +15158,7 @@ const AngularWorkflow = (defaultprops) => { }; const handleMouseOut = () => { - if (innerdata.type === "Execution Argument") { + if (innerdata.type === "Runtime Argument") { handleExecArgumentHover(false); } else if (innerdata.type === "action") { handleActionHover(false, innerdata.id); @@ -15224,6 +15743,7 @@ const AngularWorkflow = (defaultprops) => { color="primary" placeholder={selectedTrigger.label} onChange={selectedTriggerChange} + disabled={selectedTrigger?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0} /> {apps !== undefined && apps !== null && apps.length > 0 ?
@@ -15987,6 +16507,7 @@ const AngularWorkflow = (defaultprops) => { color="primary" placeholder={selectedTrigger.label} onChange={selectedTriggerChange} + disabled={selectedTrigger?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0} /> {/*
@@ -16683,6 +17204,7 @@ const AngularWorkflow = (defaultprops) => { color="primary" placeholder={selectedTrigger.label} onChange={selectedTriggerChange} + disabled={selectedTrigger?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0} />
Environment @@ -17051,9 +17573,13 @@ const AngularWorkflow = (defaultprops) => { >Change Active Organization to edit this Workflow. : - - Warning: This workflow is controlled by your parent org and may not be editable. - + + suborgWorkflows?.length === 0 ? + + Warning: This workflow is controlled by your parent org and may not be editable. + + : + null } {originalWorkflow.suborg_distribution === undefined || originalWorkflow.suborg_distribution === null || originalWorkflow.suborg_distribution.length === 0 || originalWorkflow.suborg_distribution.includes("none") ? @@ -17127,9 +17653,10 @@ const AngularWorkflow = (defaultprops) => { }} labelId="suborg-changer" value={workflow.org_id} - disabled={savingState !== 0} + disabled={savingState !== 0 || suborgWorkflows?.length === 0} onChange={(e) => { if (lastSaved === false && originalWorkflow.id === workflow.id) { + setSuborgWorkflows([]) saveWorkflow(workflow, undefined, undefined, e.target.value) toast.warn("Saving workflow first due to detected changes. Please try to change workflow again when it is finished.", { autoClose: 2000, @@ -17147,6 +17674,7 @@ const AngularWorkflow = (defaultprops) => { //} } + navigate(`?org_id=${e.target.value}`) // Unselect in cy @@ -17271,7 +17799,6 @@ const AngularWorkflow = (defaultprops) => { } if (data.id === undefined || data.id === null) { - //toast("No org found for id: " + org_id) return null } @@ -17311,8 +17838,9 @@ const AngularWorkflow = (defaultprops) => { var orgDiff = { different: false, } + const foundMatchingWorkflow = suborgWorkflows?.find((workflow) => workflow.org_id === data.id) - if (foundMatchingWorkflow.diff !== undefined && foundMatchingWorkflow.diff !== null) { + if (foundMatchingWorkflow !== undefined && foundMatchingWorkflow !== null && foundMatchingWorkflow.diff !== undefined && foundMatchingWorkflow.diff !== null) { orgDiff = foundMatchingWorkflow.diff } @@ -17327,6 +17855,20 @@ const AngularWorkflow = (defaultprops) => { + {foundMatchingWorkflow !== undefined && foundMatchingWorkflow !== null && foundMatchingWorkflow?.errors !== undefined && foundMatchingWorkflow?.errors !== null && foundMatchingWorkflow?.errors?.length > 0 && + + + {foundMatchingWorkflow.errors.length} Workflow Issue{foundMatchingWorkflow.errors.length > 1 ? "s" : ""} + +
+ } + > + + + } + {orgDiff.different === true ? { title={
- Changes: + Diff (beta):
{orgDiff.environment === true && @@ -17383,7 +17925,7 @@ const AngularWorkflow = (defaultprops) => {
}> - +
: null} @@ -17865,7 +18407,7 @@ const AngularWorkflow = (defaultprops) => { ) } - const shownErrors = !distributedFromParent && !isMobile && workflow.errors !== undefined && workflow.errors !== null && workflow.errors.length > 0 && showErrors && (!workflow.public || userdata.support === true) ? + const shownErrors = !isMobile && workflow.errors !== undefined && workflow.errors !== null && workflow.errors.length > 0 && showErrors && (!workflow.public || userdata.support === true) ?
{ setSelectedResult({ "action": { - "label": "Execution Argument", - "name": "Execution Argument", + "label": "Runtime Argument", + "name": "Runtime Argument", "large_image": theme.palette.defaultImage, "image": theme.palette.defaultImage, }, @@ -19158,7 +19700,7 @@ const AngularWorkflow = (defaultprops) => { return (
-

Execution Argument

+

Runtime Argument

{executionData.execution_argument}
@@ -19370,7 +19912,7 @@ const AngularWorkflow = (defaultprops) => { base = JSON.stringify(base) } - if (base_node_name === "execution_argument" || base_node_name === "Execution Argument") { + if (base_node_name === "execution_argument" || base_node_name === "Runtime Argument") { base_node_name = "exec" } @@ -21562,9 +22104,11 @@ const AngularWorkflow = (defaultprops) => { > {isLoaded && workflowDone ?
+ {/* No workflow to load. Workflow runs may still exist. If you think this is wrong, please contact support@shuffler.io + */}
:
@@ -21857,7 +22401,6 @@ const AngularWorkflow = (defaultprops) => { disabled={newVariableName.length === 0} variant="contained" onClick={() => { - console.log("VARIABLES! ", newVariableName); if ( workflow.execution_variables === undefined || workflow.execution_variables === null @@ -22128,13 +22671,16 @@ const AngularWorkflow = (defaultprops) => { selectedApp.authentication.parameters === undefined || selectedApp.authentication.parameters.length === 0 ) { - return ( + return null + /* + ( {selectedApp.name} does not require authentication ); + */ } authenticationOption.app.actions = []; @@ -22591,7 +23137,11 @@ const AngularWorkflow = (defaultprops) => {
{ {codeEditorModalOpen ? { handleSubflowParamChange={handleSubflowParamChange} codedata={editorData.value} setcodedata={setcodedata} + selectedEdge={selectedEdge} handleActionParamChange={handleActionParamChange} + handleConditionFieldChange={handleConditionFieldChange} // Not working out of the box parameterName={editorData.name} @@ -23664,6 +24217,7 @@ const AngularWorkflow = (defaultprops) => { activeDialog={activeDialog} setActiveDialog={setActiveDialog} environment={selectedActionEnvironment} + userdata={userdata} setAiQueryModalOpen={setAiQueryModalOpen} diff --git a/frontend/src/views/Apps2.jsx b/frontend/src/views/Apps2.jsx index 2c558f37..d56e3469 100644 --- a/frontend/src/views/Apps2.jsx +++ b/frontend/src/views/Apps2.jsx @@ -59,7 +59,6 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl, (userdata?.admin === "true" && userdata?.active_org?.id === data?.reference_org) || data?.contributors?.includes(userdata?.id) - console.log("appdata", data) const paperStyle = { backgroundColor: mouseHoverIndex === index ? "rgba(26, 26, 26, 1)" : "#212121", color: "rgba(241, 241, 241, 1)", diff --git a/frontend/src/views/Docs.jsx b/frontend/src/views/Docs.jsx index 7e148d8d..7d55acaf 100755 --- a/frontend/src/views/Docs.jsx +++ b/frontend/src/views/Docs.jsx @@ -184,15 +184,15 @@ export const CodeHandler = (props) => { if (validate.valid === false) { // Check if https://shuffler.io in the url // if so, then we change it for the current url - if (propvalue.includes("https://shuffler.io")) { - newprop = propvalue.replace("https://shuffler.io", window.location.origin) - } + if (propvalue.includes("https://shuffler.io/api")) { + newprop = propvalue.replace("https://shuffler.io/api", window.location.origin+"/api") - // Check if it contains Bearer APIKEY - // If so, replace apikey - //if (newprop.includes("Bearer APIKEY")) { - // newprop = newprop.replace("Bearer APIKEY", "Bearer API - //} + + const foundurl = localStorage.getItem("globalUrl") + if (foundurl !== undefined && foundurl !== null && foundurl !== "") { + newprop = propvalue.replace("https://shuffler.io/api", foundurl+"/api") + } + } } // Need to check if it's singletick or multi diff --git a/frontend/src/views/Workflows2.jsx b/frontend/src/views/Workflows2.jsx index 0c587f00..40aaf42d 100644 --- a/frontend/src/views/Workflows2.jsx +++ b/frontend/src/views/Workflows2.jsx @@ -1187,32 +1187,32 @@ const Workflows2 = (props) => { "", data.status, ) - .then((response) => { - if (response !== undefined) { - // SET THE FULL THING - data.id = response.id; + .then((response) => { + if (response !== undefined) { + // SET THE FULL THING + data.id = response.id; - // Actually create it - setNewWorkflow( - data.name, - data.description, - data.tags, - data.default_return_value, - data, - false, - [], - "", - data.status - ).then((response) => { - if (response !== undefined) { - toast(`Successfully imported ${data.name}`); - } - }); - } - }) - .catch((error) => { - toast("Import error: " + error.toString()); - }); + // Actually create it + setNewWorkflow( + data.name, + data.description, + data.tags, + data.default_return_value, + data, + false, + [], + "", + data.status + ).then((response) => { + if (response !== undefined) { + toast(`Successfully imported ${data.name}`); + } + }); + } + }) + .catch((error) => { + toast("Import error: " + error.toString()); + }); }); } catch (e) { console.log("Error in dropzone: ", e); @@ -2875,6 +2875,7 @@ const Workflows2 = (props) => { if (editingWorkflow.id !== undefined) { console.log("Building original workflow"); method = "PUT"; + //extraData = "/" + editingWorkflow.id + "?skip_save=true"; extraData = "/" + editingWorkflow.id + "?skip_save=true"; workflowdata = editingWorkflow;