Syncing usecases2
This commit is contained in:
@@ -210,6 +210,7 @@ const ParsedAction = (props) => {
|
|||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Changes the order of params to show in order:
|
// Changes the order of params to show in order:
|
||||||
// auth, required, optional
|
// auth, required, optional
|
||||||
|
/*
|
||||||
var changed = false
|
var changed = false
|
||||||
if (selectedActionParameters === undefined || selectedActionParameters === null || selectedActionParameters.length === 0) {
|
if (selectedActionParameters === undefined || selectedActionParameters === null || selectedActionParameters.length === 0) {
|
||||||
return
|
return
|
||||||
@@ -221,7 +222,7 @@ const ParsedAction = (props) => {
|
|||||||
|
|
||||||
var keyorder = []
|
var keyorder = []
|
||||||
for (let paramkey in selectedActionParameters) {
|
for (let paramkey in selectedActionParameters) {
|
||||||
const param = selectedActionParameters[paramkey]
|
var param = selectedActionParameters[paramkey]
|
||||||
keyorder.push(param.name)
|
keyorder.push(param.name)
|
||||||
|
|
||||||
if (param.configuration) {
|
if (param.configuration) {
|
||||||
@@ -229,6 +230,10 @@ const ParsedAction = (props) => {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (param?.value?.toLowerCase().includes("secret. replace")) {
|
||||||
|
param.value = ""
|
||||||
|
}
|
||||||
|
|
||||||
if (param.required) {
|
if (param.required) {
|
||||||
required.push(param)
|
required.push(param)
|
||||||
continue
|
continue
|
||||||
@@ -250,6 +255,7 @@ const ParsedAction = (props) => {
|
|||||||
selectedAction.parameters = newparams
|
selectedAction.parameters = newparams
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
}, [selectedActionParameters])
|
}, [selectedActionParameters])
|
||||||
@@ -803,22 +809,21 @@ const ParsedAction = (props) => {
|
|||||||
|
|
||||||
console.log("IN ELSE: ", paramcheck);
|
console.log("IN ELSE: ", paramcheck);
|
||||||
}
|
}
|
||||||
//console.log("PARAM: ", paramcheck)
|
|
||||||
//if (paramcheck.id === undefined) {
|
if (selectedActionParameters[count].value_replace === undefined) {
|
||||||
// console.log("Normal paramcheck")
|
selectedActionParameters[count].value_replace = paramcheck
|
||||||
//} else {
|
}
|
||||||
// selectedActionParameters[count]["value_replace"] = paramcheck
|
|
||||||
// selectedAction.parameters[count]["value_replace"] = paramcheck
|
if (selectedAction.parameters[count].value_replace === undefined) {
|
||||||
//}
|
selectedAction.parameters[count].value_replace = paramcheck
|
||||||
|
}
|
||||||
|
|
||||||
if (paramcheck["value_replace"] === undefined) {
|
if (paramcheck["value_replace"] === undefined) {
|
||||||
selectedActionParameters[count]["value_replace"] = paramcheck;
|
selectedActionParameters[count]["value_replace"] = paramcheck
|
||||||
selectedAction.parameters[count]["value_replace"] = paramcheck;
|
selectedAction.parameters[count]["value_replace"] = paramcheck
|
||||||
} else {
|
} else {
|
||||||
selectedActionParameters[count]["value_replace"] =
|
selectedActionParameters[count]["value_replace"] = paramcheck["value_replace"];
|
||||||
paramcheck["value_replace"];
|
selectedAction.parameters[count]["value_replace"] = paramcheck["value_replace"];
|
||||||
selectedAction.parameters[count]["value_replace"] =
|
|
||||||
paramcheck["value_replace"];
|
|
||||||
}
|
}
|
||||||
setSelectedAction(selectedAction);
|
setSelectedAction(selectedAction);
|
||||||
//setUpdate(Math.random())
|
//setUpdate(Math.random())
|
||||||
@@ -999,8 +1004,6 @@ const ParsedAction = (props) => {
|
|||||||
} else {
|
} else {
|
||||||
paramcheck["value_replace"][subparamindex]["value"] = toReplace
|
paramcheck["value_replace"][subparamindex]["value"] = toReplace
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log("IN ELSE: ", paramcheck)
|
|
||||||
}
|
}
|
||||||
//console.log("PARAM: ", paramcheck)
|
//console.log("PARAM: ", paramcheck)
|
||||||
//if (paramcheck.id === undefined) {
|
//if (paramcheck.id === undefined) {
|
||||||
@@ -1451,9 +1454,9 @@ const ParsedAction = (props) => {
|
|||||||
</Tooltip>
|
</Tooltip>
|
||||||
<h3 style={{ }}>
|
<h3 style={{ }}>
|
||||||
{(
|
{(
|
||||||
selectedAction.app_name.charAt(0).toUpperCase() +
|
selectedAction?.app_name?.charAt(0).toUpperCase() +
|
||||||
selectedAction.app_name.substring(1)
|
selectedAction?.app_name?.substring(1)
|
||||||
).replaceAll("_", " ")}
|
)?.replaceAll("_", " ")}
|
||||||
</h3>
|
</h3>
|
||||||
</div>
|
</div>
|
||||||
<div style={{display: "flex", marginTop: 0, }}>
|
<div style={{display: "flex", marginTop: 0, }}>
|
||||||
@@ -2206,9 +2209,7 @@ const ParsedAction = (props) => {
|
|||||||
</div>
|
</div>
|
||||||
) : null*/}
|
) : null*/}
|
||||||
|
|
||||||
{workflow.execution_variables !== undefined &&
|
{workflow.execution_variables !== undefined && workflow.execution_variables !== null && workflow.execution_variables.length > 0 ? (
|
||||||
workflow.execution_variables !== null &&
|
|
||||||
workflow.execution_variables.length > 0 ? (
|
|
||||||
<div style={{ marginTop: "20px" }}>
|
<div style={{ marginTop: "20px" }}>
|
||||||
<Typography>Execution variable (optional)</Typography>
|
<Typography>Execution variable (optional)</Typography>
|
||||||
<Select
|
<Select
|
||||||
@@ -2429,8 +2430,7 @@ const ParsedAction = (props) => {
|
|||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
renderInput={(params) => {
|
renderInput={(params) => {
|
||||||
|
if (params.inputProps?.value) {
|
||||||
if (params.inputProps?.value) {
|
|
||||||
const prefixes = ["Post", "Put", "Patch"];
|
const prefixes = ["Post", "Put", "Patch"];
|
||||||
for (let prefix of prefixes) {
|
for (let prefix of prefixes) {
|
||||||
if (params.inputProps.value.startsWith(prefix)) {
|
if (params.inputProps.value.startsWith(prefix)) {
|
||||||
@@ -2447,52 +2447,13 @@ const ParsedAction = (props) => {
|
|||||||
if (params.inputProps.value.startsWith("Get List")) {
|
if (params.inputProps.value.startsWith("Get List")) {
|
||||||
console.log("Get List");
|
console.log("Get List");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const actionDescription = null
|
const actionDescription = null
|
||||||
/*(
|
|
||||||
<Box
|
|
||||||
p={1.5}
|
|
||||||
borderRadius={3}
|
|
||||||
boxShadow={2}
|
|
||||||
backgroundColor={theme.palette.textFieldStyle}
|
|
||||||
display="flex"
|
|
||||||
flexDirection="column"
|
|
||||||
>
|
|
||||||
<Box display="flex" alignItems="center" justifyContent="space-between">
|
|
||||||
<Typography variant="body1" style={{ flexGrow: 1 }}>
|
|
||||||
{params.inputProps.value}
|
|
||||||
</Typography>
|
|
||||||
<IconButton size="small"
|
|
||||||
onMouseDown={(event) => {
|
|
||||||
event.preventDefault();
|
|
||||||
event.stopPropagation();
|
|
||||||
}}
|
|
||||||
|
|
||||||
onClick={() => {
|
|
||||||
setHiddenDescription(true)
|
|
||||||
const inputElement = document.getElementById(uiBox);
|
|
||||||
if (inputElement) {
|
|
||||||
inputElement.focus();
|
|
||||||
}
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<CloseIcon fontSize="small" />
|
|
||||||
</IconButton>
|
|
||||||
</Box>
|
|
||||||
<Divider sx={{ backgroundColor: theme.palette.surfaceColor, marginTop: "5px", marginBottom : "10px", height: "3px" }}/>
|
|
||||||
<Box display="flex" flexDirection="column">
|
|
||||||
<Typography variant="body2" mb={0.5}>
|
|
||||||
<strong>Description: </strong> {selectedAction?.description}
|
|
||||||
</Typography>
|
|
||||||
</Box>
|
|
||||||
</Box>
|
|
||||||
)
|
|
||||||
*/
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Tooltip title={actionDescription}
|
<Tooltip title={actionDescription}
|
||||||
placement="right"
|
placement="right"
|
||||||
open={!hiddenDescription}
|
open={!hiddenDescription}
|
||||||
PopperProps={{
|
PopperProps={{
|
||||||
@@ -2507,7 +2468,7 @@ const ParsedAction = (props) => {
|
|||||||
},
|
},
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<TextField
|
<TextField
|
||||||
{...params}
|
{...params}
|
||||||
|
|
||||||
data-lpignore="true"
|
data-lpignore="true"
|
||||||
@@ -2525,7 +2486,7 @@ const ParsedAction = (props) => {
|
|||||||
label={isIntegration ? "Choose a category" : "Find Actions"}
|
label={isIntegration ? "Choose a category" : "Find Actions"}
|
||||||
variant="outlined"
|
variant="outlined"
|
||||||
name={`disable_autocomplete_${Math.random()}`}
|
name={`disable_autocomplete_${Math.random()}`}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
}}
|
}}
|
||||||
@@ -3043,7 +3004,6 @@ const ParsedAction = (props) => {
|
|||||||
//setSelectedActionParameters(selectedActionParameters)
|
//setSelectedActionParameters(selectedActionParameters)
|
||||||
}
|
}
|
||||||
|
|
||||||
var hideBodyButton = "";
|
|
||||||
const hideBodyButtonValue = (
|
const hideBodyButtonValue = (
|
||||||
<div
|
<div
|
||||||
key={data.name}
|
key={data.name}
|
||||||
@@ -3066,74 +3026,73 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
placement="top"
|
placement="top"
|
||||||
>
|
>
|
||||||
<FormControlLabel
|
<ButtonGroup fullWidth>
|
||||||
control={
|
<Button variant={hideBody === true ? "outlined" : "contained"} color="primary" onClick={() => {
|
||||||
<Checkbox
|
setHideBody(false)
|
||||||
tabIndex="-1"
|
|
||||||
checked={hideBody}
|
const updatedParameters = selectedActionParameters.map((param) => {
|
||||||
style={{
|
if (param.name === "body") {
|
||||||
color: theme.palette.primary.secondary,
|
return {
|
||||||
}}
|
...param,
|
||||||
onChange={(event) => {
|
id: "UNTOGGLED",
|
||||||
const newHideBody = !hideBody;
|
}
|
||||||
setHideBody(newHideBody)
|
}
|
||||||
|
|
||||||
|
if (param.description === openApiFieldDesc) {
|
||||||
|
return { ...param, field_active: true }
|
||||||
|
}
|
||||||
|
|
||||||
|
return param
|
||||||
|
})
|
||||||
|
|
||||||
const updatedParameters = selectedActionParameters.map((param) => {
|
setSelectedActionParameters(updatedParameters)
|
||||||
if (param.name === "body") {
|
}}>
|
||||||
return { ...param, id: newHideBody ? "UNTOGGLED" : "TOGGLED" };
|
Simple
|
||||||
}
|
</Button>
|
||||||
if (param.description === openApiFieldDesc) {
|
<Button variant={hideBody === true ? "contained" : "outlined" } color="primary" onClick={() => {
|
||||||
return { ...param, field_active: newHideBody };
|
setHideBody(true)
|
||||||
}
|
// Make sure the body field is shown
|
||||||
return param;
|
const updatedParameters = selectedActionParameters.map((param) => {
|
||||||
});
|
if (param.name === "body") {
|
||||||
|
return {
|
||||||
|
...param,
|
||||||
|
id: "TOGGLED",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param.description === openApiFieldDesc) {
|
||||||
|
return { ...param, field_active: false }
|
||||||
|
}
|
||||||
|
|
||||||
|
return param
|
||||||
|
})
|
||||||
|
|
||||||
setSelectedActionParameters(updatedParameters);
|
setSelectedActionParameters(updatedParameters)
|
||||||
|
}}>
|
||||||
/*
|
Advanced
|
||||||
setTimeout(() => {
|
</Button>
|
||||||
const element = document.getElementById("hide_body_button");
|
</ButtonGroup>
|
||||||
if (element) {
|
|
||||||
element.scrollIntoView({
|
|
||||||
behavior: "smooth",
|
|
||||||
block: "center",
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
*/
|
|
||||||
}}
|
|
||||||
name="requires_unique"
|
|
||||||
/>
|
|
||||||
}
|
|
||||||
label={hideBody ? "Show Body" : "Hide Body"}
|
|
||||||
/>
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
var showButtonField = false
|
||||||
if (selectedApp.generated && data.name === "body") {
|
if (selectedApp.generated && data.name === "body") {
|
||||||
const regex = /\${(\w+)}/g;
|
const regex = /\${(\w+)}/g;
|
||||||
const found = placeholder.match(regex);
|
const found = placeholder.match(regex);
|
||||||
|
|
||||||
|
showButtonField = true
|
||||||
|
|
||||||
hideBodyButton = hideBodyButtonValue;
|
if (hideBody === true) {
|
||||||
if (found === null || !hideBody) {
|
//toast("BODYBUTTON TRUE")
|
||||||
if (found === null) {
|
} else {
|
||||||
|
|
||||||
if (activateHidingBodyButton !== true) {
|
|
||||||
setActivateHidingBodyButton(true)
|
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
|
||||||
//console.log("In found: ", found, hideBody)
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
|
|
||||||
rows = "1";
|
rows = "1";
|
||||||
disabled = true;
|
disabled = true;
|
||||||
openApiHelperText = "OpenAPI spec: fill the following fields.";
|
openApiHelperText = "OpenAPI spec: fill the following fields.";
|
||||||
|
|
||||||
var changed = false;
|
var changed = false;
|
||||||
var tempArray = []
|
var tempArray = []
|
||||||
for (let specKey in found) {
|
for (let specKey in found) {
|
||||||
const tmpitem = found[specKey];
|
const tmpitem = found[specKey];
|
||||||
var skip = false;
|
var skip = false;
|
||||||
@@ -3181,7 +3140,7 @@ const ParsedAction = (props) => {
|
|||||||
|
|
||||||
autocompleted: true,
|
autocompleted: true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var required = selectedActionParameters.filter(item => item.required === true)
|
var required = selectedActionParameters.filter(item => item.required === true)
|
||||||
var notRequired = selectedActionParameters.filter(item => item.required === false)
|
var notRequired = selectedActionParameters.filter(item => item.required === false)
|
||||||
@@ -3200,10 +3159,9 @@ const ParsedAction = (props) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//selectedActionParameters
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
// Sort selectedActionParameters based on selectedActionParameters.required
|
// Sort selectedActionParameters based on selectedActionParameters.required
|
||||||
//selectedActionParameters.sort((a, b) => (a.required < b.required) ? 1 : -1)
|
|
||||||
// Find the "headers" and "queries" field names and put them on the first indexes anyway
|
// Find the "headers" and "queries" field names and put them on the first indexes anyway
|
||||||
var newArray = required.concat(notRequired)
|
var newArray = required.concat(notRequired)
|
||||||
|
|
||||||
@@ -3211,21 +3169,17 @@ const ParsedAction = (props) => {
|
|||||||
setSelectedActionParameters(newArray)
|
setSelectedActionParameters(newArray)
|
||||||
}
|
}
|
||||||
|
|
||||||
return hideBodyButton;
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
//return hideBodyButtonValue
|
||||||
if (activateHidingBodyButton === true) {
|
|
||||||
hideBodyButton = "";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const clickedFieldId = "rightside_field_" + count;
|
const clickedFieldId = "rightside_field_" + count;
|
||||||
|
|
||||||
var baseHelperText = ""
|
var baseHelperText = ""
|
||||||
if (data !== undefined && data !== null && data.value !== undefined && data.value !== null && data.value.length > 0) {
|
if (data !== undefined && data !== null && data.value !== undefined && data.value !== null && data.value.length > 0) {
|
||||||
baseHelperText = calculateHelpertext(data.value)
|
baseHelperText = calculateHelpertext(data.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var tmpitem = data.name.valueOf();
|
var tmpitem = data.name.valueOf();
|
||||||
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
if (data.name.startsWith("${") && data.name.endsWith("}")) {
|
||||||
@@ -3652,7 +3606,7 @@ const ParsedAction = (props) => {
|
|||||||
|
|
||||||
selectedActionParameters[count].value += "\n"
|
selectedActionParameters[count].value += "\n"
|
||||||
selectedAction.parameters[count].value += "\n"
|
selectedAction.parameters[count].value += "\n"
|
||||||
setSelectedActionParameters(selectedActionParameters)
|
setSelectedActionParameters(selectedActionParameters)
|
||||||
setSelectedAction(selectedAction)
|
setSelectedAction(selectedAction)
|
||||||
setUpdate(Math.random())
|
setUpdate(Math.random())
|
||||||
}}>
|
}}>
|
||||||
@@ -4178,26 +4132,21 @@ const ParsedAction = (props) => {
|
|||||||
})}
|
})}
|
||||||
</Menu>
|
</Menu>
|
||||||
);
|
);
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
//var itemColor = "#f85a3e"
|
|
||||||
//if (!data.required) {
|
|
||||||
// itemColor = "#ffeb3b"
|
|
||||||
//}
|
|
||||||
{
|
|
||||||
/*<div style={{width: 17, height: 17, borderRadius: 17 / 2, backgroundColor: itemColor, marginRight: 10, marginTop: 2, marginTop: "auto", marginBottom: "auto",}}/>*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const buttonTitle = `Authenticate API ${selectedApp.name.replaceAll("_", " ")}`
|
const buttonTitle = `Authenticate API ${selectedApp.name.replaceAll("_", " ")}`
|
||||||
const hasAutocomplete = data?.autocompleted === true
|
const hasAutocomplete = data?.autocompleted === true
|
||||||
if (data.variant === undefined || data.variant === null) {
|
if (data.variant === undefined || data.variant === null) {
|
||||||
data.variant = "STATIC_VALUE"
|
data.variant = "STATIC_VALUE"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (data.name === "body" && hideBody === false) {
|
||||||
|
return hideBodyButtonValue
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={data.name}>
|
<div key={data.name}>
|
||||||
{/* {hideBodyButton} */}
|
{showButtonField === true ? hideBodyButtonValue : null}
|
||||||
<div
|
<div
|
||||||
style={{ marginTop: 20, marginBottom: 0, display: "flex" }}
|
style={{ marginTop: 20, marginBottom: 0, display: "flex" }}
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -4960,7 +4960,7 @@ If you're interested, please let me know a time that works for you, or set up a
|
|||||||
<div style={{ marginTop: 50, marginBottom: 20 }}>
|
<div style={{ marginTop: 50, marginBottom: 20 }}>
|
||||||
<h2 style={{ display: "inline" }}>Webhooks</h2>
|
<h2 style={{ display: "inline" }}>Webhooks</h2>
|
||||||
<span style={{ marginLeft: 25 }}>
|
<span style={{ marginLeft: 25 }}>
|
||||||
Webhooks used in Shuffle workflows.
|
Current HTTP Webhook endpoints in your organization.
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
@@ -5114,7 +5114,7 @@ If you're interested, please let me know a time that works for you, or set up a
|
|||||||
<div style={{ marginTop: 50, marginBottom: 20 }}>
|
<div style={{ marginTop: 50, marginBottom: 20 }}>
|
||||||
<h2 style={{ display: "inline" }}>Pipelines</h2>
|
<h2 style={{ display: "inline" }}>Pipelines</h2>
|
||||||
<span style={{ marginLeft: 25 }}>
|
<span style={{ marginLeft: 25 }}>
|
||||||
Controls a pipeline to run things.{" "}
|
Controls a pipeline to e.g. connect to Kafka queues or search in the Tenzir storage.{" "}
|
||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
|
|||||||
@@ -3967,7 +3967,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onNodeDragStop = (event, selectedAction) => {
|
const onNodeDragStop = (event, selectedAction) => {
|
||||||
const nodedata = event.target.data();
|
const nodedata = event.target.data()
|
||||||
if (nodedata.id === selectedAction.id) {
|
if (nodedata.id === selectedAction.id) {
|
||||||
//console.log("Same node, return")
|
//console.log("Same node, return")
|
||||||
return
|
return
|
||||||
@@ -4759,9 +4759,9 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
// Forces all states to update at the same time,
|
// Forces all states to update at the same time,
|
||||||
// Otherwise everything is SUPER slow
|
// Otherwise everything is SUPER slow
|
||||||
|
|
||||||
//const data = JSON.parse(JSON.stringify(event.target.data()))
|
// FIXME: Do absolutely NOT use JSON.stringify on the event.target.data()
|
||||||
const data = event.target.data()
|
// This causes memory referencing to become a nightmare
|
||||||
|
const data = event.target.data()
|
||||||
if (data.app_name === "Shuffle Workflow") {
|
if (data.app_name === "Shuffle Workflow") {
|
||||||
if ((data.parameters !== undefined) && (data.parameters.length > 0)) {
|
if ((data.parameters !== undefined) && (data.parameters.length > 0)) {
|
||||||
getWorkflowApps(data.parameters[0].value)
|
getWorkflowApps(data.parameters[0].value)
|
||||||
@@ -5154,32 +5154,36 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.type === undefined) {
|
if (data.type === undefined) {
|
||||||
console.log("No type, automatically setting to action");
|
console.log("No type, automatically setting to action");
|
||||||
data.type = "ACTION"
|
data.type = "ACTION"
|
||||||
}
|
}
|
||||||
|
|
||||||
if (data.type === "ACTION") {
|
if (data.type === "ACTION") {
|
||||||
setSelectedComment({})
|
setSelectedComment({})
|
||||||
//var curaction = JSON.parse(JSON.stringify(data))
|
|
||||||
// FIXME: Trust it to just work?
|
// FIXME: is this what is mapping it an actual action in the workflow? wtf?
|
||||||
//event.target.data()
|
|
||||||
var curaction = workflow.actions.find((a) => a.id === data.id)
|
var curaction = workflow.actions.find((a) => a.id === data.id)
|
||||||
if (!curaction || curaction === undefined) {
|
if (!curaction || curaction === undefined) {
|
||||||
if (data.id !== undefined && data.app_name !== undefined) {
|
if (data.id !== undefined && data.app_name !== undefined) {
|
||||||
workflow.actions.push(data)
|
workflow.actions.push(data)
|
||||||
setWorkflow(workflow)
|
setWorkflow(workflow)
|
||||||
curaction = data
|
|
||||||
|
// FIXME: Is this necessary?
|
||||||
|
//curaction = JSON.parse(JSON.stringify(data))
|
||||||
} else {
|
} else {
|
||||||
if (workflow.public !== true) {
|
if (workflow.public !== true) {
|
||||||
toast("Action not found. Please remake it.");
|
toast("Action not found. Please remake it.");
|
||||||
}
|
}
|
||||||
|
|
||||||
event.target.remove();
|
event.target.remove()
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FIXME: This change may cause... something
|
||||||
|
curaction = data
|
||||||
|
|
||||||
//var newapps = JSON.parse(JSON.stringify(apps))
|
//var newapps = JSON.parse(JSON.stringify(apps))
|
||||||
var newapps = apps
|
var newapps = apps
|
||||||
if (apps === null || apps === undefined || apps.length === 0) {
|
if (apps === null || apps === undefined || apps.length === 0) {
|
||||||
@@ -5410,6 +5414,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
curaction.parameters[curActionParamKey].value = curaction.parameters[curActionParamKey].options[0];
|
curaction.parameters[curActionParamKey].value = curaction.parameters[curActionParamKey].options[0];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
console.log("Should check APP if it has the same params as ACTION")
|
console.log("Should check APP if it has the same params as ACTION")
|
||||||
for (let actionKey in curapp.actions) {
|
for (let actionKey in curapp.actions) {
|
||||||
@@ -5422,6 +5427,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Fix authentication fields that may be missing in the UI
|
// Fix authentication fields that may be missing in the UI
|
||||||
@@ -5466,7 +5472,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
|
|
||||||
setSelectedApp(curapp)
|
setSelectedApp(curapp)
|
||||||
setSelectedAction(curaction);
|
setSelectedAction(curaction)
|
||||||
|
|
||||||
cy.removeListener("drag");
|
cy.removeListener("drag");
|
||||||
cy.removeListener("free");
|
cy.removeListener("free");
|
||||||
@@ -5943,7 +5949,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
: item.label.toLowerCase().trim().replaceAll(" ", "_");
|
: item.label.toLowerCase().trim().replaceAll(" ", "_");
|
||||||
|
|
||||||
exampledata = GetExampleResult(item);
|
exampledata = GetExampleResult(item);
|
||||||
if (dstdata.parameters !== undefined && dstdata.parameters !== null) {
|
if (dstdata.parameters !== undefined && dstdata.parameters !== null) {
|
||||||
for (let [paramkey,paramkeyval] in Object.entries(dstdata.parameters)) {
|
for (let [paramkey,paramkeyval] in Object.entries(dstdata.parameters)) {
|
||||||
const param = dstdata.parameters[paramkey];
|
const param = dstdata.parameters[paramkey];
|
||||||
// Skip authentication params
|
// Skip authentication params
|
||||||
@@ -5969,9 +5975,8 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
//dstdata.parameters[paramkey].value = `$${parentlabel}${foundresult}`;
|
//dstdata.parameters[paramkey].value = `$${parentlabel}${foundresult}`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Check agains every param
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6208,29 +6213,29 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
|
|
||||||
const onNodeAdded = (event) => {
|
const onNodeAdded = (event) => {
|
||||||
const node = event.target;
|
const node = event.target;
|
||||||
const nodedata = event.target.data();
|
const nodedata = JSON.parse(JSON.stringify(event.target.data()))
|
||||||
|
|
||||||
if (nodedata.finished === false || (nodedata.id !== undefined && nodedata.is_valid === undefined)
|
|
||||||
) {
|
if (nodedata.finished === false || (nodedata.id !== undefined && nodedata.is_valid === undefined)) {
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// DONT MOVE THIS LINE RIGHT HERE v
|
// DONT MOVE THIS LINE RIGHT HERE v
|
||||||
setLastSaved(false)
|
setLastSaved(false)
|
||||||
if (node.isNode() && cy.nodes().size() === 1) {
|
if (node.isNode() && cy.nodes().size() === 1) {
|
||||||
workflow.start = node.data("id");
|
workflow.start = node.data("id")
|
||||||
nodedata.isStartNode = true;
|
nodedata.isStartNode = true
|
||||||
} else {
|
} else {
|
||||||
if (workflow.actions === null) {
|
if (workflow.actions === null) {
|
||||||
console.log("Returning because node has no value")
|
console.log("Returning because node has no value")
|
||||||
return;
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove bad startnode
|
// Remove bad startnode
|
||||||
for (let actionkey in workflow.actions) {
|
for (let actionkey in workflow.actions) {
|
||||||
const action = workflow.actions[actionkey];
|
const action = workflow.actions[actionkey];
|
||||||
if (action.isStartNode && workflow.start !== action.id) {
|
if (action.isStartNode && workflow.start !== action.id) {
|
||||||
action.isStartNode = false;
|
action.isStartNode = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -6289,25 +6294,23 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (nodedata.parameters !== undefined && nodedata.parameters !== null && !nodedata.label.endsWith("_copy")) {
|
if (nodedata.parameters !== undefined && nodedata.parameters !== null && !nodedata?.label?.endsWith("_copy")) {
|
||||||
var newparameters = [];
|
var newparameters = [];
|
||||||
|
|
||||||
for (let [subkey,subkeyval] in Object.entries(nodedata.parameters)) {
|
for (let [subkey,subkeyval] in Object.entries(nodedata.parameters)) {
|
||||||
var newparam = JSON.parse(
|
var newparam = JSON.parse(JSON.stringify(nodedata.parameters[subkey]))
|
||||||
JSON.stringify(nodedata.parameters[subkey])
|
newparam.id = uuidv4()
|
||||||
);
|
|
||||||
newparam.id = uuidv4();
|
|
||||||
|
|
||||||
if (newparam.value === undefined || newparam.value === null) {
|
if (newparam.value === undefined || newparam.value === null) {
|
||||||
newparam.value = "";
|
newparam.value = ""
|
||||||
} else {
|
} else {
|
||||||
newparam.value = newparam.value;
|
newparam.value = newparam.value
|
||||||
}
|
}
|
||||||
|
|
||||||
newparameters.push(newparam);
|
newparameters.push(newparam);
|
||||||
}
|
}
|
||||||
|
|
||||||
nodedata.parameters = newparameters;
|
nodedata.parameters = newparameters
|
||||||
}
|
}
|
||||||
|
|
||||||
if (workflow.actions === undefined || workflow.actions === null) {
|
if (workflow.actions === undefined || workflow.actions === null) {
|
||||||
@@ -7514,7 +7517,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
};
|
};
|
||||||
|
|
||||||
const onNodeHover = (event) => {
|
const onNodeHover = (event) => {
|
||||||
const nodedata = event.target.data();
|
const nodedata = JSON.parse(JSON.stringify(event.target.data()))
|
||||||
|
|
||||||
const cytoscapeElement = document.getElementById("cytoscape_view")
|
const cytoscapeElement = document.getElementById("cytoscape_view")
|
||||||
if (cytoscapeElement !== undefined && cytoscapeElement !== null) {
|
if (cytoscapeElement !== undefined && cytoscapeElement !== null) {
|
||||||
@@ -7528,7 +7531,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
})
|
})
|
||||||
|
|
||||||
if (nodedata.finished === false) {
|
if (nodedata.finished === false) {
|
||||||
console.log("NODE UNFINISHED (hover in): ", nodedata)
|
console.log("NODE UNFINISHED (hover in): ", JSON.parse(JSON.stringify(nodedata)))
|
||||||
|
|
||||||
// Should just be 1, so this should be fast enough :3
|
// Should just be 1, so this should be fast enough :3
|
||||||
const incomingEdges = event.target.incomers("edge").jsons()
|
const incomingEdges = event.target.incomers("edge").jsons()
|
||||||
@@ -9635,7 +9638,6 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
newNodeId = uuidv4();
|
newNodeId = uuidv4();
|
||||||
const actionType = "ACTION";
|
const actionType = "ACTION";
|
||||||
const actionLabel = getNextActionName(app.name);
|
const actionLabel = getNextActionName(app.name);
|
||||||
//console.log("Next action name: ", actionLabel)
|
|
||||||
var parameters = null;
|
var parameters = null;
|
||||||
var example = "";
|
var example = "";
|
||||||
var description = ""
|
var description = ""
|
||||||
@@ -9653,12 +9655,9 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Make the first action the most relevant one for them based on previous use
|
// Make the first action the most relevant one for them based on previous use
|
||||||
if (
|
if (app.actions[actionIndex].parameters !== undefined && app.actions[actionIndex].parameters !== null && app.actions[actionIndex].parameters.length > 0) {
|
||||||
app.actions[actionIndex].parameters !== undefined &&
|
|
||||||
app.actions[actionIndex].parameters !== null &&
|
parameters = JSON.parse(JSON.stringify(app.actions[actionIndex].parameters))
|
||||||
app.actions[actionIndex].parameters.length > 0
|
|
||||||
) {
|
|
||||||
parameters = app.actions[actionIndex].parameters;
|
|
||||||
for (let paramkey in parameters) {
|
for (let paramkey in parameters) {
|
||||||
// Check if parameter.name == "headers" and if it includes "=undefined". If it does, set the value to example if it exists, otherwise empty
|
// Check if parameter.name == "headers" and if it includes "=undefined". If it does, set the value to example if it exists, otherwise empty
|
||||||
if (parameters[paramkey].name === "headers" && parameters[paramkey].value.includes("=undefined")) {
|
if (parameters[paramkey].name === "headers" && parameters[paramkey].value.includes("=undefined")) {
|
||||||
@@ -9669,8 +9668,6 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//parameters = app.actions[0].parameters;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
@@ -9763,23 +9760,20 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
authentication_id: authId,
|
authentication_id: authId,
|
||||||
finished: false,
|
finished: false,
|
||||||
template: app.template === true ? true : false,
|
template: app.template === true ? true : false,
|
||||||
};
|
}
|
||||||
|
|
||||||
// FIXME: overwrite category if the ACTION chosen has a different category
|
// FIXME: Something is going wrong with params
|
||||||
//
|
if (!isCloud && (!app.is_valid || (!app.activated && app.generated))) {
|
||||||
|
console.log("NOT VALID: Activate!")
|
||||||
|
|
||||||
|
activateApp(app.id, false)
|
||||||
|
}
|
||||||
|
|
||||||
if (!isCloud && (!app.is_valid || (!app.activated && app.generated))) {
|
// find the cytoscape offset position
|
||||||
console.log("NOT VALID: Activate!")
|
|
||||||
|
|
||||||
activateApp(app.id, false)
|
|
||||||
}
|
|
||||||
|
|
||||||
// const image = "url("+app.large_image+")"
|
|
||||||
// FIXME - find the cytoscape offset position
|
|
||||||
// Can this be done with zoom calculations?
|
// Can this be done with zoom calculations?
|
||||||
const nodeToBeAdded = {
|
const nodeToBeAdded = {
|
||||||
group: "nodes",
|
group: "nodes",
|
||||||
data: newAppData,
|
data: JSON.parse(JSON.stringify(newAppData)),
|
||||||
renderedPosition: {
|
renderedPosition: {
|
||||||
x: e.pageX - cycontainer.offsetLeft,
|
x: e.pageX - cycontainer.offsetLeft,
|
||||||
y: e.pageY - cycontainer.offsetTop,
|
y: e.pageY - cycontainer.offsetTop,
|
||||||
@@ -10559,7 +10553,6 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
//newSelectedAction.parameters[newParamIndex].value = param.value
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newSelectedAction.parameters === undefined || newSelectedAction.parameters === null) {
|
if (newSelectedAction.parameters === undefined || newSelectedAction.parameters === null) {
|
||||||
@@ -10584,6 +10577,13 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
console.log("PARAM CHANGE: ", param, newSelectedAction.parameters[newParamIndex])
|
||||||
|
if (param?.value?.includes("Secret. Replaced") && (param.configuration !== true || newSelectedAction.parameters[newParamIndex].configuration !== true)) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
newSelectedAction.parameters[newParamIndex].value = param.value
|
newSelectedAction.parameters[newParamIndex].value = param.value
|
||||||
newSelectedAction.parameters[newParamIndex].autocompleted = true
|
newSelectedAction.parameters[newParamIndex].autocompleted = true
|
||||||
if (param.options !== undefined && param.options !== null && param.options.length > 0) {
|
if (param.options !== undefined && param.options !== null && param.options.length > 0) {
|
||||||
@@ -10615,6 +10615,16 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (var preparamindex in newSelectedAction.parameters) {
|
||||||
|
const param = newSelectedAction.parameters[preparamindex]
|
||||||
|
if (param.configuration === true) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
if (param?.value?.toLowerCase().includes("secret. replace")) {
|
||||||
|
newSelectedAction.parameters[preparamindex].value = ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Takes an action as input, then runs through and updates the relevant parameters based on previous actions' results (parent nodes)
|
// Takes an action as input, then runs through and updates the relevant parameters based on previous actions' results (parent nodes)
|
||||||
// Further checks if those fields are already set in a previously used action
|
// Further checks if those fields are already set in a previously used action
|
||||||
@@ -11087,7 +11097,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
type: "action",
|
type: "action",
|
||||||
id: item.id,
|
id: item.id,
|
||||||
name: item.label,
|
name: item.label,
|
||||||
autocomplete: `${item.label.split(" ").join("_")}`,
|
autocomplete: `${item?.label?.split(" ")?.join("_")}`,
|
||||||
example: item.example === undefined ? "" : item.example,
|
example: item.example === undefined ? "" : item.example,
|
||||||
};
|
};
|
||||||
actionlist.push(actionvalue);
|
actionlist.push(actionvalue);
|
||||||
@@ -16171,8 +16181,9 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
for (let actionkey in workflow.actions) {
|
for (let actionkey in workflow.actions) {
|
||||||
workflow.actions[actionkey].environment = env.Name
|
workflow.actions[actionkey].environment = env.Name
|
||||||
}
|
}
|
||||||
|
|
||||||
setWorkflow(workflow)
|
setWorkflow(workflow)
|
||||||
toast.success("Set execution location for ALL actions to " + env.Name)
|
//toast.success("Set execution location for ALL actions to " + env.Name)
|
||||||
}}
|
}}
|
||||||
style={{
|
style={{
|
||||||
pointerEvents: "auto",
|
pointerEvents: "auto",
|
||||||
@@ -20913,9 +20924,7 @@ const releaseToConnectLabel = "Release to Connect"
|
|||||||
}
|
}
|
||||||
color="primary"
|
color="primary"
|
||||||
defaultValue={
|
defaultValue={
|
||||||
data.value !== undefined && data.value !== null && !data.value.includes("Secret. Replace")
|
data.value !== undefined && data.value !== null && !data.value.includes("Secret. Replace") ? data.value : ""
|
||||||
? data.value
|
|
||||||
: ""
|
|
||||||
}
|
}
|
||||||
placeholder={data.example}
|
placeholder={data.example}
|
||||||
onChange={(event) => {
|
onChange={(event) => {
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user