Bumped sync with cloud issues

This commit is contained in:
Frikky
2025-01-23 17:05:34 +01:00
parent b485690eea
commit d1d4ffaf01
13 changed files with 1052 additions and 771 deletions
+2 -2
View File
@@ -1149,7 +1149,7 @@ const EditWorkflow = (props) => {
</div>
: null}
{!isEditing ? <>
{/*!isEditing ? <>
<div style={{ marginTop: 20, }}>
<FormControlLabel
control={<Checkbox />}
@@ -1164,7 +1164,7 @@ const EditWorkflow = (props) => {
/>
</div>
</> : null}
</> : null*/}
<Tooltip color="primary" title={"Add more details"} placement="top">
<Button
+12 -13
View File
@@ -500,7 +500,7 @@ useEffect(() => {
})
</MenuItem>
</Link>
<Link to="/usecases" style={hrefStyle}>
<Link to="/workflows" style={hrefStyle}>
<MenuItem
onClick={(event) => {
handleClose();
@@ -801,18 +801,6 @@ useEffect(() => {
zoom: 0.8,
height: "calc((100vh - 32px)*1.2)",
}}
onMouseLeave={() => {
if (window?.location?.pathname?.includes("/workflows/")) {
setExpandLeftNav(false);
}
}}
onMouseOver={() => {
if (window?.location?.pathname?.includes("/workflows/")) {
setExpandLeftNav(true);
}
}
}
>
{modalView}
<Box
@@ -823,6 +811,17 @@ useEffect(() => {
alignItems: "center",
padding: "24px 16px 24px 27px",
}}
onMouseOver={()=>{
if(window?.location?.pathname?.includes("/workflows/")) {
setExpandLeftNav(true)
}
}}
onMouseLeave={()=>{
if(window?.location?.pathname?.includes("/workflows/")) {
setExpandLeftNav(false)
}
}}
>
<a href="/" style={{ textDecoration: "none" }}>
<img
+74 -41
View File
@@ -238,6 +238,7 @@ const ParsedAction = (props) => {
var generated_optional = []
var keyorder = []
for (let paramkey in selectedActionParameters) {
var param = selectedActionParameters[paramkey]
keyorder.push(param.name)
@@ -258,10 +259,15 @@ const ParsedAction = (props) => {
continue
}
//if (param.name.startsWith("${") && param.name.endsWith("}")) {
// console.log("PARAM: ", param)
//}
if (param.required === false && param.name.startsWith("${") && param.name.endsWith("}")) {
// Check if it's a required param
param.autocompleted = true
if (selectedAction.required_body_fields !== undefined && selectedAction.required_body_fields !== null && selectedAction.required_body_fields.length > 0) {
if (selectedAction.required_body_fields.includes(param.name)) {
param.required = true
}
@@ -502,7 +508,6 @@ const ParsedAction = (props) => {
//setStartNode(selectedAction.id)
};
useEffect(() => {
// Only set app action name if it has changed
if (selectedAction.label !== appActionName) {
@@ -732,17 +737,18 @@ const ParsedAction = (props) => {
}
return {...param, value: paramvalue, error: message}
});
setSelectedActionParameters(newParameters);
setActionlist(newActionList);
}, [workflow.execution_variables, paramUpdate, workflow.workflow_variables, workflowExecutions, workflow, selectedAction, listCache, getParents,setNewSelectedAction]);
useEffect(() => {
selectedNameChange(appActionName)
useEffect(() => {
selectedNameChange(appActionName)
if (actionDelayChange !== undefined) {
actionDelayChange(delay)
}
},[appActionName,delay])
if (actionDelayChange !== undefined) {
actionDelayChange(delay)
}
},[appActionName,delay])
const handleParamChange = (event, count,data) => {
const newParams = [...selectedActionParameters];
@@ -828,14 +834,14 @@ const ParsedAction = (props) => {
if (paramcheck !== undefined) {
// Escapes all double quotes
var toReplace = event.target.value.trim()
//var toReplace = event.target.value.trim()
var toReplace = event.target.value
if (!toReplace.startsWith("{") && !toReplace.startsWith("[")) {
toReplace = toReplace.replaceAll('\\"', '"').replaceAll('"', '\\"')
}
console.log("REPLACE WITH: ", toReplace);
if (
paramcheck["value_replace"] === undefined ||
paramcheck["value_replace"] === null
@@ -1711,13 +1717,11 @@ const ParsedAction = (props) => {
color="primary"
placeholder={selectedAction.label}
value={appActionName}
onChange={
(event) => {
let newValue = event.target.value
newValue = newValue.replaceAll(" ", "_")
setAppActionName(newValue)
}
}
onChange={(event) => {
let newValue = event.target.value
newValue = newValue.replaceAll(" ", "_")
setAppActionName(newValue)
}}
onBlur={(e) => {
// Copy the name value
const name = e.target.value
@@ -1905,14 +1909,14 @@ const ParsedAction = (props) => {
}
}
} catch (e) {
} catch (e) {
console.log("Failed value replacement based on index: ", e)
}
}
}
setWorkflow(workflow);
setUpdate(Math.random());
setWorkflow(workflow)
setUpdate(Math.random())
setPrevActionName(name)
}}
/>
@@ -2137,6 +2141,7 @@ const ParsedAction = (props) => {
color: "white",
}}
value="authgroups"
disabled
>
<em>Auth Groups</em>
</MenuItem>
@@ -2897,6 +2902,10 @@ const ParsedAction = (props) => {
}
authWritten = true;
return null
/*
// FIXME: Is this part necessary to show?
return (
<Typography
key={count}
@@ -2908,6 +2917,7 @@ const ParsedAction = (props) => {
Authentication fields are hidden
</Typography>
);
*/
}
@@ -3107,6 +3117,7 @@ const ParsedAction = (props) => {
localStorage.setItem("hideBody", "false")
setHideBody(true)
// Make sure the body field is shown
var foundvalue = false
const updatedParameters = selectedActionParameters.map((param) => {
if (param.name === "body") {
return {
@@ -3116,11 +3127,19 @@ const ParsedAction = (props) => {
}
if (param.description === openApiFieldDesc) {
if (param.value.length > 0) {
foundvalue = true
}
return { ...param, field_active: false }
}
return param
})
if (foundvalue === true) {
toast.info("Please fill either Simple fields OR Advanced body, not both")
}
setSelectedActionParameters(updatedParameters)
}}
@@ -3440,9 +3459,7 @@ const ParsedAction = (props) => {
}
placeholder={placeholder}
onChange={(event) => {
//changeActionParameterCodemirror(event, count, data)
// changeActionParameter(event, count, data);
handleParamChange(event, count, data)
handleParamChange(event, count, data)
}}
onFocus={(event) => {
// Get local storage key "disabled_ui_box" and check if it's true
@@ -3453,6 +3470,8 @@ const ParsedAction = (props) => {
}
}}
onBlur={(event) => {
handleParamChange(event, count, data)
baseHelperText = calculateHelpertext(event.target.value)
if (setLastSaved !== undefined) {
setLastSaved(false)
@@ -3815,7 +3834,7 @@ const ParsedAction = (props) => {
}
if (data.field_active === false) {
console.log("Field not active: ", data?.name)
//console.log("Field not active: ", data?.name)
return null
}
@@ -4060,7 +4079,6 @@ const ParsedAction = (props) => {
overflow: "hidden",
}}
onClick={() => {
console.log("CLICKED: ", innerdata);
console.log(innerdata.example)
handleItemClick([innerdata]);
}}
@@ -4240,14 +4258,14 @@ const ParsedAction = (props) => {
data.field_active === true ?
<Tooltip
color="primary"
title={"This is an advanced field, simplified to make it easier to use. NOT required according to the API documentation."}
title={"This is an Simplified field to make the body easier to use. NOT required according to the API documentation. If this is filled, it will be overridden in the Advanced Body"}
placement="top"
>
<PriorityHighIcon
style={{
color: "rgba(255,255,255,0.5)" ,
marginRight: 0,
}}/>
style={{
color: "rgba(255,255,255,0.5)" ,
marginRight: 0,
}}/>
</Tooltip>
:
@@ -4294,7 +4312,20 @@ const ParsedAction = (props) => {
<OpenInFullIcon
style={{ color: "rgba(255,255,255,0.7)", cursor: "pointer", margin: multiline ? 5 : 0, height: 20, width: 20, }}
onMouseOver={(event) => {
const clickedField = document.getElementById(clickedFieldId)
if (clickedField !== null) {
clickedField.focus()
}
}}
onClick={(event) => {
// Set focus to the Textfield we just clicked
// This is to ensure focus is set correctly at all times with blur
const clickedField = document.getElementById(clickedFieldId)
if (clickedField !== null) {
clickedField.focus()
}
event.preventDefault()
setFieldCount(count)
setExpansionModalOpen(true)
@@ -4305,20 +4336,22 @@ const ParsedAction = (props) => {
parsedvalue = ""
}
//console.log("Required fields: ", selectedActionParameters[count])
//console.log("Required fields: ", selectedActionParameters[count])
navigate(`?action_id=${selectedAction.id}&field=${data.name}&action_name=${selectedAction.name}`)
setEditorData({
"name": data.name,
"value": fixExample(parsedvalue),
"field_number": count,
"actionlist": actionlist,
"field_id": clickedFieldId,
setEditorData({
"name": data.name,
"value": fixExample(parsedvalue),
"field_number": count,
"actionlist": actionlist,
"field_id": clickedFieldId,
"example": fixExample(selectedActionParameters[count].example),
})
}}
/>
</Tooltip>
"example": fixExample(selectedActionParameters[count].example),
})
}}
/>
</Tooltip>
</div>
{datafield}
+388 -403
View File
@@ -14,6 +14,7 @@ import {
Menu,
MenuItem,
Button,
ButtonGroup,
} from '@mui/material';
import theme from '../theme.jsx';
@@ -77,16 +78,21 @@ const liquidFilters = [
{ "name": "URL decode ", "value": `url_decode`, "example": `{{ "https://www.google.com/search?q=hello%20world" | url_decode }}` },
{ "name": "base64_encode", "value": `base64_encode`, "example": `{{ "https://www.google.com/search?q=hello%20world" | base64_encode }}` },
{ "name": "base64_decode", "value": `base64_decode`, "example": `{{ "aGVsbG8K" | base64_encode }}` },
]
const mathFilters = [
{ "name": "Plus", "value": "plus: 1", "example": `{{ "1" | plus: 1 }}` },
{ "name": "Minus", "value": "minus: 1", "example": `{{ "1" | minus: 1 }}` },
]
const pythonFilters = [
{ "name": "Hello World", "value": `{% python %}\nprint("hello world")\n{% endpython %}`, "example": `` },
{ "name": "Handle JSON", "value": `{% python %}\nimport json\njsondata = json.loads(r"""$nodename""")\n{% endpython %}`, "example": `` },
{ "name": "Hello World", "value": `print("hello world")`, "example": `` },
{ "name": "Using Shuffle variables", "value": `import json\nnodevalue = r\"\"\"$exec\"\"\"\nif not nodevalue:\n nodevalue = r\"\"\"{\"sample\": \"string\", \"int\": 1}\"\"\"\n \njsondata = json.loads(nodevalue)\nprint(jsondata)`, "example": `` },
{ "name": "Print Execution ID", "value": `print(self.current_execution_id)`, "example": `` },
{ "name": "Get full execution details", "value": `print(self.full_execution)`, "example": `` },
{ "name": "Use files", "value": `# Create a sample file\nfiles = [{\n \"name\": \"test.txt\",\n \"data\": \"Testdata\"\n}]\nret = self.set_files(files)\n\n# Get the content of the file from Shuffle storage\n# Originally a byte string in the \"data\" key\nfile_content = (self.get_file(ret[0])[\"data\"]).decode()\nprint(file_content)`, "example": `` },
{ "name": "Use datastore", "value": `key = \"testkey\"\nvalue = \"The value of the testkey\"\n\nself.set_cache(key, value)\n\n# Print the details of the key after it's been updated\n# To get the value, use self.get_cache(key)[\"value\"]\nprint(self.get_cache(key))`, "example": `` },
{ "name": "Run an App Action", "value": `response = self.run_app(app_id="app", action="action_name", auth="authentication_id", params={})\nprint(response)`, "example": ``, "disabled": true, },
{ "name": "Run a Singul AI Action", "value": `response = self.create_ticket(app="jira/iris/ticketingsystem", fields={"title": "Test ticket!"})\nprint(response)`, "example": ``, "disabled": true, },
]
const extensions = []
@@ -105,6 +111,7 @@ const CodeEditor = (props) => {
toolsAppId,
parameterName,
selectedAction,
selectedTrigger,
workflowExecutions,
getParents,
activeDialog,
@@ -112,7 +119,7 @@ const CodeEditor = (props) => {
fieldname,
contentLoading,
editorData,
handleSubflowParamChange,
setAiQueryModalOpen,
fullScreenMode,
environment,
@@ -1010,12 +1017,14 @@ const CodeEditor = (props) => {
var currentLineData = codedatasplit[currentLine]
// Remove newlines from item.value
/*
if (item.value.includes("% python %")) {
item.value = item.value.replaceAll("\n", ";")
item.value = item.value.replaceAll("python %};", "python %}")
} else {
item.value = item.value.replaceAll("\n", "")
}
*/
currentLineData = currentLineData.slice(0, currentCharacter) + item.value + currentLineData.slice(currentCharacter)
codedatasplit[currentLine] = currentLineData
@@ -1093,9 +1102,9 @@ const CodeEditor = (props) => {
toast(responseJson.reason)
newResult = { "valid": false, "result": responseJson.reason }
} else if (responseJson.success === true) {
newResult = { "valid": false, "result": "Couldn't finish execution. Please fill all the required fields, and retry the execution." }
newResult = { "valid": false, "result": "Result is Empty or Couldn't finish execution (1). If using python, use print('value') to see the result" }
} else {
newResult = { "valid": false, "result": "Couldn't finish execution (2). Please fill all the required fields, and validate the execution." }
newResult = { "valid": false, "result": "Result is Empty or Couldn't finish execution (2). If using python, use print('value') to see the result" }
}
if (responseJson.errors !== undefined && responseJson.errors !== null && responseJson.errors.length > 0) {
@@ -1187,7 +1196,6 @@ const CodeEditor = (props) => {
overflowY: "auto",
whiteSpace: "pre-wrap",
wordWrap: "break-word",
backgroundColor: "rgba(40,40,40,1)",
zIndex: activeDialog === "codeeditor" ? 1200 : 1100,
}}
@@ -1213,6 +1221,7 @@ const CodeEditor = (props) => {
hideBackdrop={true}
open={expansionModalOpen}
onClose={() => {
navigate("")
console.log("In closer")
if (changeActionParameterCodeMirror !== undefined) {
@@ -1237,7 +1246,7 @@ const CodeEditor = (props) => {
maxWidth: isMobile ? "100%" : isFileEditor ? 650 : 1100,
minHeight: isMobile ? "100%" : "auto",
maxHeight: isMobile ? "100%" : 700,
border: theme.palette.defaultBorder,
border: "3px solid rgba(255,255,255,0.3)",
padding: isMobile ? "25px 10px 25px 10px" : 25,
// zoom: 0.8,
backgroundColor: "black",
@@ -1291,6 +1300,7 @@ const CodeEditor = (props) => {
color: "grey",
}}
onClick={() => {
navigate("")
setExpansionModalOpen(false)
}}
>
@@ -1337,413 +1347,374 @@ const CodeEditor = (props) => {
*/}
{isFileEditor ? null :
<div style={{ display: "flex", maxHeight: 40, }}>
{selectedAction?.name === "execute_python" ?
<Typography variant="body1" style={{ marginTop: 5, }}>
Run Python Code
</Typography>
:
selectedAction.name === "execute_bash" ?
<Typography variant="body1" style={{ marginTop: 5, }}>
Run Bash Code
</Typography>
:
<div style={{ display: "flex", }}>
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={liquidOpen ? 'basic-menu' : undefined}
aria-expanded={liquidOpen ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 100,
}}
onClick={(event) => {
setAnchorEl(event.currentTarget);
}}
>
Filters
</Button>
<Menu
id="basic-menu"
anchorEl={anchorEl}
open={liquidOpen}
onClose={() => {
setAnchorEl(null);
}}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
{liquidFilters.map((item, index) => {
return (
<MenuItem key={index} onClick={() => {
handleClick(item)
}}>{item.name}</MenuItem>
)
})}
</Menu>
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={mathOpen ? 'basic-menu' : undefined}
aria-expanded={mathOpen ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 100,
}}
onClick={(event) => {
setAnchorEl2(event.currentTarget);
}}
>
Math
</Button>
<Menu
id="basic-menu"
anchorEl={anchorEl2}
open={mathOpen}
onClose={() => {
setAnchorEl2(null);
}}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
{mathFilters.map((item, index) => {
return (
<MenuItem key={index} onClick={() => {
handleClick(item)
}}>{item.name}</MenuItem>
)
})}
</Menu>
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={pythonOpen ? 'basic-menu' : undefined}
aria-expanded={pythonOpen ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 100,
}}
onClick={(event) => {
setAnchorEl3(event.currentTarget);
}}
>
Python
</Button>
<Menu
id="basic-menu"
anchorEl={anchorEl3}
open={pythonOpen}
onClose={() => {
setAnchorEl3(null);
}}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
{pythonFilters.map((item, index) => {
return (
<MenuItem key={index} onClick={() => {
handleClick(item)
}}>{item.name}</MenuItem>
)
})}
</Menu>
</div>
}
<ButtonGroup style={{ borderRadius: theme.palette.borderRadius, }}>
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={liquidOpen ? 'basic-menu' : undefined}
aria-expanded={liquidOpen ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 120,
}}
onClick={(event) => {
setAnchorEl(event.currentTarget);
}}
>
Liquid Filters
</Button>
<Menu
id="basic-menu"
anchorEl={anchorEl}
open={liquidOpen}
onClose={() => {
setAnchorEl(null);
}}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
{liquidFilters.map((item, index) => {
return (
<MenuItem key={index} onClick={() => {
handleClick(item)
}}>{item.name}</MenuItem>
)
})}
</Menu>
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={pythonOpen ? 'basic-menu' : undefined}
aria-expanded={pythonOpen ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 120,
}}
onClick={(event) => {
setAnchorEl3(event.currentTarget);
}}
>
Python Code
</Button>
<Menu
id="basic-menu"
anchorEl={anchorEl3}
open={pythonOpen}
onClose={() => {
setAnchorEl3(null);
}}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
{pythonFilters.map((item, index) => {
return (
<MenuItem key={index} onClick={() => {
if (item.disabled) {
toast.error("This feature may not work in your environment yet, and is awaiting updates to the Shuffle python execution environment.", { autoClose: 10000 })
}
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={!!menuPosition ? 'basic-menu' : undefined}
aria-expanded={!!menuPosition ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 130,
marginLeft: 20,
}}
onClick={(event) => {
setMenuPosition({
top: event.pageY,
left: event.pageX,
})
}}
>
<AddIcon /> Autocomplete
</Button>
<Menu
anchorReference="anchorPosition"
anchorPosition={menuPosition}
if (selectedAction.name !== "execute_python") {
var newitem = JSON.parse(JSON.stringify(item))
newitem.value = `{% python %}\n${item.value}\n{% endpython %}`
handleClick(newitem)
} else {
handleClick(item)
}
}}>{item.name}</MenuItem>
)
})}
</Menu>
anchorOrigin={{
vertical: 'bottom',
horizontal: 'left',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'left',
}}
//MenuListProps={{
// style: adjustPosition(),
//}}
<Button
id="basic-button"
aria-haspopup="true"
aria-controls={!!menuPosition ? 'basic-menu' : undefined}
aria-expanded={!!menuPosition ? 'true' : undefined}
variant="outlined"
color="secondary"
style={{
textTransform: "none",
width: 130,
}}
onClick={(event) => {
setMenuPosition({
top: event.pageY,
left: event.pageX,
})
}}
>
<AddIcon /> Autocomplete
</Button>
onClose={() => {
handleMenuClose();
}}
open={!!menuPosition}
style={{
color: "white",
marginTop: 2,
maxHeight: 650,
}}
>
{actionlist?.map((innerdata) => {
const icon =
innerdata.type === "action" ? (
<AppsIcon style={{ marginRight: 10 }} />
) : innerdata.type === "workflow_variable" ||
innerdata.type === "execution_variable" ? (
<FavoriteBorderIcon style={{ marginRight: 10 }} />
) : (
<ScheduleIcon style={{ marginRight: 10 }} />
);
<Menu
anchorReference="anchorPosition"
anchorPosition={menuPosition}
const handleExecArgumentHover = (inside) => {
var exec_text_field = document.getElementById(
"execution_argument_input_field"
);
if (exec_text_field !== null) {
if (inside) {
exec_text_field.style.border = "2px solid #f85a3e";
} else {
exec_text_field.style.border = "";
anchorOrigin={{
vertical: 'bottom',
horizontal: 'left',
}}
keepMounted
transformOrigin={{
vertical: 'top',
horizontal: 'left',
}}
//MenuListProps={{
// style: adjustPosition(),
//}}
onClose={() => {
handleMenuClose();
}}
open={!!menuPosition}
style={{
color: "white",
marginTop: 2,
maxHeight: 650,
}}
>
{actionlist?.map((innerdata) => {
const icon =
innerdata.type === "action" ? (
<AppsIcon style={{ marginRight: 10 }} />
) : innerdata.type === "workflow_variable" ||
innerdata.type === "execution_variable" ? (
<FavoriteBorderIcon style={{ marginRight: 10 }} />
) : (
<ScheduleIcon style={{ marginRight: 10 }} />
);
const handleExecArgumentHover = (inside) => {
var exec_text_field = document.getElementById(
"execution_argument_input_field"
);
if (exec_text_field !== null) {
if (inside) {
exec_text_field.style.border = "2px solid #f85a3e";
} else {
exec_text_field.style.border = "";
}
}
}
};
};
const handleActionHover = (inside, actionId) => {
};
const handleActionHover = (inside, actionId) => {
};
const handleMouseover = () => {
if (innerdata.type === "Execution Argument") {
handleExecArgumentHover(true);
} else if (innerdata.type === "action") {
handleActionHover(true, innerdata.id);
}
};
const handleMouseover = () => {
if (innerdata.type === "Execution Argument") {
handleExecArgumentHover(true);
} else if (innerdata.type === "action") {
handleActionHover(true, innerdata.id);
}
};
const handleMouseOut = () => {
if (innerdata.type === "Execution Argument") {
handleExecArgumentHover(false);
} else if (innerdata.type === "action") {
handleActionHover(false, innerdata.id);
}
};
const handleMouseOut = () => {
if (innerdata.type === "Execution Argument") {
handleExecArgumentHover(false);
} else if (innerdata.type === "action") {
handleActionHover(false, innerdata.id);
}
};
var parsedPaths = [];
if (innerdata.type === "workflow_variable") {
// Try to parse the value if it's a string that could be JSON
if (typeof innerdata.value === "string") {
try {
const parsedValue = JSON.parse(innerdata.value)
if (typeof parsedValue === "object") {
parsedPaths = GetParsedPaths(parsedValue, "");
var parsedPaths = [];
if (innerdata.type === "workflow_variable") {
// Try to parse the value if it's a string that could be JSON
if (typeof innerdata.value === "string") {
try {
const parsedValue = JSON.parse(innerdata.value)
if (typeof parsedValue === "object") {
parsedPaths = GetParsedPaths(parsedValue, "");
}
} catch (e) {
// Not valid JSON, use the value directly
parsedPaths = GetParsedPaths(innerdata.value, "");
}
} else if (typeof innerdata.value === "object") {
parsedPaths = GetParsedPaths(innerdata.value, "");
}
} catch (e) {
// Not valid JSON, use the value directly
parsedPaths = GetParsedPaths(innerdata.value, "");
}
} else if (typeof innerdata.value === "object") {
parsedPaths = GetParsedPaths(innerdata.value, "");
}
} else if (typeof innerdata.example === "object") {
parsedPaths = GetParsedPaths(innerdata.example, "");
}
const coverColor = "#82ccc3"
//menuPosition.left -= 50
//menuPosition.top -= 250
//console.log("POS: ", menuPosition1)
var menuPosition1 = menuPosition
if (menuPosition1 === null) {
menuPosition1 = {
"left": 0,
"top": 0,
} else if (typeof innerdata.example === "object") {
parsedPaths = GetParsedPaths(innerdata.example, "");
}
} else if (menuPosition1.top === null || menuPosition1.top === undefined) {
menuPosition1.top = 0
} else if (menuPosition1.left === null || menuPosition1.left === undefined) {
menuPosition1.left = 0
}
//console.log("POS1: ", menuPosition1)
return parsedPaths.length > 0 ? (
<NestedMenuItem
key={innerdata.name}
label={
<div style={{ display: "flex", marginLeft: 0, }}>
{icon} {innerdata.name}
</div>
const coverColor = "#82ccc3"
//menuPosition.left -= 50
//menuPosition.top -= 250
//console.log("POS: ", menuPosition1)
var menuPosition1 = menuPosition
if (menuPosition1 === null) {
menuPosition1 = {
"left": 0,
"top": 0,
}
parentMenuOpen={!!menuPosition}
style={{
color: "white",
minWidth: 250,
maxWidth: 250,
maxHeight: 50,
overflow: "hidden",
}}
onClick={() => {
console.log("CLICKED: ", innerdata);
console.log(innerdata.example)
} else if (menuPosition1.top === null || menuPosition1.top === undefined) {
menuPosition1.top = 0
} else if (menuPosition1.left === null || menuPosition1.left === undefined) {
menuPosition1.left = 0
}
//const handleClick = (item) => {
handleItemClick([innerdata]);
}}
>
<Paper style={{ minHeight: 550, maxHeight: 550, minWidth: 275, maxWidth: 275, position: "fixed", left: menuPosition1.left - 270, padding: "10px 0px 10px 10px", overflow: "hidden", overflowY: "auto", border: "1px solid rgba(255,255,255,0.3)", }}>
<MenuItem
key={innerdata.name}
style={{
marginLeft: 15,
color: "white",
minWidth: 250,
maxWidth: 250,
padding: 0,
position: "relative",
}}
value={innerdata}
onMouseOver={() => {
//console.log("HOVER: ", pathdata);
}}
onClick={() => {
handleItemClick([innerdata]);
}}
>
<Typography variant="h6" style={{ paddingBottom: 5 }}>
{innerdata.name}
</Typography>
</MenuItem>
{parsedPaths.map((pathdata, index) => {
// FIXME: Should be recursive in here
//<VpnKeyIcon style={iconStyle} />
const icon =
pathdata.type === "value" ? (
<span style={{ marginLeft: 9, }} />
) : pathdata.type === "list" ? (
<FormatListNumberedIcon style={{ marginLeft: 9, marginRight: 10, }} />
) : (
<CircleIcon style={{ marginLeft: 9, marginRight: 10, color: coverColor }} />
);
//<ExpandMoreIcon style={iconStyle} />
//console.log("POS1: ", menuPosition1)
const indentation_count = (pathdata.name.match(/\./g) || []).length + 1
//const boxPadding = pathdata.type === "object" ? "10px 0px 0px 0px" : 0
const boxPadding = 0
const namesplit = pathdata.name.split(".")
const newname = namesplit[namesplit.length - 1]
return (
<MenuItem
key={pathdata.name}
style={{
color: "white",
minWidth: 250,
maxWidth: 250,
padding: boxPadding,
}}
value={pathdata}
onMouseOver={() => {
//console.log("HOVER: ", pathdata);
}}
onClick={() => {
handleItemClick([innerdata, pathdata]);
}}
>
<Tooltip
color="primary"
title={`Ex. value: ${pathdata.value}`}
placement="left"
>
<div style={{ display: "flex", height: 30, }}>
{Array(indentation_count).fill().map((subdata, subindex) => {
return (
<div key={subindex} style={{ marginLeft: 20, height: 30, width: 1, backgroundColor: coverColor, }} />
)
})}
{icon} {newname}
{pathdata.type === "list" ? <SquareFootIcon style={{ marginleft: 10, }} onClick={(e) => {
e.preventDefault()
e.stopPropagation()
return parsedPaths.length > 0 ? (
<NestedMenuItem
key={innerdata.name}
label={
<div style={{ display: "flex", marginLeft: 0, }}>
{icon} {innerdata.name}
</div>
}
parentMenuOpen={!!menuPosition}
style={{
color: "white",
minWidth: 250,
maxWidth: 250,
maxHeight: 50,
overflow: "hidden",
}}
onClick={() => {
console.log(innerdata.example)
console.log("INNER: ", innerdata, pathdata)
// Removing .list from autocomplete
var newname = pathdata.name
if (newname.length > 5) {
newname = newname.slice(0, newname.length - 5)
}
//selectedActionParameters[count].value += `{{ $${innerdata.name}.${newname} | size }}`
//selectedAction.parameters[count].value = selectedActionParameters[count].value;
//setSelectedAction(selectedAction);
//setShowDropdown(false);
setMenuPosition(null);
// innerdata.name
// pathdata.name
//handleItemClick([innerdata, newpathdata])
//console.log("CLICK LENGTH!")
}} /> : null}
</div>
</Tooltip>
</MenuItem>
);
})}
</Paper>
</NestedMenuItem>
) : (
<MenuItem
key={innerdata.name}
style={{
backgroundColor: theme.palette.inputColor,
color: "white",
minWidth: 250,
maxWidth: 250,
marginRight: 0,
}}
value={innerdata}
onMouseOver={() => handleMouseover()}
onMouseOut={() => {
handleMouseOut();
}}
onClick={() => {
handleItemClick([innerdata]);
}}
>
<Tooltip
color="primary"
title={`Value: ${innerdata.value}`}
placement="left"
//const handleClick = (item) => {
handleItemClick([innerdata]);
}}
>
<div style={{ display: "flex" }}>
{icon} {innerdata.name}
</div>
</Tooltip>
</MenuItem>
);
})}
</Menu>
<Paper style={{ minHeight: 550, maxHeight: 550, minWidth: 275, maxWidth: 275, position: "fixed", left: menuPosition1.left - 270, padding: "10px 0px 10px 10px", overflow: "hidden", overflowY: "auto", border: "1px solid rgba(255,255,255,0.3)", }}>
<MenuItem
key={innerdata.name}
style={{
marginLeft: 15,
color: "white",
minWidth: 250,
maxWidth: 250,
padding: 0,
position: "relative",
}}
value={innerdata}
onMouseOver={() => {
//console.log("HOVER: ", pathdata);
}}
onClick={() => {
handleItemClick([innerdata]);
}}
>
<Typography variant="h6" style={{ paddingBottom: 5 }}>
{innerdata.name}
</Typography>
</MenuItem>
{parsedPaths.map((pathdata, index) => {
// FIXME: Should be recursive in here
//<VpnKeyIcon style={iconStyle} />
const icon =
pathdata.type === "value" ? (
<span style={{ marginLeft: 9, }} />
) : pathdata.type === "list" ? (
<FormatListNumberedIcon style={{ marginLeft: 9, marginRight: 10, }} />
) : (
<CircleIcon style={{ marginLeft: 9, marginRight: 10, color: coverColor }} />
);
//<ExpandMoreIcon style={iconStyle} />
const indentation_count = (pathdata.name.match(/\./g) || []).length + 1
//const boxPadding = pathdata.type === "object" ? "10px 0px 0px 0px" : 0
const boxPadding = 0
const namesplit = pathdata.name.split(".")
const newname = namesplit[namesplit.length - 1]
return (
<MenuItem
key={pathdata.name}
style={{
color: "white",
minWidth: 250,
maxWidth: 250,
padding: boxPadding,
}}
value={pathdata}
onMouseOver={() => {
//console.log("HOVER: ", pathdata);
}}
onClick={() => {
handleItemClick([innerdata, pathdata]);
}}
>
<Tooltip
color="primary"
title={`Ex. value: ${pathdata.value}`}
placement="left"
>
<div style={{ display: "flex", height: 30, }}>
{Array(indentation_count).fill().map((subdata, subindex) => {
return (
<div key={subindex} style={{ marginLeft: 20, height: 30, width: 1, backgroundColor: coverColor, }} />
)
})}
{icon} {newname}
{pathdata.type === "list" ? <SquareFootIcon style={{ marginleft: 10, }} onClick={(e) => {
e.preventDefault()
e.stopPropagation()
console.log("INNER: ", innerdata, pathdata)
// Removing .list from autocomplete
var newname = pathdata.name
if (newname.length > 5) {
newname = newname.slice(0, newname.length - 5)
}
//selectedActionParameters[count].value += `{{ $${innerdata.name}.${newname} | size }}`
//selectedAction.parameters[count].value = selectedActionParameters[count].value;
//setSelectedAction(selectedAction);
//setShowDropdown(false);
setMenuPosition(null);
// innerdata.name
// pathdata.name
//handleItemClick([innerdata, newpathdata])
}} /> : null}
</div>
</Tooltip>
</MenuItem>
);
})}
</Paper>
</NestedMenuItem>
) : (
<MenuItem
key={innerdata.name}
style={{
backgroundColor: theme.palette.inputColor,
color: "white",
minWidth: 250,
maxWidth: 250,
marginRight: 0,
}}
value={innerdata}
onMouseOver={() => handleMouseover()}
onMouseOut={() => {
handleMouseOut();
}}
onClick={() => {
handleItemClick([innerdata]);
}}
>
<Tooltip
color="primary"
title={`Value: ${innerdata.value}`}
placement="left"
>
<div style={{ display: "flex" }}>
{icon} {innerdata.name}
</div>
</Tooltip>
</MenuItem>
);
})}
</Menu>
</ButtonGroup>
</div>
}
@@ -1890,8 +1861,7 @@ const CodeEditor = (props) => {
>
<div>
<span style={{ color: "white" }}>
{selectedAction === undefined ? "" : selectedAction.name === "execute_python" || selectedAction.name === "execute_bash" ? "Code to run" : `Expected Output for '${selectedAction.name}'`}
{selectedAction === undefined ? "" : selectedAction.name === "execute_python" || selectedAction.name === "execute_bash" ? "Code to run" : `Expected Output'`}
</span>
</div>
@@ -2055,6 +2025,7 @@ const CodeEditor = (props) => {
variant="outlined"
color="secondary"
onClick={() => {
navigate("")
setExpansionModalOpen(false);
}}
>
@@ -2070,6 +2041,15 @@ const CodeEditor = (props) => {
marginTop: 5,
}}
onClick={(event) => {
/*
const clickedFieldId = "rightside_field_" + fieldCount
const clickedField = document.getElementById(clickedFieldId)
if (clickedField !== undefined && clickedField !== null) {
clickedField.focus()
}
*/
navigate("")
// Take localcodedata through the Shuffle JSON parser just in case
// This is to make it so we don't need to handle these fixes on the
// backend by itself
@@ -2087,7 +2067,7 @@ const CodeEditor = (props) => {
setExpansionModalOpen(false)
} else if (changeActionParameterCodeMirror !== undefined) {
//changeActionParameterCodeMirror(event, fieldCount, fixedcodedata)
changeActionParameterCodeMirror(event, fieldCount, fixedcodedata, actionlist)
changeActionParameterCodeMirror(event, fieldCount, fixedcodedata, actionlist, parameterName)
setExpansionModalOpen(false)
setcodedata(fixedcodedata)
}
@@ -2097,7 +2077,12 @@ const CodeEditor = (props) => {
const foundfield = document.getElementById(fieldname)
if (foundfield !== undefined && foundfield !== null) {
foundfield.value = fixedcodedata
if(selectedTrigger !== undefined && selectedTrigger !== null && selectedTrigger.name === "Shuffle Workflow") {
handleSubflowParamChange(fixedcodedata)
}
}
} else {
//toast("No fieldname found: " + fieldname)
}
setExpansionModalOpen(false)