Minor fixes here and there

This commit is contained in:
Frikky
2025-02-11 02:36:39 +01:00
parent a4f54859a0
commit 10329c6a1a
8 changed files with 301 additions and 116 deletions
+30 -15
View File
@@ -249,6 +249,11 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
} }
const getUsecase = (subcase, index, subindex) => { const getUsecase = (subcase, index, subindex) => {
//console.log("Skipping getUsecase")
// FIXME: Skipping for now as this screws over a lot of the prioritization system
// due to them having "looked at" the usecase.
return
subcase = parseUsecase(subcase) subcase = parseUsecase(subcase)
setPrevSubcase(subcase) setPrevSubcase(subcase)
@@ -490,8 +495,10 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
} }
var canEditApp = userdata !== undefined && (userdata?.admin === "true" || userdata?.id === app?.owner || app?.owner === "" || (userdata?.admin === "true" && userdata?.active_org?.id === app?.reference_org)) || !app?.generated var canEditApp = userdata?.support ||
userdata?.id === app?.owner ||
(userdata?.admin === "true" && userdata?.active_org?.id === app?.reference_org) ||
app?.contributors?.includes(userdata?.id)
return ( return (
<Dialog <Dialog
open={open} open={open}
@@ -533,15 +540,22 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
fontFamily: theme?.typography?.fontFamily fontFamily: theme?.typography?.fontFamily
}} }}
> >
{/*
<Typography component="div" sx={{ fontWeight: 500, color: "#F1F1F1", fontSize: "20px" }}> <Typography component="div" sx={{ fontWeight: 500, color: "#F1F1F1", fontSize: "20px" }}>
About {app?.name.replace(/_/g, ' ').replace(/\b\w/g, char => char.toUpperCase())} About {app?.name.replace(/_/g, ' ').replace(/\b\w/g, char => char.toUpperCase())}
</Typography> </Typography>
*/}
<IconButton <IconButton
onClick={onClose} onClick={onClose}
sx={{ sx={{
color: 'rgba(255, 255, 255, 0.7)', color: 'rgba(255, 255, 255, 0.7)',
'&:hover': { bgcolor: 'rgba(255, 255, 255, 0.1)' } '&:hover': { bgcolor: 'rgba(255, 255, 255, 0.1)' }
}} }}
style={{
position: "absolute",
top: 10,
right: 10,
}}
> >
<CloseIcon /> <CloseIcon />
</IconButton> </IconButton>
@@ -570,9 +584,11 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
flexDirection: "row", flexDirection: "row",
alignItems: "center", alignItems: "center",
}}> }}>
<Typography variant="h5" component="div" sx={{ fontWeight: 600 }}> <a href={isCloud ? "/apps/" + (app?.id || app?.objectID) : `https://shuffler.io/apps/${app?.objectID || app?.id}`} target="_blank" rel="noopener noreferrer" style={{ textDecoration: "none", color: "rgba(255,255,255,0.9)", }}>
{newAppname} <Typography variant="h5" component="div" sx={{ fontWeight: 600 }}>
</Typography> {newAppname}
</Typography>
</a>
<Link <Link
to={isCloud ? "/apps/" + (app?.id || app?.objectID) : `https://shuffler.io/apps/${app?.objectID || app?.id}`} to={isCloud ? "/apps/" + (app?.id || app?.objectID) : `https://shuffler.io/apps/${app?.objectID || app?.id}`}
style={{ textDecoration: "none", color: "#f85a3e", marginTop: "-2px" }} style={{ textDecoration: "none", color: "#f85a3e", marginTop: "-2px" }}
@@ -663,6 +679,7 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
</Tooltip> </Tooltip>
): null} ): null}
{(canEditApp && app?.generated) && (
<Button <Button
variant="contained" variant="contained"
sx={{ sx={{
@@ -676,10 +693,7 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
color: "#fff", color: "#fff",
fontFamily: theme?.typography?.fontFamily fontFamily: theme?.typography?.fontFamily
}} }}
startIcon={canEditApp ? <EditIcon /> : startIcon={canEditApp ? <EditIcon /> : <ForkRightIcon />}
(app?.generated && app?.activated && userdata?.id !== app?.owner && isCloud ?
<ForkRightIcon /> : null
)}
onClick={() => { onClick={() => {
if (canEditApp) { if (canEditApp) {
const editUrl = "/apps/edit/" + (app?.id || app?.objectID); const editUrl = "/apps/edit/" + (app?.id || app?.objectID);
@@ -690,8 +704,9 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
} }
}} }}
> >
{canEditApp ? "Edit" : "Fork"} {canEditApp ? "Edit" : "Fork"}
</Button> </Button>
)}
</div> </div>
</Box> </Box>
@@ -812,13 +827,13 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
marginBottom: "16px", marginBottom: "16px",
fontWeight: 600 fontWeight: 600
}}> }}>
{ {/*
(foundAppUsecase?.srcapp !== undefined && foundAppUsecase?.dstapp !== undefined) ? ( (foundAppUsecase?.srcapp !== undefined && foundAppUsecase?.dstapp !== undefined) ? (
"Connect " + foundAppUsecase?.srcapp?.replaceAll("_", " ") + " to " + foundAppUsecase?.dstapp?.replaceAll("_", " ") "Connect " + foundAppUsecase?.srcapp?.replaceAll("_", " ") + " to " + foundAppUsecase?.dstapp?.replaceAll("_", " ")
) : ( ) : (
"Connect " + app?.name.replaceAll("_", " ") + " to any tool" "Connect " + app?.name.replaceAll("_", " ") + " to any tool"
) )
} */}
</div> </div>
)} )}
@@ -830,7 +845,7 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
alignItems: 'center', alignItems: 'center',
mb: 3 mb: 3
}}> }}>
{usecaseLoading ? ( {/*usecaseLoading ? (
<Stack direction="row" spacing={2} alignItems="center" sx={{ width: '100%' }}> <Stack direction="row" spacing={2} alignItems="center" sx={{ width: '100%' }}>
<Stack direction="row" spacing={-1}> <Stack direction="row" spacing={-1}>
<Skeleton variant="circular" width={32} height={32} /> <Skeleton variant="circular" width={32} height={32} />
@@ -879,7 +894,7 @@ const AppModal = ({ open, onClose, app, globalUrl, getApps }) => {
{foundAppUsecase?.name || "Search for a Usecase"} {foundAppUsecase?.name || "Search for a Usecase"}
</Typography> </Typography>
</> </>
)} )*/}
</Box> </Box>
</div> </div>
+53 -11
View File
@@ -1467,15 +1467,23 @@ const ParsedAction = (props) => {
actionname = "comms" actionname = "comms"
} }
if (isIntegration) { if (isAgent || isIntegration) {
// Check if actionname uppercase is in the parsedDatatypeImages() dictionary // Check if actionname uppercase is in the parsedDatatypeImages() dictionary
if (parsedDatatypeImages()[actionname.toUpperCase()] !== undefined) { if (isAgent) {
var newimage = parsedDatatypeImages()[actionname.toUpperCase()] wrapperapp.large_image = theme.palette.singulBlackWhite
//newimage = <img src={newimage} style={{width: 35, height: 35, marginRight: 5, borderRadius: 5, cursor: "pointer", border: noAppSelected ? "3px solid #86c142" : "2px solid rgba(255,255,255,0.6)"}} /> newimage = wrapperapp.large_image
wrapperapp.large_image = newimage } else if (isIntegration) {
wrapperapp.large_image = theme.palette.singulGreen
newimage = theme.palette.singulGreen
} else { } else {
console.log("Couldn't find actionname: ", actionname) const uppercaseimage = parsedDatatypeImages()[actionname.toUpperCase()]
if (uppercaseimage !== undefined) {
var newimage = uppercaseimage
//newimage = <img src={newimage} style={{width: 35, height: 35, marginRight: 5, borderRadius: 5, cursor: "pointer", border: noAppSelected ? "3px solid #86c142" : "2px solid rgba(255,255,255,0.6)"}} />
wrapperapp.large_image = newimage
} else {
console.log("Couldn't find actionname: ", actionname)
}
} }
} }
@@ -1745,6 +1753,37 @@ const ParsedAction = (props) => {
} }
</Tooltip> </Tooltip>
</IconButton> </IconButton>
{selectedAction?.generated === true && selectedAction?.app_version === "1.0.0" ?
<Button
variant="contained"
color="secondary"
style={{marginLeft: 30, textTransform: "none", }}
onClick={() => {
if (apps === null || apps === undefined || apps?.length === 0) {
toast.error("No apps found. Please refresh the page.")
return
}
const app = apps.find((app) => app.id === selectedAction.app_id)
if (app !== undefined && app !== null) {
//setSelectedApp(app)
if (app.app_version !== undefined && app.app_version !== null && app.app_version !== "1.0.0") {
toast.info(`Upgraded to app version ${app.app_version}`)
selectedAction.app_version = app.app_version
setSelectedAction(selectedAction)
setUpdate(Math.random())
}
} else {
toast.error("No upgrade to be performed for this app. Expected version 1.1.0 available. App rebuild may be available.")
}
}}
>
Upgrade
</Button>
: null}
</div> </div>
</div> </div>
<div style={{ display: "flex", flexDirection: "column" }}> <div style={{ display: "flex", flexDirection: "column" }}>
@@ -2764,6 +2803,7 @@ const ParsedAction = (props) => {
} }
} }
/*
const iconInfo = GetIconInfo(selectedAction) const iconInfo = GetIconInfo(selectedAction)
if (iconInfo !== undefined && iconInfo !== null) { if (iconInfo !== undefined && iconInfo !== null) {
selectedAction.fillGradient = iconInfo.fillGradient selectedAction.fillGradient = iconInfo.fillGradient
@@ -2771,6 +2811,7 @@ const ParsedAction = (props) => {
selectedAction.iconBackground = iconInfo.iconBackgroundColor selectedAction.iconBackground = iconInfo.iconBackgroundColor
selectedAction.fillstyle = "linear-gradient" selectedAction.fillstyle = "linear-gradient"
} }
*/
if (paramIndex === -1) { if (paramIndex === -1) {
console.log("Couldn't find app_name parameter") console.log("Couldn't find app_name parameter")
@@ -2797,13 +2838,14 @@ const ParsedAction = (props) => {
minHeight: 30, minHeight: 30,
maxHeight: 30, maxHeight: 30,
marginRight: 5, marginRight: 25,
marginTop: isIntegration ? 3 : 0,
borderRadius: 5, borderRadius: 5,
cursor: "pointer", cursor: "pointer",
border: noAppSelected ? "3px solid #86c142" : "2px solid rgba(255,255,255,0.6)", border: noAppSelected ? "3px solid #86c142" : "2px solid rgba(255,255,255,0.6)",
paddingLeft: 5, paddingLeft: isAgent || isIntegration ? 0 : 5,
paddingTop: 5, paddingTop: isAgent || isIntegration ? 0 : 5,
}} /> }} />
</div> </div>
</Tooltip> </Tooltip>
@@ -4579,7 +4621,7 @@ const ParsedAction = (props) => {
} }
//console.log("Required fields: ", selectedActionParameters[count]) //console.log("Required fields: ", selectedActionParameters[count])
navigate(`?action_id=${selectedAction.id}&field=${data.name}&action_name=${selectedAction.name}`) navigate(`?action_id=${selectedAction.id}&field=${data.name}&action_name=${selectedAction.name}&app_name=${selectedAction?.label}`)
setEditorData({ setEditorData({
"name": data.name, "name": data.name,
"value": fixExample(parsedvalue), "value": fixExample(parsedvalue),
+77 -21
View File
@@ -53,7 +53,7 @@ import PaperComponent from "../components/PaperComponent.jsx";
import { padding, textAlign } from '@mui/system'; import { padding, textAlign } from '@mui/system';
import data from '../frameworkStyle.jsx'; import data from '../frameworkStyle.jsx';
import { useNavigate, Link, useParams } from "react-router-dom"; import { useNavigate, Link, useParams, useSearchParams } from "react-router-dom";
import { tags as t } from '@lezer/highlight'; import { tags as t } from '@lezer/highlight';
@@ -100,6 +100,7 @@ const pythonFilters = [
const extensions = [] const extensions = []
const CodeEditor = (props) => { const CodeEditor = (props) => {
const { const {
workflow,
globalUrl, globalUrl,
fieldCount, fieldCount,
actionlist, actionlist,
@@ -107,13 +108,14 @@ const CodeEditor = (props) => {
expansionModalOpen, expansionModalOpen,
setExpansionModalOpen, setExpansionModalOpen,
codedata, codedata,
handleActionParamChange,
setcodedata, setcodedata,
isFileEditor, isFileEditor,
runUpdateText, runUpdateText,
toolsAppId, toolsAppId,
parameterName, parameterName,
selectedAction, // selectedAction,
selectedTrigger, // selectedTrigger,
workflowExecutions, workflowExecutions,
getParents, getParents,
activeDialog, activeDialog,
@@ -145,7 +147,8 @@ const CodeEditor = (props) => {
const [currentCharacter, setCurrentCharacter] = React.useState(-1); const [currentCharacter, setCurrentCharacter] = React.useState(-1);
const [currentLine, setCurrentLine] = React.useState(-1); const [currentLine, setCurrentLine] = React.useState(-1);
const [selectedAction, setSelectedAction] = React.useState({});
const [selectedTrigger, setSelectedTrigger] = React.useState({});
const [variableOccurences, setVariableOccurences] = React.useState([]); const [variableOccurences, setVariableOccurences] = React.useState([]);
const [currentLocation, setCurrentLocation] = React.useState([]); const [currentLocation, setCurrentLocation] = React.useState([]);
const [currentVariable, setCurrentVariable] = React.useState(""); const [currentVariable, setCurrentVariable] = React.useState("");
@@ -187,6 +190,33 @@ const CodeEditor = (props) => {
}, [localcodedata]) }, [localcodedata])
let navigate = useNavigate(); let navigate = useNavigate();
const [searchParams] = useSearchParams();
const actionId = searchParams.get('action_id');
const appName = searchParams.get('app_name');
const fieldName = searchParams.get('field');
const triggerId = searchParams.get('trigger_id');
const triggerField = searchParams.get('trigger_field');
const triggerName = searchParams.get('trigger_name');
useEffect(() => {
if (actionId === undefined || actionId === null) {
return;
}
const action = workflow?.actions?.find(action => action.id === actionId);
setlocalcodedata(editorData?.value);
setSelectedAction(action);
}, [actionId, fieldName])
useEffect(() => {
if (triggerId === undefined || triggerId === null) {
return;
}
const trigger = workflow?.triggers?.find(trigger => trigger.id === triggerId);
setlocalcodedata(editorData?.value);
setSelectedTrigger(trigger);
}, [triggerId])
useEffect(() => { useEffect(() => {
var allVariables = [] var allVariables = []
@@ -1364,7 +1394,7 @@ const CodeEditor = (props) => {
console.log("In closer") console.log("In closer")
if (changeActionParameterCodeMirror !== undefined) { if (changeActionParameterCodeMirror !== undefined) {
changeActionParameterCodeMirror({ target: { value: "" } }, fieldCount, localcodedata) changeActionParameterCodeMirror({ target: { value: "" } }, fieldCount, localcodedata, selectedAction, setSelectedAction)
} else { } else {
console.log("No action called changeActionParameterCodeMirror in code editor") console.log("No action called changeActionParameterCodeMirror in code editor")
} }
@@ -2120,7 +2150,7 @@ const CodeEditor = (props) => {
> >
<div> <div>
<span style={{ color: "white" }}> <span style={{ color: "white" }}>
{selectedAction === undefined ? "" : selectedAction.name === "execute_python" || selectedAction.name === "execute_bash" ? "Code to run" : `Output`} {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> </span>
</div> </div>
@@ -2134,12 +2164,28 @@ const CodeEditor = (props) => {
disabled={executing} disabled={executing}
color="primary" color="primary"
style={{ style={{
border: `1px solid ${theme.palette.primary.main}`, border: `1px solid rgba(255, 255, 255, 0.15)`,
position: "absolute", position: "absolute",
top: 24, top: 20,
right: 100, right: 100,
maxHeight: 35, maxHeight: 35,
minWidth: 70, minWidth: 70,
zIndex: 1200,
fontWeight: 500,
fontSize: 14,
backgroundColor: "rgba(33, 33, 33, 0.95)",
backdropFilter: "blur(8px)",
boxShadow: "0 4px 6px rgba(0, 0, 0, 0.1), 0 1px 3px rgba(0, 0, 0, 0.08)",
transition: "all 0.2s ease",
borderRadius: "4px",
"&:hover": {
backgroundColor: "rgba(45, 45, 45, 0.95)",
transform: "translateY(-1px)",
boxShadow: "0 7px 14px rgba(0, 0, 0, 0.12), 0 3px 6px rgba(0, 0, 0, 0.08)",
},
"&:active": {
transform: "translateY(1px)",
}
}} }}
onClick={() => { onClick={() => {
executeSingleAction(expOutput) executeSingleAction(expOutput)
@@ -2148,7 +2194,7 @@ const CodeEditor = (props) => {
{executing ? {executing ?
<CircularProgress style={{ height: 18, width: 18, }} /> <CircularProgress style={{ height: 18, width: 18, }} />
: :
<span>{selectedAction === undefined ? "" : selectedAction.name === "execute_python" ? "Run Python Code" : selectedAction.name === "execute_bash" ? "Run Bash" : "Try it"}<PlayArrowIcon style={{ height: 18, width: 18, marginBottom: -4, marginLeft: 5, }} /> </span> <span>{selectedAction === undefined ? "Try it" : selectedAction.name === "execute_python" ? "Run Python Code" : selectedAction.name === "execute_bash" ? "Run Bash" : "Try it"}<PlayArrowIcon style={{ height: 18, width: 18, marginBottom: -4, marginLeft: 5, }} /> </span>
} }
</Button> </Button>
</Tooltip> </Tooltip>
@@ -2326,22 +2372,32 @@ const CodeEditor = (props) => {
setExpansionModalOpen(false) setExpansionModalOpen(false)
} else if (changeActionParameterCodeMirror !== undefined) { } else if (changeActionParameterCodeMirror !== undefined) {
//changeActionParameterCodeMirror(event, fieldCount, fixedcodedata) //changeActionParameterCodeMirror(event, fieldCount, fixedcodedata)
changeActionParameterCodeMirror(event, fieldCount, fixedcodedata, actionlist, parameterName) changeActionParameterCodeMirror(event, fieldCount, fixedcodedata, actionlist, parameterName, selectedAction, setSelectedAction)
setExpansionModalOpen(false) setExpansionModalOpen(false)
setcodedata(fixedcodedata) setcodedata(fixedcodedata)
} }
// Check if fieldname is set, and try to find and inject the text // console.log("fieldname", fieldname)
if (fieldname !== undefined && fieldname !== null && fieldname.length > 0) { // // Check if fieldname is set, and try to find and inject the text
const foundfield = document.getElementById(fieldname) // if (fieldname !== undefined && fieldname !== null && fieldname.length > 0) {
if (foundfield !== undefined && foundfield !== null) { // const foundfield = document.getElementById(fieldname)
foundfield.value = fixedcodedata // console.log("foundfield", foundfield)
if(selectedTrigger !== undefined && selectedTrigger !== null && selectedTrigger.name === "Shuffle Workflow") { // if (foundfield !== undefined && foundfield !== null) {
handleSubflowParamChange(fixedcodedata) // foundfield.value = fixedcodedata
} // if(selectedTrigger !== undefined && selectedTrigger !== null && selectedTrigger.name === "Shuffle Workflow") {
} // handleSubflowParamChange(fixedcodedata)
} else { // }
//toast("No fieldname found: " + fieldname) // }
// } else {
// //toast("No fieldname found: " + fieldname)
// }
if(actionId !== undefined && actionId !== null && actionId.length > 0) {
handleActionParamChange(actionId, fieldName, fixedcodedata)
}
if(triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
handleSubflowParamChange(triggerId, triggerField, fixedcodedata)
} }
setExpansionModalOpen(false) setExpansionModalOpen(false)
+2 -4
View File
@@ -131,10 +131,8 @@ const data = [
selector: `node[example="noapp"]`, selector: `node[example="noapp"]`,
css: { css: {
// Make background image padding on the left side 20px // Make background image padding on the left side 20px
"background-width": "75%", "background-width": "100%",
"background-height": "75%", "background-height": "100%",
"background-position-x": "17px",
"background-position-y": "17px",
"background-color": "data(iconBackground)", "background-color": "data(iconBackground)",
"background-fill": "data(fillstyle)", "background-fill": "data(fillstyle)",
+3
View File
@@ -76,6 +76,9 @@ const theme = createTheme(adaptV4Theme({
fontSize: 11, fontSize: 11,
}, },
defaultImage: "/images/no_image.png", defaultImage: "/images/no_image.png",
singulOrange: "/images/singul_orange.png",
singulGreen: "/images/singul_green.png",
singulBlackWhite: "/images/singul_black_white.png",
}, },
typography: { typography: {
fontFamily: `"Roboto", "Helvetica", "Arial", "inter", sans-serif`, fontFamily: `"Roboto", "Helvetica", "Arial", "inter", sans-serif`,
+112 -60
View File
@@ -154,8 +154,6 @@ import ExtraApps from "../components/ExtraApps.jsx"
import EditWorkflow from "../components/EditWorkflow.jsx" import EditWorkflow from "../components/EditWorkflow.jsx"
import { act } from "react"; import { act } from "react";
import { Context } from "../context/ContextApi.jsx"; import { Context } from "../context/ContextApi.jsx";
// import AppStats from "../components/AppStats.jsx";
const noImage = "/public/no_image.png";
cytoscape.use(edgehandles); cytoscape.use(edgehandles);
@@ -446,6 +444,7 @@ const AngularWorkflow = (defaultprops) => {
const [historyIndex, setHistoryIndex] = React.useState(history.length); const [historyIndex, setHistoryIndex] = React.useState(history.length);
const [variableInfo, setVariableInfo] = React.useState({}) const [variableInfo, setVariableInfo] = React.useState({})
const [selectedVersion, setSelectedVersion] = React.useState(null) const [selectedVersion, setSelectedVersion] = React.useState(null)
const [selectedTriggerValue, setSelectedTriggerValue] = React.useState("")
const [appAuthentication, setAppAuthentication] = React.useState(undefined); const [appAuthentication, setAppAuthentication] = React.useState(undefined);
const [variablesModalOpen, setVariablesModalOpen] = React.useState(false); const [variablesModalOpen, setVariablesModalOpen] = React.useState(false);
const [aiQueryModalOpen, setAiQueryModalOpen] = React.useState(false) const [aiQueryModalOpen, setAiQueryModalOpen] = React.useState(false)
@@ -572,6 +571,13 @@ const AngularWorkflow = (defaultprops) => {
} }
}, [editWorkflowModalOpen]) }, [editWorkflowModalOpen])
useEffect(() => {
if (selectedTrigger !== undefined && selectedTrigger.parameters !== undefined) {
// Right now just setting for the subflow
setSelectedTriggerValue(selectedTrigger?.parameters[1]?.value)
}
}, [selectedTrigger])
const dragRef = React.useRef(false); const dragRef = React.useRef(false);
@@ -628,11 +634,13 @@ const AngularWorkflow = (defaultprops) => {
"multiselect": true, "multiselect": true,
}, },
] ]
}] }],
large_image: theme.palette.singulBlackWhite,
}, },
{ {
"id": "integration", "id": "integration",
"name": "Singul", "name": "Singul",
"large_image": theme.palette.singulGreen,
"type": "ACTION", "type": "ACTION",
"app_version": "1.0.0", "app_version": "1.0.0",
"loop_versions": ["1.0.0"], "loop_versions": ["1.0.0"],
@@ -9336,14 +9344,16 @@ const AngularWorkflow = (defaultprops) => {
// eslint-disable-next-line react-hooks/exhaustive-deps // eslint-disable-next-line react-hooks/exhaustive-deps
//useEffect(() => { //useEffect(() => {
if (firstrequest) { if (firstrequest) {
setFirstrequest(false); setFirstrequest(false)
getWorkflow(props.match.params.key, {}); getWorkflow(props.match.params.key, {})
getChildWorkflows(props.match.params.key) getChildWorkflows(props.match.params.key)
getRevisionHistory(props.match.params.key) getRevisionHistory(props.match.params.key)
loadTriggers() loadTriggers()
getApps() getApps()
fetchUsecases() fetchUsecases()
getWorkflowExecution(props.match.params.key, "", executionFilter)
setLeftSideBarOpenByClick(false) setLeftSideBarOpenByClick(false)
localStorage.setItem("expandLeftNav", false) localStorage.setItem("expandLeftNav", false)
@@ -14008,23 +14018,25 @@ const AngularWorkflow = (defaultprops) => {
} }
] ]
const handleSubflowParamChange = (value) => { const handleSubflowParamChange = (triggerId, triggerField, newData) => {
if (!workflow?.triggers || !workflow.triggers[selectedTriggerIndex]?.parameters) { if (workflow !== undefined && workflow !== null) {
console.log("Required workflow properties are undefined") // Find the trigger with matching id
return const triggerIndex = workflow?.triggers?.findIndex(trigger => trigger.id === triggerId);
} if (triggerIndex >= 0) {
// Find the parameter with matching name
if (!workflow.triggers[selectedTriggerIndex].parameters[1]) { const paramIndex = workflow.triggers[triggerIndex].parameters?.findIndex(param => param.name === triggerField);
workflow.triggers[selectedTriggerIndex].parameters[1] = { if (paramIndex >= 0) {
name: "execution_argument", // Update the parameter value
value: "" workflow.triggers[triggerIndex].parameters[paramIndex].value = newData;
// Update workflow state to trigger re-render
setWorkflow({...workflow});
setSelectedTriggerValue(newData)
setLastSaved(false);
}
} }
} }
workflow.triggers[selectedTriggerIndex].parameters[1].value = value
setWorkflow(workflow)
setLastSaved(false)
} }
const SubflowSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined || selectedTrigger.trigger_type !== "SUBFLOW" ? null : const SubflowSidebar = Object.getOwnPropertyNames(selectedTrigger).length === 0 || workflow.triggers[selectedTriggerIndex] === undefined || selectedTrigger.trigger_type !== "SUBFLOW" ? null :
@@ -14482,6 +14494,8 @@ const AngularWorkflow = (defaultprops) => {
setActiveDialog("codeeditor") setActiveDialog("codeeditor")
var parsedvalue = workflow?.triggers[selectedTriggerIndex]?.parameters[1]?.value var parsedvalue = workflow?.triggers[selectedTriggerIndex]?.parameters[1]?.value
// Right now Handling subflow only with this
navigate(`?trigger_id=${selectedTrigger.id}&trigger_field=${"argument"}&trigger_name=${selectedTrigger.label}`)
setEditorData({ setEditorData({
"name": workflow.triggers[selectedTriggerIndex].parameters[1].name, "name": workflow.triggers[selectedTriggerIndex].parameters[1].name,
"value": parsedvalue, "value": parsedvalue,
@@ -14531,13 +14545,16 @@ const AngularWorkflow = (defaultprops) => {
fullWidth fullWidth
color="primary" color="primary"
placeholder="Some execution data" placeholder="Some execution data"
defaultValue={ value={
workflow?.triggers[selectedTriggerIndex]?.parameters[1]?.value selectedTriggerValue
} }
onChange={(e) => { onChange={(e) => {
workflow.triggers[selectedTriggerIndex].parameters[1].value = e.target.value
setWorkflow(workflow)
setLastSaved(false) setLastSaved(false)
setSelectedTriggerValue(e.target.value)
}}
onBlur={() => {
workflow.triggers[selectedTriggerIndex].parameters[1].value = selectedTriggerValue
setWorkflow(workflow)
}} }}
/> />
{!showDropdown ? null : {!showDropdown ? null :
@@ -16933,7 +16950,11 @@ const AngularWorkflow = (defaultprops) => {
setLastSaved(false) setLastSaved(false)
}} }}
> >
<EditIcon style={{ position: "absolute", top: 7, height: 20, width: 20, }} /> {workflow.name !== undefined && workflow.name !== null && workflow.name.length > 0 ?
<EditIcon style={{ position: "absolute", top: 7, height: 20, width: 20, }} />
:
null
}
<span style={{ marginLeft: 30, }}>{workflow.name}</span> <span style={{ marginLeft: 30, }}>{workflow.name}</span>
</Typography> </Typography>
{workflowAsCode && ( {workflowAsCode && (
@@ -17055,22 +17076,22 @@ const AngularWorkflow = (defaultprops) => {
> >
Go to parent org workflow Go to parent org workflow
</Button> </Button>
: userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 0 ? : userdata !== undefined && userdata !== null && userdata.orgs !== undefined && userdata.orgs !== null && userdata.orgs.length > 1 && workflow?.id !== undefined && workflow?.id && workflow?.id?.length > 0 ?
<Button <Button
color="secondary" color="secondary"
variant="outlined" variant="outlined"
style={{ style={{
marginTop: 10, marginTop: 10,
marginBottom: 10, marginBottom: 10,
textTransform: "none", textTransform: "none",
marginLeft: 10, marginLeft: 10,
}} }}
onClick={() => { onClick={() => {
setEditWorkflowModalOpen(true) setEditWorkflowModalOpen(true)
}} }}
> >
Enable Suborg Distribution Enable Suborg Distribution
</Button> </Button>
: null : null
: :
@@ -19353,14 +19374,14 @@ const AngularWorkflow = (defaultprops) => {
base_node_name = "exec" base_node_name = "exec"
} }
console.log("COPY: ", base_node_name, copy); //console.log("COPY: ", base_node_name, copy);
//var newitem = JSON.parse(base); //var newitem = JSON.parse(base);
var newitem = validateJson(base).result var newitem = validateJson(base).result
// Check if base_node_name has changed // Check if base_node_name has changed
if (cy !== undefined && cy !== null) { if (cy !== undefined && cy !== null) {
console.log("Change name?") //console.log("Change name?")
//const allNodes = cy.nodes().jsons(); //const allNodes = cy.nodes().jsons();
//for (var key in allNodes) { //for (var key in allNodes) {
//const currentNode = allNodes[key]; //const currentNode = allNodes[key];
@@ -19401,7 +19422,7 @@ const AngularWorkflow = (defaultprops) => {
const elementName = "copy_element_shuffle"; const elementName = "copy_element_shuffle";
var copyText = document.getElementById(elementName); var copyText = document.getElementById(elementName);
if (copyText !== null && copyText !== undefined) { if (copyText !== null && copyText !== undefined) {
console.log("NAVIGATOR: ", navigator); //console.log("NAVIGATOR: ", navigator);
const clipboard = navigator.clipboard; const clipboard = navigator.clipboard;
if (clipboard === undefined) { if (clipboard === undefined) {
toast("Can only copy over HTTPS (port 3443)"); toast("Can only copy over HTTPS (port 3443)");
@@ -19414,7 +19435,7 @@ const AngularWorkflow = (defaultprops) => {
/* Copy the text inside the text field */ /* Copy the text inside the text field */
document.execCommand("copy"); document.execCommand("copy");
console.log("COPYING!"); //console.log("COPYING!");
toast("Copied JSON path to clipboard.") toast("Copied JSON path to clipboard.")
} else { } else {
console.log("Couldn't find element ", elementName); console.log("Couldn't find element ", elementName);
@@ -21539,18 +21560,28 @@ const AngularWorkflow = (defaultprops) => {
textAlign: "center", textAlign: "center",
}} }}
> >
<CircularProgress {isLoaded && workflowDone ?
style={{ <div style={{marginTop: "30vh", }}>
marginTop: "30vh", <Typography variant="body1" color="textSecondary">
height: 35, No workflow to load. Workflow runs may still exist. If you think this is wrong, please contact support@shuffler.io
width: 35, </Typography>
marginLeft: "auto", </div>
marginRight: "auto", :
}} <div>
/> <CircularProgress
<Typography variant="body1" color="textSecondary"> style={{
Loading Workflow marginTop: "30vh",
</Typography> height: 35,
width: 35,
marginLeft: "auto",
marginRight: "auto",
}}
/>
<Typography variant="body1" color="textSecondary">
Loading Workflow
</Typography>
</div>
}
</div> </div>
) : ( ) : (
<span> <span>
@@ -23330,7 +23361,7 @@ const AngularWorkflow = (defaultprops) => {
</div> </div>
</div> </div>
const changeActionParameterCodeMirror = (event, count, data, actionlist, parametername) => { const changeActionParameterCodeMirror = (event, count, data, actionlist, parametername, selectedAction, setSelectedAction) => {
// FIXME: This exists ONLY to make sure focus + blur actually changes the field value // FIXME: This exists ONLY to make sure focus + blur actually changes the field value
// in fields from ParsedAction.jsx such as rightside_field_2 // in fields from ParsedAction.jsx such as rightside_field_2
@@ -23510,6 +23541,25 @@ const AngularWorkflow = (defaultprops) => {
//setUpdate(Math.random()) //setUpdate(Math.random())
} }
const handleActionParamChange = (actionId, fieldName, newData) => {
if (workflow !== undefined) {
// Find the action with matching id
const actionIndex = workflow?.actions.findIndex(action => action.id === actionId);
if (actionIndex >= 0) {
// Find the parameter with matching name
console.log("fieldName", fieldName)
const paramIndex = workflow.actions[actionIndex].parameters.findIndex(param => param.name === fieldName);
if (paramIndex >= 0) {
// Update the parameter value
workflow.actions[actionIndex].parameters[paramIndex].value = newData;
// Update workflow state to trigger re-render
setWorkflow({...workflow});
setLastSaved(false);
}
}
}
}
/* /*
var foundusecase = {} var foundusecase = {}
if (workflow.actions !== undefined && workflow.actions !== null && workflow.actions.length > 0 && userdata !== undefined && userdata !== null && userdata.priorities !== undefined && userdata.priorities !== null && userdata.priorities.length > 0) { if (workflow.actions !== undefined && workflow.actions !== null && workflow.actions.length > 0 && userdata !== undefined && userdata !== null && userdata.priorities !== undefined && userdata.priorities !== null && userdata.priorities.length > 0) {
@@ -23587,19 +23637,21 @@ const AngularWorkflow = (defaultprops) => {
{codeEditorModalOpen ? {codeEditorModalOpen ?
<ShuffleCodeEditor <ShuffleCodeEditor
workflow={workflow}
expansionModalOpen={codeEditorModalOpen} expansionModalOpen={codeEditorModalOpen}
setExpansionModalOpen={setCodeEditorModalOpen} setExpansionModalOpen={setCodeEditorModalOpen}
isCloud={isCloud} isCloud={isCloud}
globalUrl={globalUrl} globalUrl={globalUrl}
workflowExecutions={workflowExecutions} workflowExecutions={workflowExecutions}
getParents={getParents} getParents={getParents}
selectedAction={selectedAction} // selectedAction={selectedAction}
selectedTrigger={selectedTrigger} // selectedTrigger={selectedTrigger}
aiSubmit={aiSubmit} aiSubmit={aiSubmit}
toolsAppId={toolsApp.id} toolsAppId={toolsApp.id}
handleSubflowParamChange={handleSubflowParamChange} handleSubflowParamChange={handleSubflowParamChange}
codedata={editorData.value} codedata={editorData.value}
setcodedata={setcodedata} setcodedata={setcodedata}
handleActionParamChange={handleActionParamChange}
// Not working out of the box // Not working out of the box
parameterName={editorData.name} parameterName={editorData.name}
+22 -3
View File
@@ -28,6 +28,7 @@ import {
Close as CloseIcon, Close as CloseIcon,
Cached as CachedIcon, Cached as CachedIcon,
CloudDownload as CloudDownloadIcon, CloudDownload as CloudDownloadIcon,
ForkRight as ForkRightIcon,
} from "@mui/icons-material"; } from "@mui/icons-material";
import InputAdornment from '@mui/material/InputAdornment'; import InputAdornment from '@mui/material/InputAdornment';
@@ -52,8 +53,13 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
const navigate = useNavigate(); const navigate = useNavigate();
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "localhost:3000"; const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io" || window.location.host === "localhost:3000";
const appUrl = isCloud ? `/apps/${data.id}` : `https://shuffler.io/apps/${data.id}`; const appUrl = isCloud ? `/apps/${data.id}` : `https://shuffler.io/apps/${data.id}`;
var canEditApp = userdata.admin === "true" || userdata.id === data?.owner || data?.owner === "" || (userdata.admin === "true" && userdata.active_org.id === data?.reference_org) || !data?.generated
var canEditApp = userdata?.support ||
userdata?.id === data?.owner ||
(userdata?.admin === "true" && userdata?.active_org?.id === data?.reference_org) ||
data?.contributors?.includes(userdata?.id)
console.log("appdata", data)
const paperStyle = { const paperStyle = {
backgroundColor: mouseHoverIndex === index ? "rgba(26, 26, 26, 1)" : "#212121", backgroundColor: mouseHoverIndex === index ? "rgba(26, 26, 26, 1)" : "#212121",
color: "rgba(241, 241, 241, 1)", color: "rgba(241, 241, 241, 1)",
@@ -183,7 +189,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
))} ))}
</div> </div>
{/* Deactivate button */} {/* Deactivate button */}
{currTab === 0 && !deactivatedIndexes.includes(index) && mouseHoverIndex === index && data.generated === true && ( {(currTab === 0 || currTab === 1) && !deactivatedIndexes.includes(index) && mouseHoverIndex === index && data.generated === true && (
<div style={{ <div style={{
display: "flex", display: "flex",
gap: 8, gap: 8,
@@ -191,7 +197,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
paddingRight: 20 paddingRight: 20
}}> }}>
{ {
canEditApp && ( canEditApp ? (
<button style={{ backgroundColor: "rgba(73, 73, 73, 1)", border: "none", cursor: "pointer", color: "white", borderRadius: 3, display: "flex", alignItems: "center", justifyContent: "center", height: 35 }} <button style={{ backgroundColor: "rgba(73, 73, 73, 1)", border: "none", cursor: "pointer", color: "white", borderRadius: 3, display: "flex", alignItems: "center", justifyContent: "center", height: 35 }}
onClick={(event) => { onClick={(event) => {
event.preventDefault(); event.preventDefault();
@@ -204,6 +210,17 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
> >
<EditIcon /> <EditIcon />
</button> </button>
) : (
<button style={{ backgroundColor: "rgba(73, 73, 73, 1)", border: "none", cursor: "pointer", color: "white", borderRadius: 3, display: "flex", alignItems: "center", justifyContent: "center", height: 35 }}
onClick={(event) => {
event.preventDefault();
event.stopPropagation();
const editUrl = "/apps/new?id=" + data?.id;
navigate(editUrl)
}}
>
<ForkRightIcon />
</button>
) )
} }
<Button <Button
@@ -1844,6 +1861,8 @@ const Apps2 = (props) => {
color: "#FF8544" color: "#FF8544"
} }
console.log("User", userdata)
return ( return (
<div style={{ paddingTop: 70, paddingLeft: leftSideBarOpenByClick ? 200 : 0, transition: "padding-left 0.3s ease", backgroundColor: "#1A1A1A", fontFamily: theme?.typography?.fontFamily, zoom: 0.7, }}> <div style={{ paddingTop: 70, paddingLeft: leftSideBarOpenByClick ? 200 : 0, transition: "padding-left 0.3s ease", backgroundColor: "#1A1A1A", fontFamily: theme?.typography?.fontFamily, zoom: 0.7, }}>
<InstantSearch searchClient={searchClient} indexName="appsearch"> <InstantSearch searchClient={searchClient} indexName="appsearch">
+2 -2
View File
@@ -712,9 +712,9 @@ const Docs = (defaultprops) => {
const newdata = responseJson.reason.replace(imgRegex, '![]($1)').replace(tocRegex, ""); const newdata = responseJson.reason.replace(imgRegex, '![]($1)').replace(tocRegex, "");
setData(newdata); setData(newdata);
if (docId === undefined) { if (docId === undefined) {
document.title = "Shuffle documentation introduction"; document.title = "Shuffle automation documentation";
} else { } else {
document.title = "Shuffle " + docId + " documentation"; document.title = "Shuffle " + docId.replace("_", " ") + " documentation";
} }
if (responseJson.reason !== undefined && responseJson.reason !== null && responseJson.reason.includes("404: Not Found")) { if (responseJson.reason !== undefined && responseJson.reason !== null && responseJson.reason.includes("404: Not Found")) {