Minor fixes everywhere

This commit is contained in:
Frikky
2025-04-01 22:33:25 +02:00
parent fdb321a147
commit ff6b970aef
15 changed files with 791 additions and 456 deletions
+14 -11
View File
@@ -4316,9 +4316,15 @@ const AngularWorkflow = (defaultprops) => {
var sessionToken = new URLSearchParams(cursearch).get("session_token");
if (execFound === null && sessionToken === null) {
toast.error(`You don't have access to this workflow or loading failed. Redirecting to workflows in a few seconds. If you recently deleted this workflow, speak with support@shuffler.io to recover it from a revision.`, {
autoClose: 10000,
})
if (isCloud) {
toast.error(`You don't have access to this workflow or loading failed. Redirecting to workflows in a few seconds. If you recently deleted this workflow, speak with support@shuffler.io to recover it from a revision.`, {
autoClose: 10000,
})
} else {
toast.error(`You don't have access to this workflow or loading failed. Redirecting to workflows in a few seconds. Contact support@shuffler.io if this is unexpected.`, {
autoClose: 10000,
})
}
setTimeout(() => {
window.location.pathname = "/workflows";
@@ -7659,7 +7665,6 @@ const AngularWorkflow = (defaultprops) => {
};
const handlePaste = (event) => {
console.log("PASTE EVENT: ", event)
if (event.path !== undefined && event.path !== null && event.path.length > 0) {
if (event.path[0].localName !== "body") {
console.log("Skipping paste because body is not targeted")
@@ -7667,15 +7672,13 @@ const AngularWorkflow = (defaultprops) => {
}
}
console.log("Paste target: ", event?.target)
/*
if (event.target !== undefined && event.target !== null) {
if (event.target.localName !== "body") {
console.log("Skipping paste because body is not targeted (2). Target: ", event?.target?.localName)
return;
}
// If it's an input area, skip paste
if (event.target.localName === "input" || event.target.localName === "textarea") {
console.log("Skipping paste because body is not targeted (1). Target: ", event?.target?.localName)
return;
}
}
*/
// Does this stop things?
//event.preventDefault()
+7 -4
View File
@@ -1114,6 +1114,7 @@ const Docs = (defaultprops) => {
marginTop: 25,
}
const showPartnerLogo = userdata?.org_status?.includes("integration_partner") && userdata?.active_org?.image !== undefined && userdata?.active_org?.image !== null && userdata?.active_org?.image.length > 0
const mainpageInfo =
<div style={{
color: "rgba(255, 255, 255, 0.65)",
@@ -1129,10 +1130,12 @@ const Docs = (defaultprops) => {
<Typography variant="h4" style={{ textAlign: "center", marginTop: 20 }}>
Documentation
</Typography>
<div style={{ display: "flex", marginTop: 25, }}>
<CustomButton title="Talk to Support" icon=<img src="/images/Shuffle_logo_new.png" style={{ height: 35, width: 35, border: "", borderRadius: theme.palette?.borderRadius, }} /> />
<CustomButton title="Ask the community" icon=<img src="/images/social/discord.png" style={{ height: 35, width: 35, border: "", borderRadius: theme.palette?.borderRadius, }} /> link="https://discord.gg/B2CBzUm" />
</div>
{showPartnerLogo === true ? null :
<div style={{ display: "flex", marginTop: 25, }}>
<CustomButton title="Talk to Support" icon=<img src="/images/Shuffle_logo_new.png" style={{ height: 35, width: 35, border: "", borderRadius: theme.palette?.borderRadius, }} /> />
<CustomButton title="Ask the community" icon=<img src="/images/social/discord.png" style={{ height: 35, width: 35, border: "", borderRadius: theme.palette?.borderRadius, }} /> link="https://discord.gg/B2CBzUm" />
</div>
}
<div style={{ textAlign: "left" }}>
<Typography variant="h6" style={headerStyle} >Tutorial</Typography>
+163 -13
View File
@@ -34,6 +34,7 @@ import {
DialogTitle,
DialogContent,
MenuItem,
Autocomplete,
} from '@mui/material';
import {
@@ -45,6 +46,7 @@ import {
LockOpen as LockOpenIcon,
OpenInNew as OpenInNewIcon,
Edit as EditIcon,
Polyline as PolylineIcon,
} from '@mui/icons-material';
const hrefStyle = {
@@ -75,6 +77,7 @@ const RunWorkflow = (defaultprops) => {
const [sharingOpen, setSharingOpen] = React.useState(false)
const [realtimeMarkdown, setRealtimeMarkdown] = React.useState("")
const [forms, setForms] = React.useState([])
const [workflows, setWorkflows] = React.useState([])
const [boxWidth, setBoxWidth] = React.useState(500)
const [inputQuestions, setInputQuestions] = React.useState([])
@@ -181,6 +184,37 @@ const RunWorkflow = (defaultprops) => {
return true
}
const getWorkflows = () => {
const url = `${globalUrl}/api/v1/workflows`
fetch(url, {
method: "GET",
headers: {
"Content-Type": "application/json",
Accept: "application/json",
},
credentials: "include",
})
.then((response) => {
if (response.status !== 200) {
console.log("Status not 200 for org forms");
}
return response.json()
})
.then((responseJson) => {
if (responseJson.success === false) {
toast.error("Failed saving workflow. Please try again.")
} else {
if (responseJson?.length > 0) {
setWorkflows(responseJson)
}
}
})
.catch((error) => {
//toast.error("Load form error: " + error)
})
}
const loadForms = (orgId) => {
const url = `${globalUrl}/api/v1/orgs/${orgId}/forms`
fetch(url, {
@@ -878,6 +912,7 @@ const RunWorkflow = (defaultprops) => {
// Just use this one?
var url = execution_id !== undefined && authorization !== undefined ? `${globalUrl}/api/v1/orgs/${orgId}?reference_execution=${execution_id}&authorization=${authorization}` : `${globalUrl}/api/v1/orgs/${orgId}`;
getWorkflows()
loadForms(orgId)
fetch(url, {
@@ -1152,10 +1187,100 @@ const RunWorkflow = (defaultprops) => {
No Forms Found
</Typography>
<Typography variant="body1" color="textSecondary">
<b>Every</b> Workflow is a form, and can be accessed by going to /forms/{`{workflow_id}`}. You can control the form by editing the workflow details in the "Forms" section.
</Typography>
<b>ALL</b> Workflows are forms, and can be accessed by going to /forms/{`{workflow_id}`}. You can control the form by editing the workflow details in the "Forms" section.
</Typography>
</div>
}
{workflows === undefined || workflows === null || workflows.length === 0 ? null :
<Autocomplete
disabled={workflows === undefined || workflows === null || workflows.length === 0}
id="form-workflow-search"
autoHighlight
value={""}
ListboxProps={{
style: {
backgroundColor: theme.palette.inputColor,
color: "white",
},
}}
sx={{
'& .MuiOutlinedInput-root': {
height: 40, // Adjust the input height
},
'& .MuiAutocomplete-input': {
padding: '8px', // Adjust the text padding
},
}}
getOptionSelected={(option, value) => option.id === value.id}
getOptionLabel={(option) => {
if (
option === undefined ||
option === null ||
option.name === undefined ||
option.name === null
) {
return "No Workflow Selected";
}
const newname = (
option.name.charAt(0).toUpperCase() + option.name.substring(1)
).replaceAll("_", " ");
return newname;
}}
options={workflows}
fullWidth
style={{
backgroundColor: theme.palette.inputColor,
borderRadius: theme.palette?.borderRadius,
marginTop: 75,
}}
renderOption={(props, data, state) => {
if (data.id === workflow.id) {
data = workflow;
}
//key={index}
return (
<Tooltip arrow placement="left" title={
<span style={{}}>
{data.image !== undefined && data.image !== null && data.image.length > 0 ?
<img src={data.image} alt={data.name} style={{ backgroundColor: theme.palette.surfaceColor, maxHeight: 200, minHeigth: 200, maxWidth: 285, borderRadius: theme.palette?.borderRadius, }} />
: null}
<Typography>
Choose Subflow '{data.name}'
</Typography>
</span>
}>
<MenuItem
style={{
backgroundColor: theme.palette.inputColor,
}}
onClick={() => {
window.location.href = `/forms/${data.id}`
}}
value={data}
>
<PolylineIcon style={{ marginRight: 8 }} />
{data.name}
</MenuItem>
</Tooltip>
)
}}
renderInput={(params) => {
return (
<div style={{ display: "flex", }}>
<TextField
style={theme.palette.textFieldStyle}
{...params}
label="Find your form"
variant="outlined"
/>
</div>
)
}}
/>
}
</div>
)
}
@@ -1405,7 +1530,10 @@ const RunWorkflow = (defaultprops) => {
variant="contained"
disabled={!handleValidateForm(executionArgument) || disabledButtons}
color="primary"
style={{flex: 1,}}
style={{
flex: 1,
textTransform: "none",
}}
onClick={() => {
setButtonClicked("FINISHED")
setExecutionData({
@@ -1418,14 +1546,25 @@ const RunWorkflow = (defaultprops) => {
<Typography variant="body1" style={{marginLeft: 3, marginRight: 3, marginTop: 3, }}>
&nbsp;or&nbsp;
</Typography>
<Button fullWidth id="abort_execution" variant="contained" disabled={!handleValidateForm(executionArgument) || disabledButtons} color="primary" style={{ flex: 1, }} onClick={() => {
setButtonClicked("ABORTED")
setExecutionData({
status: "ABORTED",
})
<Button
fullWidth
id="abort_execution"
variant="outlined"
disabled={!handleValidateForm(executionArgument) || disabledButtons}
color="primary"
style={{
flex: 1,
textTransform: "none",
}} onClick={() => {
setButtonClicked("ABORTED")
setExecutionData({
status: "ABORTED",
})
onSubmit(null, execution_id, authorization, false)
}}>Stop</Button>
onSubmit(null, execution_id, authorization, false)
}}>
Stop
</Button>
</div>
</span>
:
@@ -1436,6 +1575,9 @@ const RunWorkflow = (defaultprops) => {
color="primary"
fullWidth
disabled={!handleValidateForm(executionArgument) || executionLoading}
style={{
textTransform: "none",
}}
>
{executionLoading ?
<CircularProgress color="secondary" style={{color: "white",}} />
@@ -1621,7 +1763,10 @@ const RunWorkflow = (defaultprops) => {
disabled={workflow.id === undefined || workflow.id === null}
variant={"outlined"}
color={"secondary"}
style={{marginRight: 10, }}
style={{
marginRight: 10,
textTransform: "none",
}}
onClick={() => {
window.open(`/workflows/${workflow.id}`, "_blank")
}}
@@ -1634,7 +1779,10 @@ const RunWorkflow = (defaultprops) => {
disabled={workflow.id === undefined || workflow.id === null}
variant={workflow.sharing === "form" ? "outlined" : "contained"}
color={"secondary"}
style={{marginRight: 10, }}
style={{
marginRight: 10,
textTransform: "none",
}}
onClick={() => {
setSharingOpen(true)
}}
@@ -1656,7 +1804,9 @@ const RunWorkflow = (defaultprops) => {
disabled={workflow.id === undefined || workflow.id === null}
variant={"contained"}
color={"primary"}
style={{}}
style={{
textTransform: "none",
}}
onClick={() => {
setEditWorkflowModalOpen(true)
}}
+42 -16
View File
@@ -812,9 +812,10 @@ const Workflows2 = (props) => {
}
const isCloud =
window.location.host === "localhost:3002" ||
window.location.host === "shuffler.io";
//const isCloud =
// window.location.host === "localhost:3002" ||
// window.location.host === "shuffler.io";
const isCloud = false
const findWorkflow = (filters) => {
console.log("Using filters: ", filters)
@@ -2474,16 +2475,18 @@ const Workflows2 = (props) => {
style={{ display: "flex", flexDirection: "column", width: "100%", fontFamily: theme?.typography?.fontFamily }}
>
<Grid item style={{ display: "flex", maxHeight: 34 }}>
<Tooltip title={`Org "${orgName}". Click to edit image.`} placement="bottom">
<div
styl={{ cursor: "pointer" }}
onClick={() => {
navigate("/admin")
}}
>
{image}
</div>
</Tooltip>
{currTab === 2 ? null :
<Tooltip title={`Org "${orgName}". Click to edit image.`} placement="bottom">
<div
styl={{ cursor: "pointer" }}
onClick={() => {
navigate("/admin")
}}
>
{image}
</div>
</Tooltip>
}
<Tooltip arrow
onMouseEnter={() => {
/*
@@ -2562,9 +2565,19 @@ const Workflows2 = (props) => {
>
<Link
to={
type === "public" ? parsedUrl : data.workflow_as_code ? `/workflows/${data.id}/code` : `/workflows/${data.id}`
currTab === 2 ? `https://shuffler.io${parsedUrl}` : type === "public" ? parsedUrl : data.workflow_as_code ? `/workflows/${data.id}/code` : `/workflows/${data.id}`
}
style={{ textDecoration: "none", color: "inherit", overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap", maxWidth: "90%", display: "block" }} >
style={{
textDecoration: "none",
color: "inherit",
overflow: "hidden",
textOverflow: "ellipsis",
whiteSpace: "nowrap",
maxWidth: "90%",
display: "block"
}}
target={currTab === 2 ? "_blank" : "_self"}
>
{parsedName}
</Link>
</Typography>
@@ -4261,7 +4274,7 @@ const Workflows2 = (props) => {
TabIndicatorProps={{ style: { display: 'none' } }}
>
<Tab
label="Organization Workflows"
label="Org Workflows"
style={{
...tabStyle,
...(currTab === 0 ? tabActive : {})
@@ -4282,6 +4295,19 @@ const Workflows2 = (props) => {
...(currTab === 2 ? tabActive : {})
}}
/>
<Tab
label="Org Forms"
onClick={() => {
navigate("/forms")
}}
style={{
...tabStyle,
marginRight: 0,
marginLeft: 25,
...(currTab === 3 ? tabActive : {})
}}
/>
</Tabs>
</div>