Fixed workflow variable deletion and control without state updates (speed)
This commit is contained in:
@@ -2995,7 +2995,11 @@ class AppBase:
|
||||
self.logger.info(f"Failed to execute: {e}")
|
||||
self.logger.exception(f"Failed to execute {e}-{action['id']}")
|
||||
self.action_result["status"] = "FAILURE"
|
||||
self.action_result["result"] = f"General exception: {e}"
|
||||
#self.action_result["result"] = f"General exception: {e}"
|
||||
self.action_result["result"] = json.dumps({
|
||||
"success": False,
|
||||
"reason": f"General exception: {e}",
|
||||
})
|
||||
|
||||
self.action_result["completed_at"] = int(time.time())
|
||||
|
||||
|
||||
@@ -421,100 +421,102 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
|
||||
// Loops parent nodes' old results to fix autocomplete
|
||||
var parents = getParents(selectedAction);
|
||||
if (parents.length > 1) {
|
||||
for (var key in parents) {
|
||||
const item = parents[key];
|
||||
if (item.label === "Execution Argument") {
|
||||
continue;
|
||||
}
|
||||
if (getParents !== undefined) {
|
||||
var parents = getParents(selectedAction);
|
||||
if (parents.length > 1) {
|
||||
for (var key in parents) {
|
||||
const item = parents[key];
|
||||
if (item.label === "Execution Argument") {
|
||||
continue;
|
||||
}
|
||||
|
||||
var exampledata = item.example === undefined ? "" : item.example;
|
||||
// Find previous execution and their variables
|
||||
//exampledata === "" &&
|
||||
if (workflowExecutions.length > 0) {
|
||||
// Look for the ID
|
||||
const found = false;
|
||||
for (var key in workflowExecutions) {
|
||||
if (
|
||||
workflowExecutions[key].results === undefined ||
|
||||
workflowExecutions[key].results === null
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
var exampledata = item.example === undefined ? "" : item.example;
|
||||
// Find previous execution and their variables
|
||||
//exampledata === "" &&
|
||||
if (workflowExecutions.length > 0) {
|
||||
// Look for the ID
|
||||
const found = false;
|
||||
for (var key in workflowExecutions) {
|
||||
if (
|
||||
workflowExecutions[key].results === undefined ||
|
||||
workflowExecutions[key].results === null
|
||||
) {
|
||||
continue;
|
||||
}
|
||||
|
||||
var foundResult = workflowExecutions[key].results.find(
|
||||
(result) => result.action.id === item.id
|
||||
);
|
||||
if (foundResult === undefined) {
|
||||
continue;
|
||||
}
|
||||
var foundResult = workflowExecutions[key].results.find(
|
||||
(result) => result.action.id === item.id
|
||||
);
|
||||
if (foundResult === undefined) {
|
||||
continue;
|
||||
}
|
||||
|
||||
foundResult.result = foundResult.result.trim();
|
||||
foundResult.result = foundResult.result
|
||||
.split(" None")
|
||||
.join(' "None"');
|
||||
foundResult.result = foundResult.result
|
||||
.split(" False")
|
||||
.join(" false");
|
||||
foundResult.result = foundResult.result
|
||||
.split(" True")
|
||||
.join(" true");
|
||||
foundResult.result = foundResult.result.trim();
|
||||
foundResult.result = foundResult.result
|
||||
.split(" None")
|
||||
.join(' "None"');
|
||||
foundResult.result = foundResult.result
|
||||
.split(" False")
|
||||
.join(" false");
|
||||
foundResult.result = foundResult.result
|
||||
.split(" True")
|
||||
.join(" true");
|
||||
|
||||
var jsonvalid = true;
|
||||
try {
|
||||
const tmp = String(JSON.parse(foundResult.result));
|
||||
if (
|
||||
!foundResult.result.includes("{") &&
|
||||
!foundResult.result.includes("[")
|
||||
) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
} catch (e) {
|
||||
try {
|
||||
foundResult.result = foundResult.result
|
||||
.split("'")
|
||||
.join('"');
|
||||
const tmp = String(JSON.parse(foundResult.result));
|
||||
if (
|
||||
!foundResult.result.includes("{") &&
|
||||
!foundResult.result.includes("[")
|
||||
) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
} catch (e) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
}
|
||||
var jsonvalid = true;
|
||||
try {
|
||||
const tmp = String(JSON.parse(foundResult.result));
|
||||
if (
|
||||
!foundResult.result.includes("{") &&
|
||||
!foundResult.result.includes("[")
|
||||
) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
} catch (e) {
|
||||
try {
|
||||
foundResult.result = foundResult.result
|
||||
.split("'")
|
||||
.join('"');
|
||||
const tmp = String(JSON.parse(foundResult.result));
|
||||
if (
|
||||
!foundResult.result.includes("{") &&
|
||||
!foundResult.result.includes("[")
|
||||
) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
} catch (e) {
|
||||
jsonvalid = false;
|
||||
}
|
||||
}
|
||||
|
||||
// Finds the FIRST json only
|
||||
if (jsonvalid) {
|
||||
exampledata = JSON.parse(foundResult.result);
|
||||
break;
|
||||
}
|
||||
//else {
|
||||
// console.log("Invalid JSON: ", foundResult.result)
|
||||
//}
|
||||
}
|
||||
}
|
||||
// Finds the FIRST json only
|
||||
if (jsonvalid) {
|
||||
exampledata = JSON.parse(foundResult.result);
|
||||
break;
|
||||
}
|
||||
//else {
|
||||
// console.log("Invalid JSON: ", foundResult.result)
|
||||
//}
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Take
|
||||
const itemlabelComplete =
|
||||
item.label === null || item.label === undefined
|
||||
? ""
|
||||
: item.label.split(" ").join("_");
|
||||
const actionvalue = {
|
||||
type: "action",
|
||||
id: item.id,
|
||||
name: item.label,
|
||||
autocomplete: itemlabelComplete,
|
||||
example: exampledata,
|
||||
};
|
||||
actionlist.push(actionvalue);
|
||||
}
|
||||
}
|
||||
// 1. Take
|
||||
const itemlabelComplete =
|
||||
item.label === null || item.label === undefined
|
||||
? ""
|
||||
: item.label.split(" ").join("_");
|
||||
const actionvalue = {
|
||||
type: "action",
|
||||
id: item.id,
|
||||
name: item.label,
|
||||
autocomplete: itemlabelComplete,
|
||||
example: exampledata,
|
||||
};
|
||||
actionlist.push(actionvalue);
|
||||
}
|
||||
}
|
||||
|
||||
setActionlist(actionlist);
|
||||
setActionlist(actionlist);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -897,7 +899,7 @@ const ParsedAction = (props) => {
|
||||
selectedActionParameters[count].variant = data;
|
||||
selectedActionParameters[count].value = "";
|
||||
|
||||
if (data === "ACTION_RESULT") {
|
||||
if (data === "ACTION_RESULT" && getParents !== undefined) {
|
||||
var parents = getParents(selectedAction);
|
||||
if (parents.length > 0) {
|
||||
selectedActionParameters[count].action_field = parents[0].label;
|
||||
|
||||
@@ -259,6 +259,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
|
||||
const [history, setHistory] = React.useState([]);
|
||||
const [historyIndex, setHistoryIndex] = React.useState(history.length);
|
||||
const [variableInfo, setVariableInfo] = React.useState({})
|
||||
|
||||
const [appAuthentication, setAppAuthentication] = React.useState([]);
|
||||
const [variablesModalOpen, setVariablesModalOpen] = React.useState(false);
|
||||
@@ -267,11 +268,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
const [authenticationModalOpen, setAuthenticationModalOpen] =
|
||||
React.useState(false);
|
||||
const [conditionsModalOpen, setConditionsModalOpen] = React.useState(false);
|
||||
const [newVariableName, setNewVariableName] = React.useState("");
|
||||
const [authenticationType, setAuthenticationType] = React.useState("");
|
||||
const [newVariableDescription, setNewVariableDescription] =
|
||||
React.useState("");
|
||||
const [newVariableValue, setNewVariableValue] = React.useState("");
|
||||
|
||||
|
||||
const [workflowDone, setWorkflowDone] = React.useState(false);
|
||||
const [authLoaded, setAuthLoaded] = React.useState(false);
|
||||
const [localFirstrequest, setLocalFirstrequest] = React.useState(true);
|
||||
@@ -674,6 +673,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return response.json();
|
||||
})
|
||||
.then((responseJson) => {
|
||||
console.log("RESPONSE: ", responseJson)
|
||||
handleUpdateResults(responseJson, executionRequest);
|
||||
})
|
||||
.catch((error) => {
|
||||
@@ -4200,18 +4200,26 @@ const AngularWorkflow = (defaultprops) => {
|
||||
setAnchorEl(event.currentTarget);
|
||||
};
|
||||
|
||||
const deleteVariable = (variableName) => {
|
||||
console.log("Delete:", variableName);
|
||||
workflow.workflow_variables = workflow.workflow_variables.filter(
|
||||
(data) => data.name !== variableName
|
||||
);
|
||||
const deleteVariable = (variableIndex) => {
|
||||
//console.log("Delete:", variableName);
|
||||
if (workflow.workflow_variables !== undefined && workflow.workflow_variables !== null && workflow.workflow_variables.length > variableIndex) {
|
||||
workflow.workflow_variables.splice(variableIndex, 1)
|
||||
}
|
||||
|
||||
//workflow.workflow_variables = workflow.workflow_variables.filter(
|
||||
// (data) => data.name !== variableName
|
||||
//);
|
||||
setWorkflow(workflow);
|
||||
};
|
||||
|
||||
const deleteExecutionVariable = (variableName) => {
|
||||
workflow.execution_variables = workflow.execution_variables.filter(
|
||||
(data) => data.name !== variableName
|
||||
);
|
||||
const deleteExecutionVariable = (variableIndex) => {
|
||||
if (workflow.execution_variables !== undefined && workflow.execution_variables !== null && workflow.execution_variables.length > variableIndex) {
|
||||
workflow.execution_variables.splice(variableIndex, 1)
|
||||
}
|
||||
|
||||
//workflow.execution_variables = workflow.execution_variables.filter(
|
||||
// (data) => data.name !== variableName
|
||||
//);
|
||||
setWorkflow(workflow);
|
||||
};
|
||||
|
||||
@@ -4261,9 +4269,12 @@ const AngularWorkflow = (defaultprops) => {
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onClick={() => {
|
||||
setNewVariableName(variable.name);
|
||||
setNewVariableDescription(variable.description);
|
||||
setNewVariableValue(variable.value);
|
||||
setVariableInfo({
|
||||
"name": variable.name,
|
||||
"description": variable.description,
|
||||
"value": variable.value,
|
||||
"index": index,
|
||||
})
|
||||
setVariablesModalOpen(true);
|
||||
}}
|
||||
>
|
||||
@@ -4301,9 +4312,12 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
setNewVariableName(variable.name);
|
||||
setNewVariableDescription(variable.description);
|
||||
setNewVariableValue(variable.value);
|
||||
setVariableInfo({
|
||||
"name": variable.name,
|
||||
"description": variable.description,
|
||||
"value": variable.value,
|
||||
"index": index,
|
||||
})
|
||||
setVariablesModalOpen(true);
|
||||
}}
|
||||
key={"Edit"}
|
||||
@@ -4316,7 +4330,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
color: "white",
|
||||
}}
|
||||
onClick={() => {
|
||||
deleteVariable(variable.name);
|
||||
deleteVariable(index);
|
||||
setOpen(false);
|
||||
}}
|
||||
key={"Delete"}
|
||||
@@ -4365,7 +4379,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
{workflow.execution_variables === null ||
|
||||
workflow.execution_variables === undefined
|
||||
? null
|
||||
: workflow.execution_variables.map((variable) => {
|
||||
: workflow.execution_variables.map((variable, index) => {
|
||||
return (
|
||||
<div>
|
||||
<Paper square style={paperVariableStyle} onClick={() => {}}>
|
||||
@@ -4388,7 +4402,13 @@ const AngularWorkflow = (defaultprops) => {
|
||||
overflow: "hidden",
|
||||
}}
|
||||
onClick={() => {
|
||||
setNewVariableName(variable.name);
|
||||
//setNewVariableName(variable.name);
|
||||
setVariableInfo({
|
||||
"name": variable.name,
|
||||
"description": variable.description,
|
||||
"value": variable.value,
|
||||
"index": index,
|
||||
})
|
||||
setExecutionVariablesModalOpen(true);
|
||||
}}
|
||||
>
|
||||
@@ -4426,7 +4446,13 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}}
|
||||
onClick={() => {
|
||||
setOpen(false);
|
||||
setNewVariableName(variable.name);
|
||||
//setNewVariableName(variable.name);
|
||||
setVariableInfo({
|
||||
"name": variable.name,
|
||||
"description": variable.description,
|
||||
"value": variable.value,
|
||||
"index": index,
|
||||
})
|
||||
setExecutionVariablesModalOpen(true);
|
||||
}}
|
||||
key={"Edit"}
|
||||
@@ -4439,7 +4465,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
color: "white",
|
||||
}}
|
||||
onClick={() => {
|
||||
deleteExecutionVariable(variable.name);
|
||||
deleteExecutionVariable(index);
|
||||
setOpen(false);
|
||||
}}
|
||||
key={"Delete"}
|
||||
@@ -5548,7 +5574,6 @@ const AngularWorkflow = (defaultprops) => {
|
||||
// Remove on the end as we don't want to remove everything
|
||||
results = results.filter((data) => data.id !== action.id);
|
||||
results = results.filter((data) => data.type === "ACTION" || data.app_name === "Shuffle Workflow" || data.app_name === "User Input");
|
||||
console.log("RESULTS:", results)
|
||||
results.push({ label: "Execution Argument", type: "INTERNAL" });
|
||||
return results;
|
||||
};
|
||||
@@ -11904,266 +11929,309 @@ const AngularWorkflow = (defaultprops) => {
|
||||
</div>
|
||||
);
|
||||
|
||||
const executionVariableModal = executionVariablesModalOpen ? (
|
||||
<Dialog
|
||||
open={executionVariablesModalOpen}
|
||||
onClose={() => {
|
||||
setNewVariableName("");
|
||||
setExecutionVariablesModalOpen(false);
|
||||
}}
|
||||
PaperProps={{
|
||||
style: {
|
||||
backgroundColor: surfaceColor,
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
<DialogTitle>
|
||||
<span style={{ color: "white" }}>Execution Variable</span>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
Execution Variables are TEMPORARY variables that you can ony be set
|
||||
and used during execution. Learn more{" "}
|
||||
<a
|
||||
rel="noopener noreferrer"
|
||||
href="https://shuffler.io/docs/workflows#execution_variables"
|
||||
target="_blank"
|
||||
style={{ textDecoration: "none", color: "#f85a3e" }}
|
||||
>
|
||||
here
|
||||
</a>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableName(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Name"
|
||||
style={{ marginTop: 25 }}
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
margin="dense"
|
||||
fullWidth
|
||||
defaultValue={newVariableName}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
onClick={() => {
|
||||
setNewVariableName("");
|
||||
setExecutionVariablesModalOpen(false);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
disabled={newVariableName.length === 0}
|
||||
onClick={() => {
|
||||
console.log("VARIABLES! ", newVariableName);
|
||||
if (
|
||||
workflow.execution_variables === undefined ||
|
||||
workflow.execution_variables === null
|
||||
) {
|
||||
workflow.execution_variables = [];
|
||||
}
|
||||
const ExecutionVariableModal = (props) => {
|
||||
const { variableInfo } = props
|
||||
|
||||
// try to find one with the same name
|
||||
const found = workflow.execution_variables.findIndex(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
//console.log(found)
|
||||
if (found !== -1) {
|
||||
if (newVariableName.length > 0) {
|
||||
workflow.execution_variables[found].name = newVariableName;
|
||||
}
|
||||
} else {
|
||||
workflow.execution_variables.push({
|
||||
name: newVariableName,
|
||||
description: "An execution variable",
|
||||
value: "",
|
||||
id: uuidv4(),
|
||||
});
|
||||
}
|
||||
const [newVariableName, setNewVariableName] = React.useState(variableInfo.name !== undefined ? variableInfo.name : "");
|
||||
const [newVariableDescription, setNewVariableDescription] = React.useState(variableInfo.description !== undefined ? variableInfo.description : "");
|
||||
const [newVariableValue, setNewVariableValue] = React.useState(variableInfo.value !== undefined ? variableInfo.value : "");
|
||||
|
||||
setExecutionVariablesModalOpen(false);
|
||||
setNewVariableName("");
|
||||
setWorkflow(workflow);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</DialogActions>
|
||||
{workflowExecutions.length > 0 ? (
|
||||
<DialogContent>
|
||||
<Divider
|
||||
style={{
|
||||
backgroundColor: "white",
|
||||
marginTop: 15,
|
||||
marginBottom: 15,
|
||||
}}
|
||||
/>
|
||||
<b style={{ marginBottom: 10 }}>Values from last 3 executions</b>
|
||||
{workflowExecutions.slice(0, 3).map((execution, index) => {
|
||||
if (
|
||||
execution.execution_variables === undefined ||
|
||||
execution.execution_variables === null ||
|
||||
execution.execution_variables === 0
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (!executionVariablesModalOpen) {
|
||||
return null
|
||||
}
|
||||
|
||||
const variable = execution.execution_variables.find(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
if (variable === undefined || variable.value === undefined) {
|
||||
return null;
|
||||
}
|
||||
return (
|
||||
<Dialog
|
||||
open={executionVariablesModalOpen}
|
||||
onClose={() => {
|
||||
setNewVariableName("");
|
||||
setExecutionVariablesModalOpen(false);
|
||||
}}
|
||||
PaperProps={{
|
||||
style: {
|
||||
backgroundColor: surfaceColor,
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
<DialogTitle>
|
||||
<span style={{ color: "white" }}>Execution Variable</span>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
Execution Variables are TEMPORARY variables that you can ony be set
|
||||
and used during execution. Learn more{" "}
|
||||
<a
|
||||
rel="noopener noreferrer"
|
||||
href="https://shuffler.io/docs/workflows#execution_variables"
|
||||
target="_blank"
|
||||
style={{ textDecoration: "none", color: "#f85a3e" }}
|
||||
>
|
||||
here
|
||||
</a>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableName(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Name"
|
||||
style={{ marginTop: 25 }}
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
margin="dense"
|
||||
fullWidth
|
||||
defaultValue={newVariableName}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
onClick={() => {
|
||||
setNewVariableName("");
|
||||
setExecutionVariablesModalOpen(false);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
disabled={newVariableName.length === 0}
|
||||
onClick={() => {
|
||||
console.log("VARIABLES! ", newVariableName);
|
||||
if (
|
||||
workflow.execution_variables === undefined ||
|
||||
workflow.execution_variables === null
|
||||
) {
|
||||
workflow.execution_variables = [];
|
||||
}
|
||||
|
||||
return (
|
||||
<div>
|
||||
{index + 1}: {variable.value}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</DialogContent>
|
||||
) : null}
|
||||
</FormControl>
|
||||
</Dialog>
|
||||
) : null;
|
||||
// try to find one with the same name
|
||||
const found = workflow.execution_variables.findIndex(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
//console.log(found)
|
||||
if (found !== -1) {
|
||||
if (newVariableName.length > 0) {
|
||||
workflow.execution_variables[found].name = newVariableName;
|
||||
}
|
||||
} else {
|
||||
workflow.execution_variables.push({
|
||||
name: newVariableName,
|
||||
description: "An execution variable",
|
||||
value: "",
|
||||
id: uuidv4(),
|
||||
});
|
||||
}
|
||||
|
||||
const variablesModal = variablesModalOpen ? (
|
||||
<Dialog
|
||||
open={variablesModalOpen}
|
||||
onClose={() => {
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
setVariablesModalOpen(false);
|
||||
}}
|
||||
PaperProps={{
|
||||
style: {
|
||||
backgroundColor: surfaceColor,
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
<DialogTitle>
|
||||
<span style={{ color: "white" }}>Workflow Variable</span>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableName(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Name"
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
margin="dense"
|
||||
fullWidth
|
||||
defaultValue={newVariableName}
|
||||
/>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableDescription(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Description"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
defaultValue={newVariableDescription}
|
||||
/>
|
||||
<TextField
|
||||
onChange={(event) => setNewVariableValue(event.target.value)}
|
||||
rows="6"
|
||||
multiline
|
||||
color="primary"
|
||||
placeholder="Value"
|
||||
margin="dense"
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
fullWidth
|
||||
defaultValue={newVariableValue}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
onClick={() => {
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
setVariablesModalOpen(false);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
disabled={
|
||||
newVariableName.length === 0 || newVariableValue.length === 0
|
||||
}
|
||||
variant={"contained"}
|
||||
onClick={() => {
|
||||
if (
|
||||
workflow.workflow_variables === undefined ||
|
||||
workflow.workflow_variables === null
|
||||
) {
|
||||
workflow.workflow_variables = [];
|
||||
}
|
||||
setExecutionVariablesModalOpen(false);
|
||||
setNewVariableName("");
|
||||
setWorkflow(workflow);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</DialogActions>
|
||||
{workflowExecutions.length > 0 ? (
|
||||
<DialogContent>
|
||||
<Divider
|
||||
style={{
|
||||
backgroundColor: "white",
|
||||
marginTop: 15,
|
||||
marginBottom: 15,
|
||||
}}
|
||||
/>
|
||||
<b style={{ marginBottom: 10 }}>Values from last 3 executions</b>
|
||||
{workflowExecutions.slice(0, 3).map((execution, index) => {
|
||||
if (
|
||||
execution.execution_variables === undefined ||
|
||||
execution.execution_variables === null ||
|
||||
execution.execution_variables === 0
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// try to find one with the same name
|
||||
const found = workflow.workflow_variables.findIndex(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
if (found !== -1) {
|
||||
if (newVariableName.length > 0) {
|
||||
workflow.workflow_variables[found].name = newVariableName;
|
||||
}
|
||||
if (newVariableDescription.length > 0) {
|
||||
workflow.workflow_variables[found].description =
|
||||
newVariableDescription;
|
||||
}
|
||||
if (newVariableValue.length > 0) {
|
||||
workflow.workflow_variables[found].value = newVariableValue;
|
||||
}
|
||||
} else {
|
||||
workflow.workflow_variables.push({
|
||||
name: newVariableName,
|
||||
description: newVariableDescription,
|
||||
value: newVariableValue,
|
||||
id: uuidv4(),
|
||||
});
|
||||
}
|
||||
const variable = execution.execution_variables.find(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
if (variable === undefined || variable.value === undefined) {
|
||||
return null;
|
||||
}
|
||||
|
||||
setWorkflow(workflow);
|
||||
setVariablesModalOpen(false);
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</FormControl>
|
||||
</Dialog>
|
||||
) : null;
|
||||
return (
|
||||
<div>
|
||||
{index + 1}: {variable.value}
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</DialogContent>
|
||||
) : null}
|
||||
</FormControl>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
const VariablesModal = (props) => {
|
||||
const { setVariableInfo, variableInfo } = props
|
||||
|
||||
const [newVariableName, setNewVariableName] = React.useState(variableInfo.name !== undefined ? variableInfo.name : "");
|
||||
const [newVariableDescription, setNewVariableDescription] = React.useState(variableInfo.description !== undefined ? variableInfo.description : "");
|
||||
const [newVariableValue, setNewVariableValue] = React.useState(variableInfo.value !== undefined ? variableInfo.value : "");
|
||||
|
||||
if (!variablesModalOpen) {
|
||||
return null
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
open={variablesModalOpen}
|
||||
onClose={() => {
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
setVariablesModalOpen(false);
|
||||
}}
|
||||
PaperProps={{
|
||||
style: {
|
||||
backgroundColor: surfaceColor,
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
>
|
||||
<FormControl>
|
||||
<DialogTitle>
|
||||
<span style={{ color: "white" }}>Workflow Variable</span>
|
||||
</DialogTitle>
|
||||
<DialogContent>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableName(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Name"
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
margin="dense"
|
||||
fullWidth
|
||||
defaultValue={newVariableName}
|
||||
/>
|
||||
<TextField
|
||||
onBlur={(event) => setNewVariableDescription(event.target.value)}
|
||||
color="primary"
|
||||
placeholder="Description"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
defaultValue={newVariableDescription}
|
||||
/>
|
||||
<TextField
|
||||
onChange={(event) => setNewVariableValue(event.target.value)}
|
||||
rows="6"
|
||||
multiline
|
||||
color="primary"
|
||||
placeholder="Value"
|
||||
margin="dense"
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
fullWidth
|
||||
defaultValue={newVariableValue}
|
||||
/>
|
||||
</DialogContent>
|
||||
<DialogActions>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
onClick={() => {
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
setVariablesModalOpen(false);
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Cancel
|
||||
</Button>
|
||||
<Button
|
||||
style={{ borderRadius: "0px" }}
|
||||
disabled={
|
||||
newVariableName.length === 0 || newVariableValue.length === 0
|
||||
}
|
||||
variant={"contained"}
|
||||
onClick={() => {
|
||||
var handled = false
|
||||
if (
|
||||
workflow.workflow_variables === undefined ||
|
||||
workflow.workflow_variables === null
|
||||
) {
|
||||
workflow.workflow_variables = [];
|
||||
} else {
|
||||
if (variableInfo.index !== undefined && variableInfo.index !== null && variableInfo.index >= 0) {
|
||||
if (newVariableName.length > 0) {
|
||||
workflow.workflow_variables[variableInfo.index].name = newVariableName;
|
||||
}
|
||||
if (newVariableDescription.length > 0) {
|
||||
workflow.workflow_variables[variableInfo.index].description =
|
||||
newVariableDescription;
|
||||
}
|
||||
if (newVariableValue.length > 0) {
|
||||
workflow.workflow_variables[variableInfo.index].value = newVariableValue;
|
||||
}
|
||||
|
||||
handled = true
|
||||
}
|
||||
}
|
||||
|
||||
if (!handled) {
|
||||
// try to find one with the same name
|
||||
const found = workflow.workflow_variables.findIndex(
|
||||
(data) => data.name === newVariableName
|
||||
);
|
||||
if (found !== -1) {
|
||||
if (newVariableName.length > 0) {
|
||||
workflow.workflow_variables[found].name = newVariableName;
|
||||
}
|
||||
if (newVariableDescription.length > 0) {
|
||||
workflow.workflow_variables[found].description =
|
||||
newVariableDescription;
|
||||
}
|
||||
if (newVariableValue.length > 0) {
|
||||
workflow.workflow_variables[found].value = newVariableValue;
|
||||
}
|
||||
} else {
|
||||
workflow.workflow_variables.push({
|
||||
name: newVariableName,
|
||||
description: newVariableDescription,
|
||||
value: newVariableValue,
|
||||
id: uuidv4(),
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
setVariableInfo({})
|
||||
setWorkflow(workflow);
|
||||
setVariablesModalOpen(false);
|
||||
setNewVariableName("");
|
||||
setNewVariableDescription("");
|
||||
setNewVariableValue("");
|
||||
}}
|
||||
color="primary"
|
||||
>
|
||||
Submit
|
||||
</Button>
|
||||
</DialogActions>
|
||||
</FormControl>
|
||||
</Dialog>
|
||||
)
|
||||
}
|
||||
|
||||
const AuthenticationData = (props) => {
|
||||
const selectedApp = props.app;
|
||||
@@ -12736,8 +12804,8 @@ const AngularWorkflow = (defaultprops) => {
|
||||
isLoaded && workflowDone ? (
|
||||
<div>
|
||||
{newView}
|
||||
{variablesModal}
|
||||
{executionVariableModal}
|
||||
<VariablesModal variableInfo={variableInfo} setVariableInfo={setVariableInfo} />
|
||||
<ExecutionVariableModal variableInfo={variableInfo} setVariableInfo={setVariableInfo} />
|
||||
{conditionsModal}
|
||||
{authenticationModal}
|
||||
{codePopoutModal}
|
||||
|
||||
@@ -513,6 +513,7 @@ const AppCreator = (defaultprops) => {
|
||||
}
|
||||
|
||||
setBasedata(data);
|
||||
console.log("DATA: ", data)
|
||||
if (data.info !== null && data.info !== undefined) {
|
||||
if (data.info.title !== undefined && data.info.title !== null) {
|
||||
if (data.info.title.length > 29) {
|
||||
@@ -547,7 +548,7 @@ const AppCreator = (defaultprops) => {
|
||||
data.info["x-categories"] !== undefined &&
|
||||
data.info["x-categories"].length > 0
|
||||
) {
|
||||
if (typeof data.info["x-categories"] == "array") {
|
||||
if (typeof data.info["x-categories"] === "array") {
|
||||
} else {
|
||||
}
|
||||
setNewWorkflowCategories(data.info["x-categories"]);
|
||||
@@ -559,7 +560,7 @@ const AppCreator = (defaultprops) => {
|
||||
for (var key in data.tags) {
|
||||
if (data.tags[key].name.length > 50) {
|
||||
console.log(
|
||||
"Skipping tag cus it's too long: ",
|
||||
"Skipping tag because it's too long: ",
|
||||
data.tags[key].name.length
|
||||
);
|
||||
continue;
|
||||
@@ -595,6 +596,7 @@ const AppCreator = (defaultprops) => {
|
||||
"PUT",
|
||||
];
|
||||
|
||||
|
||||
var newActions = [];
|
||||
var wordlist = {};
|
||||
var all_categories = [];
|
||||
@@ -920,7 +922,8 @@ const AppCreator = (defaultprops) => {
|
||||
console.log(
|
||||
"CANT HANDLE JSON TYPE (4)",
|
||||
parameter.properties[propkey].type,
|
||||
parameter.properties[propkey]
|
||||
parameter.properties[propkey],
|
||||
path
|
||||
);
|
||||
newbody[parsedkey] = [];
|
||||
}
|
||||
@@ -930,7 +933,8 @@ const AppCreator = (defaultprops) => {
|
||||
} else {
|
||||
console.log(
|
||||
"CANT HANDLE PARAM: (4) ",
|
||||
parameter.properties
|
||||
parameter.properties,
|
||||
path
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1421,7 +1425,7 @@ const AppCreator = (defaultprops) => {
|
||||
setAuthenticationOption("Bearer auth");
|
||||
setAuthenticationRequired(true);
|
||||
|
||||
} else if (key === "ApiKeyAuth" || key === "Token") {
|
||||
} else if (key === "ApiKeyAuth" || key === "Token" || ((value.in === "header" || value.in === "query") && value.name !== undefined)) {
|
||||
setAuthenticationOption("API key");
|
||||
|
||||
value.in = value.in.charAt(0).toUpperCase() + value.in.slice(1);
|
||||
@@ -1436,7 +1440,10 @@ const AppCreator = (defaultprops) => {
|
||||
setAuthenticationRequired(true);
|
||||
|
||||
if (value.description !== undefined && value.description !== null && value.description.length > 0) {
|
||||
setRefreshUrl(value.description)
|
||||
// Don't want a real description - just the ones we're replacing with
|
||||
if ((value.description.split(" ").length - 1) <= 2) {
|
||||
setRefreshUrl(value.description)
|
||||
}
|
||||
}
|
||||
|
||||
} else if (value.scheme === "basic") {
|
||||
@@ -1447,7 +1454,7 @@ const AppCreator = (defaultprops) => {
|
||||
setAuthenticationOption("Oauth2");
|
||||
setAuthenticationRequired(true);
|
||||
|
||||
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key!== null && key.toLowerCase().includes("oauth2"))) {
|
||||
} else if (value.type === "oauth2" || key === "Oauth2" || key === "Oauth2c" || (key !== undefined && key !== null && key.toLowerCase().includes("oauth2"))) {
|
||||
//alert.info("Can't handle Oauth2 auth yet.")
|
||||
setAuthenticationOption("Oauth2");
|
||||
setAuthenticationRequired(true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
NAME=shuffle-orborus
|
||||
VERSION=0.9.48
|
||||
VERSION=0.9.49
|
||||
|
||||
echo "Running docker build with $NAME:$VERSION"
|
||||
#docker rmi frikky/shuffle:$NAME --force
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
NAME=shuffle-worker
|
||||
VERSION=0.9.48
|
||||
VERSION=0.9.49
|
||||
|
||||
echo "Running docker build with $NAME:$VERSION"
|
||||
#CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o worker.bin .
|
||||
|
||||
@@ -10,6 +10,6 @@ require (
|
||||
github.com/docker/go-connections v0.4.0 // indirect
|
||||
github.com/gorilla/mux v1.8.0
|
||||
github.com/patrickmn/go-cache v2.1.0+incompatible
|
||||
github.com/shuffle/shuffle-shared v0.1.73
|
||||
github.com/shuffle/shuffle-shared v0.1.78
|
||||
go4.org v0.0.0-20201209231011-d4a079459e60 // indirect
|
||||
)
|
||||
|
||||
@@ -79,6 +79,8 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE
|
||||
github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0=
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/Shopify/logrus-bugsnag v0.0.0-20171204204709-577dee27f20d/go.mod h1:HI8ITrYtUY+O+ZhtlqUnD8+KwNPOyugEhfP9fdUIaEQ=
|
||||
github.com/adrg/strutil v0.2.3 h1:WZVn3ItPBovFmP4wMHHVXUr8luRaHrbyIuLlHt32GZQ=
|
||||
github.com/adrg/strutil v0.2.3/go.mod h1:+SNxbiH6t+O+5SZqIj5n/9i5yUjR+S3XXVrjEcN2mxg=
|
||||
github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=
|
||||
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
|
||||
@@ -271,6 +273,8 @@ github.com/frikky/go-elasticsearch/v8 v8.13.1 h1:GB+Wr0Yx8efG7D1jc9fGGiqjjRRngWJ
|
||||
github.com/frikky/go-elasticsearch/v8 v8.13.1/go.mod h1:RPq0JXPQVVSFHTlPwj/go8BZ1hegRf+StaSpT2iGIoQ=
|
||||
github.com/frikky/kin-openapi v0.38.0 h1:V7ttwIJS8Vks4KL+mZVj1ZSqhIcQtgaG8akeqXEQgsE=
|
||||
github.com/frikky/kin-openapi v0.38.0/go.mod h1:Fr28TtCHL4K0kIqtqui8HWxN1LG5uAh3z/tDfFyiA1s=
|
||||
github.com/frikky/kin-openapi v0.41.0 h1:oMmjo+ekGS971lb3KLeZZOqRDZOwWi3+g/OiSWP08+s=
|
||||
github.com/frikky/kin-openapi v0.41.0/go.mod h1:ev9OZAw7Bv5p0w93j91++6a1ElPzGcCofst+kmrWsj4=
|
||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
||||
github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ=
|
||||
github.com/fullsailor/pkcs7 v0.0.0-20190404230743-d7302db945fa/go.mod h1:KnogPXtdwXqoenmZCw6S+25EAm2MkxbG0deNDu4cbSA=
|
||||
@@ -554,6 +558,7 @@ github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4O
|
||||
github.com/prometheus/procfs v0.2.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU=
|
||||
github.com/prometheus/procfs v0.6.0/go.mod h1:cz+aTbrPOrUb4q7XlbU9ygM+/jj0fzG6c1xBZuNvfVA=
|
||||
github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU=
|
||||
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4=
|
||||
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
|
||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
||||
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
|
||||
@@ -586,6 +591,8 @@ github.com/shuffle/shuffle-shared v0.1.72 h1:7KHpvml+96sMOINEw3PmSAN6WS22ovXGj6W
|
||||
github.com/shuffle/shuffle-shared v0.1.72/go.mod h1:2ndjLm4ZOvY6arGFwOgGnkQ457Ke7gka9HDF/EkdIxQ=
|
||||
github.com/shuffle/shuffle-shared v0.1.73 h1:1rMOXAvxm/nDemwN/L8qWacswVMvdi6NjLfTTmptP4I=
|
||||
github.com/shuffle/shuffle-shared v0.1.73/go.mod h1:2ndjLm4ZOvY6arGFwOgGnkQ457Ke7gka9HDF/EkdIxQ=
|
||||
github.com/shuffle/shuffle-shared v0.1.78 h1://YsgQ85Ep40AA3pLUXb+85BUrNz5sqGqh0e3twKRy4=
|
||||
github.com/shuffle/shuffle-shared v0.1.78/go.mod h1:cW8LBv8P24rCPyJqGV6czxqrpnrv/R1d97EOqNgIvSk=
|
||||
github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc=
|
||||
github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc=
|
||||
|
||||
Reference in New Issue
Block a user