Workflow fixes
This commit is contained in:
@@ -72,6 +72,7 @@ const EditWorkflow = (props) => {
|
||||
|
||||
const [submitLoading, setSubmitLoading] = React.useState(false);
|
||||
const [showMoreClicked, setShowMoreClicked] = React.useState(expanded === true ? true : false);
|
||||
|
||||
const [innerWorkflow, setInnerWorkflow] = React.useState(workflow)
|
||||
|
||||
const [newWorkflowTags, setNewWorkflowTags] = React.useState(workflow.tags !== undefined && workflow.tags !== null ? JSON.parse(JSON.stringify(workflow.tags)) : [])
|
||||
@@ -80,6 +81,7 @@ const EditWorkflow = (props) => {
|
||||
const [selectedUsecases, setSelectedUsecases] = React.useState(workflow.usecase_ids !== undefined && workflow.usecase_ids !== null ? JSON.parse(JSON.stringify(workflow.usecase_ids)) : []);
|
||||
const [foundWorkflowId, setFoundWorkflowId] = React.useState("")
|
||||
const [name, setName] = React.useState(workflow.name !== undefined ? workflow.name : "")
|
||||
const [workflowAsCode, setWorkflowAsCode] = React.useState(false)
|
||||
const [dueDate, setDueDate] = React.useState(workflow.due_date !== undefined && workflow.due_date !== null && workflow.due_date !== 0 ? dayjs(workflow.due_date * 1000) : dayjs().subtract(1, 'day'))
|
||||
|
||||
const [inputQuestions, setInputQuestions] = React.useState(workflow.input_questions !== undefined && workflow.input_questions !== null ? JSON.parse(JSON.stringify(workflow.input_questions)) : [])
|
||||
@@ -356,6 +358,7 @@ const EditWorkflow = (props) => {
|
||||
innerWorkflow.usecase_ids,
|
||||
innerWorkflow.blogpost,
|
||||
innerWorkflow.status,
|
||||
workflowAsCode
|
||||
)
|
||||
setWorkflow({})
|
||||
} else {
|
||||
@@ -396,6 +399,7 @@ const EditWorkflow = (props) => {
|
||||
autoFocus
|
||||
fullWidth
|
||||
/>
|
||||
|
||||
<div style={{ display: "flex", marginTop: 10, }}>
|
||||
{usecases !== null && usecases !== undefined && usecases.length > 0 ?
|
||||
<FormControl style={{ flex: 1, marginRight: 5, }}>
|
||||
@@ -1147,11 +1151,26 @@ const EditWorkflow = (props) => {
|
||||
</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)
|
||||
}}
|
||||
/>
|
||||
|
||||
</div>
|
||||
</> : null*/}
|
||||
|
||||
<Tooltip color="primary" title={"Add more details"} placement="top">
|
||||
<Button
|
||||
style={{ margin: "auto", marginTop: 50, marginBottom: 100, textAlign: "center", textTransform: "none", }}
|
||||
style={{ margin: "auto", marginTop: 50, marginBottom: 10, textAlign: "center", textTransform: "none", }}
|
||||
variant="outlined"
|
||||
disabled={newWorkflow === true}
|
||||
color="secondary"
|
||||
@@ -1164,6 +1183,7 @@ const EditWorkflow = (props) => {
|
||||
|
||||
</Button>
|
||||
</Tooltip>
|
||||
|
||||
</div>
|
||||
|
||||
</DialogContent>
|
||||
|
||||
@@ -114,6 +114,7 @@ const CodeEditor = (props) => {
|
||||
editorData,
|
||||
|
||||
setAiQueryModalOpen,
|
||||
fullScreenMode
|
||||
} = props
|
||||
|
||||
const [localcodedata, setlocalcodedata] = React.useState(codedata === undefined || codedata === null || codedata.length === 0 ? "" : codedata);
|
||||
@@ -999,6 +1000,55 @@ const CodeEditor = (props) => {
|
||||
}
|
||||
}
|
||||
|
||||
if (fullScreenMode) {
|
||||
return (
|
||||
<AceEditor
|
||||
mode="python"
|
||||
theme="gruvbox"
|
||||
value={localcodedata}
|
||||
onChange={(value, editor) => {
|
||||
// setlocalcodedata(value)
|
||||
// expectedOutput(value)
|
||||
// highlight_variables(value,editor)
|
||||
setlocalcodedata(value)
|
||||
setcodedata(value)
|
||||
}}
|
||||
name="python-editor"
|
||||
fontSize={14}
|
||||
width="100%"
|
||||
height="100%"
|
||||
showPrintMargin={false}
|
||||
showGutter={true}
|
||||
markers={markers}
|
||||
highlightActiveLine={false}
|
||||
|
||||
enableBasicAutocompletion={true}
|
||||
completers={[customCompleter]}
|
||||
|
||||
style={{
|
||||
wordBreak: "break-word",
|
||||
marginTop: 0,
|
||||
paddingBottom: 10,
|
||||
overflowY: "auto",
|
||||
whiteSpace: "pre-wrap",
|
||||
wordWrap: "break-word",
|
||||
backgroundColor: "rgba(40,40,40,1)",
|
||||
zIndex: activeDialog === "codeeditor" ? 1200 : 1100,
|
||||
}}
|
||||
|
||||
setOptions={{
|
||||
enableBasicAutocompletion: true,
|
||||
enableLiveAutocompletion: true,
|
||||
enableSnippets: true,
|
||||
showLineNumbers: true,
|
||||
tabSize: 4,
|
||||
fontFamily: "'JetBrains Mono', Consolas, monospace",
|
||||
useSoftTabs: true
|
||||
}}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
return (
|
||||
<Dialog
|
||||
aria-labelledby="draggable-dialog-title"
|
||||
@@ -1130,7 +1180,7 @@ const CodeEditor = (props) => {
|
||||
*/}
|
||||
{ isFileEditor ? null :
|
||||
<div style={{display: "flex", maxHeight: 40, }}>
|
||||
{selectedAction.name === "execute_python" ?
|
||||
{selectedAction?.name === "execute_python" ?
|
||||
<Typography variant="body1" style={{marginTop: 5, }}>
|
||||
Run Python Code
|
||||
</Typography>
|
||||
@@ -1300,7 +1350,7 @@ const CodeEditor = (props) => {
|
||||
maxHeight: 650,
|
||||
}}
|
||||
>
|
||||
{actionlist.map((innerdata) => {
|
||||
{actionlist?.map((innerdata) => {
|
||||
const icon =
|
||||
innerdata.type === "action" ? (
|
||||
<AppsIcon style={{ marginRight: 10 }} />
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/* eslint-disable react/no-multi-comp */
|
||||
import React, { useState, useEffect, useLayoutEffect, memo, useMemo, useRef } from "react";
|
||||
import React, { useState, useEffect, useLayoutEffect, memo, useMemo, useRef, useContext } from "react";
|
||||
import ReactDOM from "react-dom"
|
||||
|
||||
import theme from "../theme.jsx";
|
||||
@@ -72,6 +72,8 @@ import {
|
||||
ButtonGroup,
|
||||
} from "@mui/material";
|
||||
|
||||
import CodeIcon from '@mui/icons-material/Code';
|
||||
|
||||
import {
|
||||
Folder as FolderIcon,
|
||||
VerifiedUser as VerifiedUserIcon,
|
||||
@@ -151,6 +153,8 @@ import PaperComponent from "../components/PaperComponent.jsx"
|
||||
import ExtraApps from "../components/ExtraApps.jsx"
|
||||
import EditWorkflow from "../components/EditWorkflow.jsx"
|
||||
import { act } from "react";
|
||||
import { Context } from "../context/ContextApi.jsx";
|
||||
import transitions from "@material-ui/core/styles/transitions.js";
|
||||
// import AppStats from "../components/AppStats.jsx";
|
||||
const noImage = "/public/no_image.png";
|
||||
|
||||
@@ -396,6 +400,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
props.match = {}
|
||||
props.match.params = params
|
||||
|
||||
const { leftSideBarOpenByClick, windowWidth } = useContext(Context)
|
||||
const [workflowAsCode, setWorkflowAsCode] = useState(false);
|
||||
|
||||
var to_be_copied = "";
|
||||
const [firstrequest, setFirstrequest] = React.useState(true);
|
||||
const [cystyle] = useState(cytoscapestyle);
|
||||
@@ -801,6 +808,15 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
})
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
console.log("Loaded workflow: ", workflow)
|
||||
if (workflow.actions?.length == 1) {
|
||||
if (workflow.actions[0].app_id == "3e320a20966d33c9b7e6790b2705f0bf") {
|
||||
setWorkflowAsCode(true);
|
||||
}
|
||||
}
|
||||
}, [workflow]);
|
||||
|
||||
// Event for making sure app is correct
|
||||
useEffect(() => {
|
||||
if (selectedApp === undefined || selectedApp === null && selectedApp.app_name === undefined) {
|
||||
@@ -3227,6 +3243,10 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
cy.add(nodeData)
|
||||
|
||||
if (workflowAsCode) {
|
||||
setWorkflowAsCode(false)
|
||||
}
|
||||
|
||||
// Wait 100ms then add a style for it
|
||||
setTimeout(() => {
|
||||
const node = cy.getElementById(chunkJson.id)
|
||||
@@ -6318,6 +6338,10 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
}
|
||||
}
|
||||
|
||||
if (nodedata.app_id == "3e320a20966d33c9b7e6790b2705f0bf") {
|
||||
setWorkflowAsCode(true);
|
||||
}
|
||||
|
||||
if (nodedata.decorator !== true && nodedata.attachedTo === undefined) {
|
||||
var newdata = JSON.parse(JSON.stringify(nodedata))
|
||||
newdata.large_image = ""
|
||||
@@ -9002,7 +9026,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
});
|
||||
};
|
||||
|
||||
const parsedHeight = isMobile ? bodyHeight - appBarSize * 4 : bodyHeight - appBarSize - 50
|
||||
const parsedHeight = isMobile ? bodyHeight - appBarSize * 4 : userdata?.support ? bodyHeight - 80 : bodyHeight - appBarSize - 50
|
||||
const appViewStyle = {
|
||||
marginLeft: 5,
|
||||
marginRight: 5,
|
||||
@@ -9342,6 +9366,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
minHeight: parsedHeight,
|
||||
maxHeight: parsedHeight,
|
||||
overflow: "hidden",
|
||||
paddingTop: userdata?.support ? 10 : 0,
|
||||
}}
|
||||
>
|
||||
{thisview}
|
||||
@@ -11016,11 +11041,14 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
iterations += 1;
|
||||
}
|
||||
|
||||
|
||||
// Remove on the end as we don't want to remove everything
|
||||
results = results.filter((data) => data.id !== action.id)
|
||||
results = results.filter((data) => data.type === "ACTION" || data.app_name === "Shuffle Workflow" || data.app_name === "User Input")
|
||||
results.push({ label: "Execution Argument", type: "INTERNAL" })
|
||||
|
||||
console.log(results)
|
||||
|
||||
return results
|
||||
}
|
||||
|
||||
@@ -11050,9 +11078,9 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
const minSize = 370
|
||||
var rightsidebarStyle = {
|
||||
position: "fixed",
|
||||
top: appBarSize + 25,
|
||||
top: userdata?.support ? appBarSize - 35 : appBarSize + 25,
|
||||
right: 25,
|
||||
height: "80vh",
|
||||
height: userdata?.support ? "90vh": "80vh",
|
||||
width: isMobile ? "100%" : minSize,
|
||||
minWidth: minSize,
|
||||
maxWidth: 600,
|
||||
@@ -15961,24 +15989,33 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
const cytoscapeViewWidths = isMobile ? 50 : 950;
|
||||
const bottomBarStyle = {
|
||||
position: "fixed",
|
||||
right: isMobile ? 20 : 20,
|
||||
bottom: isMobile ? undefined : 0,
|
||||
top: isMobile ? appBarSize + 55 : undefined,
|
||||
left: isMobile ? undefined : leftBarSize,
|
||||
minWidth: cytoscapeViewWidths,
|
||||
maxWidth: cytoscapeViewWidths,
|
||||
transition: "all 0.3s ease",
|
||||
minWidth: userdata?.support && windowWidth < 1600 && leftSideBarOpenByClick ? 800 : cytoscapeViewWidths,
|
||||
maxWidth: userdata?.support && windowWidth < 1600 && leftSideBarOpenByClick ? 800 : cytoscapeViewWidths,
|
||||
marginLeft: 20,
|
||||
marginBottom: 20,
|
||||
marginBottom: 30,
|
||||
zIndex: 10,
|
||||
transform: isMobile
|
||||
? `translateX(20px)`
|
||||
: `translateX(${userdata?.support
|
||||
? leftSideBarOpenByClick ? 340 : 330
|
||||
: leftBarSize}px)`,
|
||||
top: isMobile ? appBarSize + 55 : undefined,
|
||||
bottom: isMobile ? undefined : 0,
|
||||
};
|
||||
|
||||
const topBarStyle = {
|
||||
position: "fixed",
|
||||
right: 0,
|
||||
left: isMobile ? 20 : leftBarSize + 20,
|
||||
top: isMobile ? 30 : appBarSize + 20,
|
||||
top: isMobile ? 30 : userdata?.support ? appBarSize - 20 : appBarSize + 20,
|
||||
pointerEvents: "none",
|
||||
}
|
||||
transition: "transform 0.3s ease",
|
||||
transform: isMobile
|
||||
? `translateX(20px)`
|
||||
: userdata?.support
|
||||
? `translateX(${leftSideBarOpenByClick ? 340 : 330}px)`
|
||||
: `translateX(${leftBarSize + 20}px)`,
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -16028,6 +16065,26 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
pointerEvents: "none",
|
||||
}}>{workflow.name}</h2>
|
||||
</Breadcrumbs>
|
||||
{workflowAsCode && (
|
||||
<Tooltip title="Switch to Code View">
|
||||
<Button
|
||||
startIcon={<CodeIcon />}
|
||||
variant="outlined"
|
||||
color="secondary"
|
||||
onClick={() => {
|
||||
window.location.href = `/workflows/${workflow.id}/code`
|
||||
}}
|
||||
style={{
|
||||
marginTop: 10,
|
||||
marginLeft: 5,
|
||||
height: 40,
|
||||
pointerEvents: "auto",
|
||||
}}
|
||||
>
|
||||
Build this workflow as code
|
||||
</Button>
|
||||
</Tooltip>
|
||||
)}
|
||||
|
||||
{!distributedFromParent ?
|
||||
isCorrectOrg ? null :
|
||||
@@ -16706,11 +16763,12 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
style={{
|
||||
border: "1px solid rgba(255,255,255,0.1)",
|
||||
position: "absolute",
|
||||
bottom: 130,
|
||||
left: leftBarSize+20,
|
||||
bottom: 140,
|
||||
left: userdata?.support ? leftSideBarOpenByClick ? 620 : 435 : leftBarSize + 20,
|
||||
color: "white",
|
||||
padding: 10,
|
||||
borderRadius: theme.palette?.borderRadius,
|
||||
transition: "left 0.3s ease, top 0.3s ease",
|
||||
}}
|
||||
>
|
||||
|
||||
@@ -20293,7 +20351,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
);
|
||||
|
||||
const newView = (
|
||||
<div style={{ color: "white" }}>
|
||||
<div style={{ color: "white", marginLeft: userdata?.support ? leftSideBarOpenByClick ? 280 : 100 : 0, transition: "margin-left 0.3s ease", }}>
|
||||
<div
|
||||
style={{ display: "flex", borderTop: "1px solid rgba(91, 96, 100, 1)" }}
|
||||
>
|
||||
@@ -20330,7 +20388,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
wheelSensitivity={0.25}
|
||||
style={{
|
||||
width: cytoscapeWidth,
|
||||
height: bodyHeight - appBarSize - 5,
|
||||
height: userdata?.support ? bodyHeight - 20 : bodyHeight - appBarSize - 5,
|
||||
backgroundColor: theme.palette.surfaceColor,
|
||||
}}
|
||||
stylesheet={cystyle}
|
||||
@@ -22225,7 +22283,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
|
||||
const loadedCheck =
|
||||
isLoaded && workflowDone ? (
|
||||
<div>
|
||||
<div style={{overflow:'hidden'}}>
|
||||
{newView}
|
||||
<VariablesModal variableInfo={variableInfo} setVariableInfo={setVariableInfo} />
|
||||
<ExecutionVariableModal variableInfo={variableInfo} setVariableInfo={setVariableInfo} />
|
||||
@@ -22359,7 +22417,7 @@ const releaseToConnectLabel = "Release to Connect"
|
||||
/>
|
||||
</div>
|
||||
) : (
|
||||
<div style={{width: 200, margin: "auto", marginTop: 300, textAlign: "center", }}>
|
||||
<div style={{width: 200, margin: "auto", paddingTop: 300, textAlign: "center", }}>
|
||||
<CircularProgress style={{}} />
|
||||
<Typography variant="body2" color="textSecondary" style={{marginTop: 10, }}>
|
||||
Loading Workflow & Apps...
|
||||
|
||||
@@ -302,7 +302,7 @@ const SetAuthentication = (props) => {
|
||||
}
|
||||
|
||||
return (
|
||||
<div style={{ padding: 50, border: failed === true ? `1px solid ${red}` : "1px solid rgba(255,255,255,0.6)", borderRadius: theme.palette?.borderRadius, width: 500, margin: "auto", marginTop: 50, itemAlign: "center", textAlign: "center",}}>
|
||||
<div style={{ padding: 50, border: failed === true ? `1px solid ${red}` : "1px solid rgba(255,255,255,0.6)", borderRadius: theme.palette?.borderRadius, width: 500, margin: "auto", paddingTop: 50, itemAlign: "center", textAlign: "center",}}>
|
||||
<Typography
|
||||
variant="h4"
|
||||
style={{ marginLeft: "auto", marginRight: "auto", marginTop: 50}}
|
||||
|
||||
@@ -105,13 +105,11 @@ const useStyles = makeStyles(() => {
|
||||
display: "none",
|
||||
},
|
||||
"& .MuiDataGrid-colCell, .MuiDataGrid-cell": {
|
||||
borderRight: `1px solid ${
|
||||
theme?.palette?.type === "light" ? "white" : "#303030"
|
||||
borderRight: `1px solid ${theme?.palette?.type === "light" ? "white" : "#303030"
|
||||
}`,
|
||||
},
|
||||
"& .MuiDataGrid-columnsContainer, .MuiDataGrid-cell": {
|
||||
borderBottom: `1px solid ${
|
||||
theme?.palette?.type === "light" ? "#f0f0f0" : "#303030"
|
||||
borderBottom: `1px solid ${theme?.palette?.type === "light" ? "#f0f0f0" : "#303030"
|
||||
}`,
|
||||
},
|
||||
"& .MuiDataGrid-cell": {
|
||||
@@ -2332,7 +2330,7 @@ const Workflows = (props) => {
|
||||
}}
|
||||
>
|
||||
<Link
|
||||
to={"/workflows/" + data.id}
|
||||
to={data.workflow_as_code ? `/workflows/${data.id}/code` : `/workflows/${data.id}`}
|
||||
style={{ textDecoration: "none", color: "inherit" }}
|
||||
>
|
||||
{parsedName}
|
||||
@@ -2557,6 +2555,7 @@ const Workflows = (props) => {
|
||||
currentUsecases,
|
||||
inputblogpost,
|
||||
inputstatus,
|
||||
workflow_as_code,
|
||||
) => {
|
||||
|
||||
var method = "POST";
|
||||
@@ -2578,6 +2577,10 @@ const Workflows = (props) => {
|
||||
// FIXME: Loop triggers and turn them off?
|
||||
}
|
||||
|
||||
if (workflow_as_code !== undefined && workflow_as_code !== null && workflow_as_code !== "") {
|
||||
workflowdata["workflow_as_code"] = workflow_as_code
|
||||
}
|
||||
|
||||
workflowdata["name"] = name;
|
||||
workflowdata["description"] = description;
|
||||
if (tags !== undefined) {
|
||||
@@ -2587,6 +2590,7 @@ const Workflows = (props) => {
|
||||
workflowdata["blogpost"] = inputblogpost
|
||||
workflowdata["status"] = inputstatus
|
||||
|
||||
|
||||
if (defaultReturnValue !== undefined) {
|
||||
workflowdata["default_return_value"] = defaultReturnValue;
|
||||
}
|
||||
@@ -2629,7 +2633,11 @@ const Workflows = (props) => {
|
||||
|
||||
if (redirect) {
|
||||
//window.location.pathname = "/workflows/" + responseJson["id"];
|
||||
navigate("/workflows/" + responseJson["id"])
|
||||
|
||||
// navigate("/workflows/" + responseJson["id"])
|
||||
navigate(`/workflows/${responseJson["id"]}` + (workflow_as_code ? "/code" : ""))
|
||||
|
||||
// {data.workflow_as_code ? `/workflows/${data.id}/code` : `/workflows/${data.id}`}
|
||||
//setModalOpen(false);
|
||||
} else if (!redirect) {
|
||||
// Update :)
|
||||
@@ -3842,9 +3850,11 @@ const Workflows = (props) => {
|
||||
) : null}
|
||||
|
||||
{userdata.priorities !== undefined && userdata.priorities !== null && userdata.priorities.length > 0 && userdata.priorities[0].name.includes("CPU") && userdata.priorities[0].active === true ?
|
||||
<div style={{border: "1px solid rgba(255,255,255,0.1)" , borderRadius: theme.palette?.borderRadius, marginTop: 10,
|
||||
<div style={{
|
||||
border: "1px solid rgba(255,255,255,0.1)", borderRadius: theme.palette?.borderRadius, marginTop: 10,
|
||||
marginBottom: 10, padding: 15, textAlign: "center", height: 70, textAlign: "left", backgroundColor:
|
||||
theme.palette.surfaceColor, display: "flex" , maxHeight: "105px", minHeight: "110px"}}
|
||||
theme.palette.surfaceColor, display: "flex", maxHeight: "105px", minHeight: "110px"
|
||||
}}
|
||||
>
|
||||
<div style={{ flex: 2, overflow: "hidden", }}>
|
||||
<Typography variant="body1" >
|
||||
|
||||
Reference in New Issue
Block a user