Synced 2.0 fixes for RC6
This commit is contained in:
@@ -71,8 +71,7 @@ const EditWorkflow = (props) => {
|
||||
const [_, setUpdate] = React.useState(""); // Used for rendering, don't remove
|
||||
|
||||
const [submitLoading, setSubmitLoading] = React.useState(false);
|
||||
//const [showMoreClicked, setShowMoreClicked] = React.useState(expanded === true ? true : false);
|
||||
const [showMoreClicked, setShowMoreClicked] = React.useState(true);
|
||||
const [showMoreClicked, setShowMoreClicked] = React.useState(isEditing !== false ? true : false);
|
||||
|
||||
const [innerWorkflow, setInnerWorkflow] = React.useState(workflow)
|
||||
|
||||
@@ -569,12 +568,13 @@ const EditWorkflow = (props) => {
|
||||
<Divider id="mssp_control" style={{ marginTop: 20, marginBottom: 20, }} />
|
||||
|
||||
<Typography variant="h4" style={{ marginTop: 50, }}>
|
||||
MSSP controls
|
||||
MSSP & Distribution controls
|
||||
</Typography>
|
||||
|
||||
<Typography variant="body1" style={{ marginTop: 50, }}>
|
||||
MSSP Suborg Distribution (<b>beta</b> - contact support@shuffler.io for more info)
|
||||
<Typography variant="body2" color="textSecondary" style={{ marginTop: 30, marginBottom: 10, }}>
|
||||
Multi-Tenant Workflows. Make one workflow, and keep a separate, synced copy in all your tenants. Control distributed auth, runtime locations, files, datastore keys etc. (<b>late beta</b> - contact support@shuffler.io if you want a demo. Please try it!)
|
||||
</Typography>
|
||||
|
||||
{userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ?
|
||||
userdata.orgs.filter(org => org.creator_org === userdata.active_org.id).length === 0 ?
|
||||
userdata.active_org.creator_org === undefined || userdata.active_org.creator_org === null || userdata.active_org.creator_org === "" ?
|
||||
@@ -677,15 +677,12 @@ const EditWorkflow = (props) => {
|
||||
</Link>
|
||||
}
|
||||
|
||||
{/*<Divider style={{marginTop: 20, marginBottom: 20, }} />*/}
|
||||
|
||||
|
||||
|
||||
<Typography variant="body1" style={{ marginTop: 100, }}>
|
||||
<Typography variant="body1" style={{ marginTop: 75, }}>
|
||||
Git Backup Repository
|
||||
</Typography>
|
||||
<Typography variant="body2" style={{ textAlign: "left", marginTop: 5, }} color="textSecondary">
|
||||
Decide where this workflow is backed up in a Git repository. Will create logs and notifications if upload fails. <b>The repository and branch must already have been initialized</b>. Files will show up in the root folder in the format 'orgid/workflow status/workflow id.json' without images. Overrides your <a href="/admin?admin_tab=org_config" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">default backup repository</a>. <a href="/docs/configuration#environment-variables" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">Credentials are encrypted.</a> Creates <a href="/admin?admin_tab=notifications" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">notifications</a> if it fails.
|
||||
Decide where this workflow is backed up in a Git repository. Will create logs and notifications if upload fails. <b>The repository and branch must already have been initialized</b>. Files will show up in the root folder in the format 'orgid/workflow status/workflow id.json' and be formatted, with removed images, to make diffing easy. Overrides your <a href="/admin?admin_tab=org_config" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">default backup repository</a>. <a href="/docs/configuration#environment-variables" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">Credentials are encrypted.</a> Creates <a href="/admin?admin_tab=notifications" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">notifications</a> if it fails.
|
||||
</Typography>
|
||||
<Grid container style={{ marginTop: 10, }} spacing={2}>
|
||||
<Grid item xs={6} style={{}}>
|
||||
@@ -1078,122 +1075,106 @@ const EditWorkflow = (props) => {
|
||||
</Select>
|
||||
</FormControl>
|
||||
</div>
|
||||
</div>
|
||||
: null}
|
||||
|
||||
{/*!isEditing ? <>
|
||||
<div style={{ marginTop: 20, }}>
|
||||
<FormControlLabel
|
||||
control={<Checkbox />}
|
||||
label="Create workflow as code"
|
||||
style={{ marginTop: '12px' }}
|
||||
onChange={(e) => {
|
||||
setWorkflowAsCode(e.target.checked)
|
||||
workflow.workflow_as_code = e.target.checked
|
||||
setWorkflow(workflow)
|
||||
setInnerWorkflow(workflow)
|
||||
|
||||
<Typography variant="h4" style={{ marginTop: 100, }}>
|
||||
Publishing
|
||||
</Typography>
|
||||
<Typography variant="body2" color="textSecondary" style={{ marginTop: 10, }}>
|
||||
Publishing is related to making the workflow itself public. When publishing a workflow, all the details (except sensitive info) become available to everyone. The details below will help a user understand this better. When a workflow is published, you keep the original, and a copy enters the workflow search, and is associated with your <a href="/creators" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">creator account</a>, if you have one. You can always unpublish the workflow after. When ready to publish, click the three dots next to a workflow on the main workflow screen. After publishing, you can find it in the Shuffle search engine.
|
||||
</Typography>
|
||||
|
||||
<LocalizationProvider style={{marginLeft: 0, }} dateAdapter={AdapterDayjs}>
|
||||
<DatePicker
|
||||
sx={{
|
||||
marginTop: 3,
|
||||
marginLeft: 3,
|
||||
}}
|
||||
value={dueDate}
|
||||
label="Due Date"
|
||||
format="YYYY-MM-DD"
|
||||
onChange={(newValue) => {
|
||||
setDueDate(newValue)
|
||||
}}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
|
||||
</div>
|
||||
</> : null*/}
|
||||
<FormControl style={{ marginTop: 15, }}>
|
||||
<FormLabel id="demo-row-radio-buttons-group-label">Type</FormLabel>
|
||||
<RadioGroup
|
||||
row
|
||||
aria-labelledby="demo-row-radio-buttons-group-label"
|
||||
name="row-radio-buttons-group"
|
||||
defaultValue={innerWorkflow.workflow_type}
|
||||
onChange={(e) => {
|
||||
console.log("Data: ", e.target.value)
|
||||
|
||||
<Typography variant="h4" style={{ marginTop: 100, }}>
|
||||
Publishing
|
||||
</Typography>
|
||||
<Typography variant="body1" color="textSecondary" style={{ marginTop: 10, }}>
|
||||
Publishing is related to making the workflow itself public. When publishing a workflow, all the details (except sensitive info) become available to everyone. The details below will help a user understand this better. When a workflow is published, you keep the original, and a copy enters the workflow search, and is associated with your <a href="/creators" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">creator account</a>, if you have one. You can always unpublish the workflow after. To publish it, click the three dots next to the workflow.
|
||||
</Typography>
|
||||
innerWorkflow.workflow_type = e.target.value
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
>
|
||||
<FormControlLabel value="trigger" control={<Radio />} label="Trigger" />
|
||||
<FormControlLabel value="subflow" control={<Radio />} label="Subflow" />
|
||||
<FormControlLabel value="standalone" control={<Radio />} label="Standalone" />
|
||||
|
||||
<LocalizationProvider style={{marginLeft: 0, }} dateAdapter={AdapterDayjs}>
|
||||
<DatePicker
|
||||
sx={{
|
||||
marginTop: 3,
|
||||
marginLeft: 3,
|
||||
}}
|
||||
value={dueDate}
|
||||
label="Due Date"
|
||||
format="YYYY-MM-DD"
|
||||
onChange={(newValue) => {
|
||||
setDueDate(newValue)
|
||||
}}
|
||||
/>
|
||||
</LocalizationProvider>
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
|
||||
<FormControl style={{ marginTop: 15, }}>
|
||||
<FormLabel id="demo-row-radio-buttons-group-label">Type</FormLabel>
|
||||
<RadioGroup
|
||||
row
|
||||
aria-labelledby="demo-row-radio-buttons-group-label"
|
||||
name="row-radio-buttons-group"
|
||||
defaultValue={innerWorkflow.workflow_type}
|
||||
onChange={(e) => {
|
||||
console.log("Data: ", e.target.value)
|
||||
|
||||
innerWorkflow.workflow_type = e.target.value
|
||||
<TextField
|
||||
onBlur={(event) => {
|
||||
innerWorkflow.blogpost = event.target.value
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
>
|
||||
<FormControlLabel value="trigger" control={<Radio />} label="Trigger" />
|
||||
<FormControlLabel value="subflow" control={<Radio />} label="Subflow" />
|
||||
<FormControlLabel value="standalone" control={<Radio />} label="Standalone" />
|
||||
|
||||
</RadioGroup>
|
||||
</FormControl>
|
||||
|
||||
|
||||
<TextField
|
||||
onBlur={(event) => {
|
||||
innerWorkflow.blogpost = event.target.value
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
color="primary"
|
||||
defaultValue={innerWorkflow.blogpost}
|
||||
placeholder="A blogpost or other reference for how this work workflow was built, and what it's for."
|
||||
rows="1"
|
||||
label="blogpost"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onBlur={(event) => {
|
||||
innerWorkflow.video = event.target.value
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
color="primary"
|
||||
defaultValue={innerWorkflow.video}
|
||||
placeholder="A youtube or loom link to the video"
|
||||
rows="1"
|
||||
label="Video"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
<Tooltip color="primary" title={"Add more details"} placement="top">
|
||||
<Button
|
||||
style={{ margin: "auto", marginTop: 50, marginBottom: 10, textAlign: "center", textTransform: "none", }}
|
||||
variant="outlined"
|
||||
disabled={newWorkflow === true}
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
setShowMoreClicked(!showMoreClicked);
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
>
|
||||
{showMoreClicked ? <ExpandLessIcon style={{ marginRight: 10, }} /> : <ExpandMoreIcon style={{ marginRight: 10, }} />}
|
||||
{showMoreClicked ? "Less Options" : "More Options"}
|
||||
color="primary"
|
||||
defaultValue={innerWorkflow.blogpost}
|
||||
placeholder="A blogpost or other reference for how this work workflow was built, and what it's for."
|
||||
rows="1"
|
||||
label="blogpost"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
/>
|
||||
<TextField
|
||||
onBlur={(event) => {
|
||||
innerWorkflow.video = event.target.value
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
InputProps={{
|
||||
style: {
|
||||
color: "white",
|
||||
},
|
||||
}}
|
||||
color="primary"
|
||||
defaultValue={innerWorkflow.video}
|
||||
placeholder="A youtube or loom link to the video"
|
||||
rows="1"
|
||||
label="Video"
|
||||
margin="dense"
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
</Button>
|
||||
</Tooltip>
|
||||
<Tooltip color="primary" title={"Add more details"} placement="top">
|
||||
<Button
|
||||
style={{ margin: "auto", marginTop: 50, marginBottom: 10, textAlign: "center", textTransform: "none", }}
|
||||
variant="outlined"
|
||||
disabled={newWorkflow === true}
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
setShowMoreClicked(!showMoreClicked);
|
||||
}}
|
||||
>
|
||||
{showMoreClicked ? <ExpandLessIcon style={{ marginRight: 10, }} /> : <ExpandMoreIcon style={{ marginRight: 10, }} />}
|
||||
{showMoreClicked ? "Less Options" : "More Options"}
|
||||
|
||||
</Button>
|
||||
</Tooltip>
|
||||
</div>
|
||||
: null}
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -524,7 +524,7 @@ useEffect(() => {
|
||||
<Divider style={{ marginBottom: 10, }} />
|
||||
|
||||
<Typography color="textSecondary" align="center" style={{ marginTop: 5, marginBottom: 5, fontSize: 18 }}>
|
||||
Version: 2.0.0-rc5
|
||||
Version: 2.0.0-rc6
|
||||
</Typography>
|
||||
</Menu>
|
||||
</span>
|
||||
@@ -1907,4 +1907,4 @@ useEffect(() => {
|
||||
);
|
||||
};
|
||||
|
||||
export default LeftSideBar;
|
||||
export default LeftSideBar;
|
||||
|
||||
@@ -222,6 +222,10 @@ const ParsedAction = (props) => {
|
||||
return
|
||||
}
|
||||
|
||||
if (selectedApp !== undefined && selectedApp !== null && selectedApp.generated !== true) {
|
||||
return
|
||||
}
|
||||
|
||||
// Fixing required fields with a shitty structure :)
|
||||
if (selectedApp !== undefined && selectedApp !== null && selectedApp.generated === true && selectedAction !== undefined && selectedAction !== null && selectedAction.name !== undefined && selectedAction.name !== null && selectedApp.actions !== undefined && selectedApp.actions !== null && selectedApp.actions.length > 0 && (selectedAction.required_body_fields === undefined || selectedAction.required_body_fields === null || selectedAction.required_body_fields.length === 0)) {
|
||||
// Check for required fields
|
||||
@@ -654,8 +658,8 @@ const ParsedAction = (props) => {
|
||||
const valid = validateJson(execArg);
|
||||
if (valid.valid) {
|
||||
newActionList.push({
|
||||
type: "Execution Argument",
|
||||
name: "Execution Argument",
|
||||
type: "Runtime Argument",
|
||||
name: "Runtime Argument",
|
||||
value: "$exec",
|
||||
highlight: "exec",
|
||||
autocomplete: "exec",
|
||||
@@ -668,11 +672,11 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
// Add default Execution Argument if none were added
|
||||
// Add default Runtime Argument if none were added
|
||||
if (newActionList.length === 0) {
|
||||
newActionList.push({
|
||||
type: "Execution Argument",
|
||||
name: "Execution Argument",
|
||||
type: "Runtime Argument",
|
||||
name: "Runtime Argument",
|
||||
value: "$exec",
|
||||
highlight: "exec",
|
||||
autocomplete: "exec",
|
||||
@@ -749,7 +753,7 @@ const ParsedAction = (props) => {
|
||||
if (parents.length > 1) {
|
||||
const labels = [];
|
||||
for (let parentNode of parents) {
|
||||
if (parentNode.label !== "Execution Argument" && !labels.includes(parentNode.label)) {
|
||||
if (parentNode.label !== "Runtime Argument" && !labels.includes(parentNode.label)) {
|
||||
labels.push(parentNode.label);
|
||||
let exampleData = parentNode.example ?? "";
|
||||
if (!exampleData && workflowExecutions.length > 0) {
|
||||
@@ -1625,15 +1629,17 @@ const ParsedAction = (props) => {
|
||||
//window.open("/apps/${selectedAction.app_id}", "_blank")
|
||||
}}
|
||||
>
|
||||
<Tooltip title={"App: " + selectedAction.app_name} placement="top">
|
||||
<img src={selectedAppIcon} style={{
|
||||
width: 30,
|
||||
height: 30,
|
||||
marginRight: 10,
|
||||
borderRadius: 5,
|
||||
marginTop: 13,
|
||||
border: "2px solid rgba(255,255,255,0.3)",
|
||||
}} />
|
||||
<Tooltip title={"App: " + selectedAction.app_name + ". Click to open in new tab"} placement="top">
|
||||
<a href={"/apps/" + selectedAction?.app_id} target="_blank" style={{ textDecoration: "none", color: "white", }}>
|
||||
<img src={selectedAppIcon} style={{
|
||||
width: 30,
|
||||
height: 30,
|
||||
marginRight: 10,
|
||||
borderRadius: 5,
|
||||
marginTop: 13,
|
||||
border: "2px solid rgba(255,255,255,0.3)",
|
||||
}} />
|
||||
</a>
|
||||
</Tooltip>
|
||||
|
||||
<h3 style={{}}>
|
||||
@@ -1754,7 +1760,7 @@ const ParsedAction = (props) => {
|
||||
</Tooltip>
|
||||
</IconButton>
|
||||
|
||||
{selectedAction?.generated === true && selectedAction?.app_version === "1.0.0" ?
|
||||
{(selectedAction?.generated === true && selectedAction?.app_version === "1.0.0") || (selectedAction?.app_name === "Shuffle Tools" && selectedAction?.app_version !== "1.2.0") ?
|
||||
<Button
|
||||
variant="contained"
|
||||
color="secondary"
|
||||
@@ -1857,6 +1863,7 @@ const ParsedAction = (props) => {
|
||||
}}
|
||||
fullWidth
|
||||
color="primary"
|
||||
disabled={selectedAction?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0}
|
||||
placeholder={selectedAction.label}
|
||||
value={appActionName}
|
||||
onChange={(event) => {
|
||||
@@ -2077,6 +2084,7 @@ const ParsedAction = (props) => {
|
||||
style: theme.palette.innerTextfieldStyle,
|
||||
disableUnderline: true,
|
||||
}}
|
||||
disabled={selectedAction?.parent_controlled === true && workflow?.parentorg_workflow?.length > 0}
|
||||
placeholder={selectedAction.execution_delay}
|
||||
value={delay}
|
||||
onChange={(event) => {
|
||||
@@ -2779,6 +2787,20 @@ const ParsedAction = (props) => {
|
||||
/>
|
||||
) : null}
|
||||
|
||||
{selectedAction?.app_name === "Shuffle AI" && selectedAction?.name === "run_llm" ?
|
||||
selectedAction?.environment === "Cloud" && isCloud ? (
|
||||
<Typography color="textSecondary" variant="body2" style={{ paddingTop: 25, }}>
|
||||
Info: Cloud Inference processing runs with Shuffle's GPUs in EU, Netherlands, and may be unstable. Your data is NOT stored there.
|
||||
</Typography>
|
||||
)
|
||||
:
|
||||
<Typography color="textSecondary" variant="body2" style={{ paddingTop: 25, color: red, }}>
|
||||
This action is slow without GPU's. Use Shuffle's Cloud Runtime location for faster processing.
|
||||
</Typography>
|
||||
:
|
||||
null
|
||||
}
|
||||
|
||||
<div
|
||||
style={{
|
||||
marginTop: "10px",
|
||||
@@ -4251,7 +4273,7 @@ const ParsedAction = (props) => {
|
||||
};
|
||||
|
||||
const handleMouseover = () => {
|
||||
if (innerdata.type === "Execution Argument") {
|
||||
if (innerdata.type === "Runtime Argument") {
|
||||
handleExecArgumentHover(true);
|
||||
} else if (innerdata.type === "action") {
|
||||
handleActionHover(true, innerdata.id);
|
||||
@@ -4259,7 +4281,7 @@ const ParsedAction = (props) => {
|
||||
};
|
||||
|
||||
const handleMouseOut = () => {
|
||||
if (innerdata.type === "Execution Argument") {
|
||||
if (innerdata.type === "Runtime Argument") {
|
||||
handleExecArgumentHover(false);
|
||||
} else if (innerdata.type === "action") {
|
||||
handleActionHover(false, innerdata.id);
|
||||
|
||||
@@ -2,6 +2,7 @@ import React, { useState, useEffect, useContext, memo } from "react";
|
||||
|
||||
import { toast } from "react-toastify";
|
||||
import theme from "../theme.jsx";
|
||||
import { v4 as uuidv4, v5 as uuidv5, validate as isUUID, } from "uuid";
|
||||
import {
|
||||
Paper,
|
||||
Tooltip,
|
||||
@@ -16,7 +17,13 @@ import {
|
||||
Autocomplete,
|
||||
TextField,
|
||||
MenuItem,
|
||||
IconButton,
|
||||
} from "@mui/material";
|
||||
|
||||
import {
|
||||
OpenInNew as OpenInNewIcon,
|
||||
} from "@mui/icons-material";
|
||||
|
||||
import { makeStyles } from "@mui/styles";
|
||||
import { Context } from "../context/ContextApi.jsx";
|
||||
|
||||
@@ -355,6 +362,7 @@ const Priorities = memo((props) => {
|
||||
<Typography style={{ color: "rgba(158, 158, 158, 1)", fontSize: 16, fontWeight: 400, marginTop: 5, }}>
|
||||
The notification workflow triggers when an error occurs in one of your workflows. Each individual one will only start a workflow once every 2 minutes. <b>You can point child org notifications into the parent org notification by choosing it in the list.</b>
|
||||
</Typography>
|
||||
|
||||
<div style={{ display: "flex", flexDirection: "row", alignItems: "center", }}>
|
||||
|
||||
{workflows !== undefined && workflows !== null && workflows.length > 0 ?
|
||||
@@ -538,6 +546,59 @@ const Priorities = memo((props) => {
|
||||
</div> */}
|
||||
</div>
|
||||
|
||||
{notificationWorkflow === undefined || notificationWorkflow === null || notificationWorkflow.length === 0 ? null :
|
||||
<div>
|
||||
<Button variant="outlined" color="secondary" style={{marginTop: 5, textTransform: "none", }} onClick={() => {
|
||||
if (notificationWorkflow === "parent") {
|
||||
toast.error("Can't send test notifications to the parent org's notification workflow.")
|
||||
return
|
||||
}
|
||||
|
||||
fetch(`${globalUrl}/api/v1/workflows/${notificationWorkflow}/execute`, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Accept": "application/json",
|
||||
},
|
||||
credentials: "include",
|
||||
body: JSON.stringify({
|
||||
"title": "Test Notification",
|
||||
"description": "This is a test notification to check if the notification workflow is working correctly.",
|
||||
"org_id": selectedOrganization.id,
|
||||
"id": uuidv4(),
|
||||
"reference_url": "/admin?type=test&admin_tab=notifications",
|
||||
"created_at": Math.floor(new Date().getTime() / 1000),
|
||||
"updated_at": Math.floor(new Date().getTime() / 1000),
|
||||
})
|
||||
})
|
||||
.then((response) => {
|
||||
if (response.status === 200) {
|
||||
toast.success("Test notification sent successfully.")
|
||||
} else {
|
||||
toast.error("Failed to send test notification. Please contact support if this persists")
|
||||
}
|
||||
}).catch((error) => {
|
||||
toast.error("Failed to send test notification (2). Please contact support if this persists")
|
||||
})
|
||||
}}>
|
||||
Send test notification
|
||||
</Button>
|
||||
<IconButton
|
||||
style={{marginLeft: 10, }}
|
||||
onClick={() => {
|
||||
if (notificationWorkflow === "parent") {
|
||||
toast.error("Can't open parent org's notification workflow from here.")
|
||||
return
|
||||
}
|
||||
|
||||
window.open(`/workflows/${notificationWorkflow}?view=executions`, "_blank")
|
||||
}}
|
||||
>
|
||||
<OpenInNewIcon color="primary" />
|
||||
</IconButton>
|
||||
</div>
|
||||
}
|
||||
|
||||
<Typography style={{marginTop: 50, fontSize: 24, fontWeight: 'bold', display: clickedFromOrgTab?null:"inline", marginBottom: clickedFromOrgTab? 8:null, color: clickedFromOrgTab?"#ffffff":null }}>Notifications ({
|
||||
notifications?.filter((notification) => showRead === true || notification.read === false).length
|
||||
})</Typography>
|
||||
|
||||
@@ -44,6 +44,7 @@ import {
|
||||
Close as CloseIcon,
|
||||
DragIndicator as DragIndicatorIcon,
|
||||
RestartAlt as RestartAltIcon,
|
||||
ArrowForward as ArrowForwardIcon,
|
||||
} from '@mui/icons-material';
|
||||
|
||||
|
||||
@@ -100,6 +101,7 @@ const pythonFilters = [
|
||||
const extensions = []
|
||||
const CodeEditor = (props) => {
|
||||
const {
|
||||
cy,
|
||||
workflow,
|
||||
globalUrl,
|
||||
fieldCount,
|
||||
@@ -116,6 +118,7 @@ const CodeEditor = (props) => {
|
||||
parameterName,
|
||||
// selectedAction,
|
||||
// selectedTrigger,
|
||||
selectedEdge,
|
||||
workflowExecutions,
|
||||
getParents,
|
||||
activeDialog,
|
||||
@@ -128,6 +131,8 @@ const CodeEditor = (props) => {
|
||||
fullScreenMode,
|
||||
environment,
|
||||
fixExample,
|
||||
userdata,
|
||||
handleConditionFieldChange,
|
||||
} = props
|
||||
|
||||
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
|
||||
@@ -149,6 +154,7 @@ const CodeEditor = (props) => {
|
||||
const [currentLine, setCurrentLine] = React.useState(-1);
|
||||
const [selectedAction, setSelectedAction] = React.useState({});
|
||||
const [selectedTrigger, setSelectedTrigger] = React.useState({});
|
||||
const [selectedCondition, setSelectedCondition] = React.useState({});
|
||||
const [variableOccurences, setVariableOccurences] = React.useState([]);
|
||||
const [currentLocation, setCurrentLocation] = React.useState([]);
|
||||
const [currentVariable, setCurrentVariable] = React.useState("");
|
||||
@@ -197,6 +203,8 @@ const CodeEditor = (props) => {
|
||||
const triggerId = searchParams.get('trigger_id');
|
||||
const triggerField = searchParams.get('trigger_field');
|
||||
const triggerName = searchParams.get('trigger_name');
|
||||
const conditionId = searchParams.get('condition_id');
|
||||
const conditionField = searchParams.get('field');
|
||||
|
||||
useEffect(() => {
|
||||
if (actionId === undefined || actionId === null) {
|
||||
@@ -206,6 +214,9 @@ const CodeEditor = (props) => {
|
||||
const action = workflow?.actions?.find(action => action.id === actionId);
|
||||
setlocalcodedata(editorData?.value);
|
||||
setSelectedAction(action);
|
||||
|
||||
// Update available variables when action changes
|
||||
updateAvailableVariables(actionlist);
|
||||
}, [actionId, fieldName])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -216,16 +227,33 @@ const CodeEditor = (props) => {
|
||||
const trigger = workflow?.triggers?.find(trigger => trigger.id === triggerId);
|
||||
setlocalcodedata(editorData?.value);
|
||||
setSelectedTrigger(trigger);
|
||||
|
||||
// Update available variables when trigger changes
|
||||
updateAvailableVariables(actionlist);
|
||||
}, [triggerId])
|
||||
|
||||
useEffect(() => {
|
||||
var allVariables = []
|
||||
var tmpVariables = []
|
||||
|
||||
useEffect(() => {
|
||||
if (conditionId === undefined || conditionId === null) {
|
||||
return;
|
||||
}
|
||||
|
||||
const condition = selectedEdge?.conditions?.find(condition => condition.id === conditionId);
|
||||
setlocalcodedata(editorData?.value);
|
||||
setSelectedCondition(condition);
|
||||
// Update available variables when condition changes
|
||||
updateAvailableVariables(actionlist);
|
||||
}, [conditionId, fieldName])
|
||||
|
||||
// Extract variable updating logic into a separate function
|
||||
const updateAvailableVariables = (actionlist) => {
|
||||
if (actionlist === undefined || actionlist === null) {
|
||||
return
|
||||
}
|
||||
|
||||
var allVariables = []
|
||||
var tmpVariables = []
|
||||
|
||||
for (var i = 0; i < actionlist.length; i++) {
|
||||
allVariables.push('$' + actionlist[i].autocomplete.toLowerCase())
|
||||
tmpVariables.push('$' + actionlist[i].autocomplete.toLowerCase())
|
||||
@@ -265,7 +293,11 @@ const CodeEditor = (props) => {
|
||||
|
||||
setAvailableVariables(allVariables)
|
||||
setMainVariables(tmpVariables)
|
||||
expectedOutput(localcodedata)
|
||||
}
|
||||
|
||||
// Remove the original useEffect for actionlist since we'll update on action/trigger changes
|
||||
useEffect(() => {
|
||||
updateAvailableVariables(actionlist)
|
||||
}, [])
|
||||
|
||||
useEffect(() => {
|
||||
@@ -1378,6 +1410,18 @@ const CodeEditor = (props) => {
|
||||
)
|
||||
}
|
||||
|
||||
var sourceAction = ""
|
||||
var targetAction = ""
|
||||
var sourceImage = ""
|
||||
var targetImage = ""
|
||||
|
||||
if (cy !== undefined && cy !== null) {
|
||||
sourceAction = cy.getElementById(selectedEdge?.source)
|
||||
targetAction = cy.getElementById(selectedEdge?.target)
|
||||
sourceImage = sourceAction?.data()?.large_image
|
||||
targetImage = targetAction?.data()?.large_image
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
aria-labelledby="draggable-dialog-title"
|
||||
@@ -1601,25 +1645,25 @@ const CodeEditor = (props) => {
|
||||
{isFileEditor ? null :
|
||||
<div style={{ display: "flex", maxHeight: 40, }}>
|
||||
<ButtonGroup style={{ borderRadius: theme.palette.borderRadius, }}>
|
||||
{/*
|
||||
<Button
|
||||
id="basic-button"
|
||||
aria-haspopup="true"
|
||||
aria-controls={!!menuPosition ? 'basic-menu' : undefined}
|
||||
aria-expanded={!!menuPosition ? 'true' : undefined}
|
||||
variant={!sourceDataOpen ? "contained" : "outlined"}
|
||||
color="secondary"
|
||||
style={{
|
||||
textTransform: "none",
|
||||
width: 175,
|
||||
}}
|
||||
onClick={(event) => {
|
||||
setSourceDataOpen(!sourceDataOpen)
|
||||
}}
|
||||
>
|
||||
<AddIcon /> Show Source Data
|
||||
</Button>
|
||||
*/}
|
||||
{userdata !== undefined && userdata !== null && userdata.support === true ?
|
||||
<Button
|
||||
id="basic-button"
|
||||
aria-haspopup="true"
|
||||
aria-controls={!!menuPosition ? 'basic-menu' : undefined}
|
||||
aria-expanded={!!menuPosition ? 'true' : undefined}
|
||||
variant={!sourceDataOpen ? "contained" : "outlined"}
|
||||
color="secondary"
|
||||
style={{
|
||||
textTransform: "none",
|
||||
width: 175,
|
||||
}}
|
||||
onClick={(event) => {
|
||||
setSourceDataOpen(!sourceDataOpen)
|
||||
}}
|
||||
>
|
||||
<AddIcon /> Show Source Data
|
||||
</Button>
|
||||
: null}
|
||||
|
||||
<Button
|
||||
id="basic-button"
|
||||
@@ -2149,9 +2193,64 @@ const CodeEditor = (props) => {
|
||||
}}
|
||||
>
|
||||
<div>
|
||||
<span style={{ color: "white" }}>
|
||||
{actionId === null ? `Output : ${triggerName?.replaceAll("_", " ").slice(0, 1).toUpperCase() + triggerName?.replaceAll("_", " ").slice(1)}` : selectedAction.name === "execute_python" || selectedAction.name === "execute_bash" ? "Code to run" : `Output : ${appName?.replaceAll("_", " ").slice(0, 1).toUpperCase() + appName?.replaceAll("_", " ").slice(1)}(${fieldName})`}
|
||||
</span>
|
||||
{actionId === null && triggerId === null ?
|
||||
<div style={{display: "flex", alignItems: "center"}}>
|
||||
{`Condition ${selectedEdge?.conditions?.findIndex(cond => cond.condition.id === conditionId) + 1 || "0"}`}
|
||||
{/* Source node image */}
|
||||
{selectedEdge?.source ?
|
||||
<img
|
||||
src={sourceImage || ""}
|
||||
alt="Source"
|
||||
style={{
|
||||
width: 30,
|
||||
height: 30,
|
||||
marginRight: 10,
|
||||
borderRadius: "50%",
|
||||
marginLeft: 10,
|
||||
border: conditionField === "source" ? `3px solid #FF8544` : null,
|
||||
}}
|
||||
/>
|
||||
: null
|
||||
}
|
||||
|
||||
{/* Add arrow icon */}
|
||||
{
|
||||
selectedEdge && Object.keys(selectedEdge).length > 0 ?
|
||||
<ArrowForwardIcon style={{
|
||||
color: "rgba(255,255,255,0.7)",
|
||||
fontSize: 18,
|
||||
marginLeft: -5,
|
||||
marginRight: -5,
|
||||
}} />
|
||||
: null
|
||||
}
|
||||
|
||||
{/* Destination node image */}
|
||||
{selectedEdge?.target ?
|
||||
<img
|
||||
src={targetImage || ""}
|
||||
alt="Destination"
|
||||
style={{
|
||||
width: 30,
|
||||
height: 30,
|
||||
marginLeft: 10,
|
||||
borderRadius: "50%",
|
||||
border: conditionField === "destination" ? `3px solid #FF8544` : null,
|
||||
}}
|
||||
/>
|
||||
: null
|
||||
}
|
||||
</div>
|
||||
:
|
||||
<span style={{ color: "white" }}>
|
||||
{selectedAction.name === "execute_python" || selectedAction.name === "execute_bash" ?
|
||||
"Code to run" :
|
||||
triggerId ?
|
||||
`Output : ${triggerName?.replaceAll("_", " ").slice(0, 1).toUpperCase() + triggerName?.replaceAll("_", " ").slice(1)}(${triggerField})` :
|
||||
`Output : ${appName?.replaceAll("_", " ").slice(0, 1).toUpperCase() + appName?.replaceAll("_", " ").slice(1)}(${fieldName})`
|
||||
}
|
||||
</span>
|
||||
}
|
||||
</div>
|
||||
|
||||
</DialogTitle>
|
||||
@@ -2369,34 +2468,22 @@ const CodeEditor = (props) => {
|
||||
if (isFileEditor === true) {
|
||||
runUpdateText(fixedcodedata);
|
||||
setcodedata(fixedcodedata);
|
||||
setExpansionModalOpen(false)
|
||||
} else if (changeActionParameterCodeMirror !== undefined) {
|
||||
//changeActionParameterCodeMirror(event, fieldCount, fixedcodedata)
|
||||
changeActionParameterCodeMirror(event, fieldCount, fixedcodedata, actionlist, parameterName, selectedAction, setSelectedAction)
|
||||
setExpansionModalOpen(false)
|
||||
setcodedata(fixedcodedata)
|
||||
}
|
||||
|
||||
// console.log("fieldname", fieldname)
|
||||
// // Check if fieldname is set, and try to find and inject the text
|
||||
// if (fieldname !== undefined && fieldname !== null && fieldname.length > 0) {
|
||||
// const foundfield = document.getElementById(fieldname)
|
||||
// console.log("foundfield", foundfield)
|
||||
// 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)
|
||||
// }
|
||||
|
||||
if(actionId !== undefined && actionId !== null && actionId.length > 0) {
|
||||
// Handle condition fields
|
||||
if (conditionField !== null && handleConditionFieldChange !== undefined) {
|
||||
handleConditionFieldChange(conditionField, fieldName, fixedcodedata);
|
||||
}
|
||||
// Handle action fields
|
||||
else if (actionId !== undefined && actionId !== null && actionId.length > 0) {
|
||||
handleActionParamChange(actionId, fieldName, fixedcodedata)
|
||||
}
|
||||
|
||||
if(triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
|
||||
// Handle trigger fields
|
||||
else if (triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
|
||||
handleSubflowParamChange(triggerId, triggerField, fixedcodedata)
|
||||
}
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ const theme = createTheme(adaptV4Theme({
|
||||
contrastText: "#000000",
|
||||
},
|
||||
text: {
|
||||
secondary: "rgba(255,255,255,0.7)",
|
||||
secondary: "rgba(255,255,255,0.8)",
|
||||
},
|
||||
type: "dark",
|
||||
//inputColor: "#383B40",
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -59,7 +59,6 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
|
||||
(userdata?.admin === "true" && userdata?.active_org?.id === data?.reference_org) ||
|
||||
data?.contributors?.includes(userdata?.id)
|
||||
|
||||
console.log("appdata", data)
|
||||
const paperStyle = {
|
||||
backgroundColor: mouseHoverIndex === index ? "rgba(26, 26, 26, 1)" : "#212121",
|
||||
color: "rgba(241, 241, 241, 1)",
|
||||
|
||||
@@ -184,15 +184,15 @@ export const CodeHandler = (props) => {
|
||||
if (validate.valid === false) {
|
||||
// Check if https://shuffler.io in the url
|
||||
// if so, then we change it for the current url
|
||||
if (propvalue.includes("https://shuffler.io")) {
|
||||
newprop = propvalue.replace("https://shuffler.io", window.location.origin)
|
||||
}
|
||||
if (propvalue.includes("https://shuffler.io/api")) {
|
||||
newprop = propvalue.replace("https://shuffler.io/api", window.location.origin+"/api")
|
||||
|
||||
// Check if it contains Bearer APIKEY
|
||||
// If so, replace apikey
|
||||
//if (newprop.includes("Bearer APIKEY")) {
|
||||
// newprop = newprop.replace("Bearer APIKEY", "Bearer API
|
||||
//}
|
||||
|
||||
const foundurl = localStorage.getItem("globalUrl")
|
||||
if (foundurl !== undefined && foundurl !== null && foundurl !== "") {
|
||||
newprop = propvalue.replace("https://shuffler.io/api", foundurl+"/api")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Need to check if it's singletick or multi
|
||||
|
||||
@@ -1187,32 +1187,32 @@ const Workflows2 = (props) => {
|
||||
"",
|
||||
data.status,
|
||||
)
|
||||
.then((response) => {
|
||||
if (response !== undefined) {
|
||||
// SET THE FULL THING
|
||||
data.id = response.id;
|
||||
.then((response) => {
|
||||
if (response !== undefined) {
|
||||
// SET THE FULL THING
|
||||
data.id = response.id;
|
||||
|
||||
// Actually create it
|
||||
setNewWorkflow(
|
||||
data.name,
|
||||
data.description,
|
||||
data.tags,
|
||||
data.default_return_value,
|
||||
data,
|
||||
false,
|
||||
[],
|
||||
"",
|
||||
data.status
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
toast(`Successfully imported ${data.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
// Actually create it
|
||||
setNewWorkflow(
|
||||
data.name,
|
||||
data.description,
|
||||
data.tags,
|
||||
data.default_return_value,
|
||||
data,
|
||||
false,
|
||||
[],
|
||||
"",
|
||||
data.status
|
||||
).then((response) => {
|
||||
if (response !== undefined) {
|
||||
toast(`Successfully imported ${data.name}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.catch((error) => {
|
||||
toast("Import error: " + error.toString());
|
||||
});
|
||||
});
|
||||
} catch (e) {
|
||||
console.log("Error in dropzone: ", e);
|
||||
@@ -2875,6 +2875,7 @@ const Workflows2 = (props) => {
|
||||
if (editingWorkflow.id !== undefined) {
|
||||
console.log("Building original workflow");
|
||||
method = "PUT";
|
||||
//extraData = "/" + editingWorkflow.id + "?skip_save=true";
|
||||
extraData = "/" + editingWorkflow.id + "?skip_save=true";
|
||||
workflowdata = editingWorkflow;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user