One of the final syncs before merges start happening for 2.0

This commit is contained in:
Frikky
2025-02-24 17:50:42 +01:00
parent 5703ce40e4
commit 1ffae87420
20 changed files with 647 additions and 495 deletions
+16 -16
View File
@@ -116,7 +116,7 @@ const AppGrid = (props) => {
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((response) => { .then((response) => {
if (response.success === true) { if (response?.success === true) {
setFormMessage(response.reason); setFormMessage(response.reason);
//toast("Thanks for submitting!") //toast("Thanks for submitting!")
} else { } else {
@@ -307,7 +307,7 @@ const AppGrid = (props) => {
}) })
.then(response => response.json()) .then(response => response.json())
.then(responseJson => { .then(responseJson => {
if (responseJson.success) { if (responseJson?.success) {
setUserdata(responseJson); setUserdata(responseJson);
setAllActivatedAppIds(responseJson.active_apps) setAllActivatedAppIds(responseJson.active_apps)
setIsLoggedIn(true); setIsLoggedIn(true);
@@ -350,7 +350,7 @@ const AppGrid = (props) => {
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
if (responseJson.success === false) { if (responseJson?.success === false) {
toast.error(responseJson.reason); toast.error(responseJson.reason);
} else { } else {
//toast.success(`App ${type}d Successfully!`); //toast.success(`App ${type}d Successfully!`);
@@ -414,7 +414,7 @@ const AppGrid = (props) => {
scrollbarColor: "#494949 #2f2f2f", scrollbarColor: "#494949 #2f2f2f",
}} }}
> >
{hits.map((data, index) => { {hits?.map((data, index) => {
const appUrl = const appUrl =
isCloud === true ? isCloud === true ?
`/apps/${data.objectID}` `/apps/${data.objectID}`
@@ -556,7 +556,7 @@ const AppGrid = (props) => {
}} }}
> >
<span> <span>
{data.tags.slice(0, 1).map((tag, tagIndex) => ( {data?.tags?.slice(0, 1)?.map((tag, tagIndex) => (
<span key={tagIndex}> <span key={tagIndex}>
{normalizedString(tag)} {normalizedString(tag)}
{tagIndex < 1 ? ", " : ""} {tagIndex < 1 ? ", " : ""}
@@ -569,7 +569,7 @@ const AppGrid = (props) => {
) : ( ) : (
<div style={{ width: 230, textOverflow: "ellipsis", overflow: 'hidden', whiteSpace: 'nowrap', }}> <div style={{ width: 230, textOverflow: "ellipsis", overflow: 'hidden', whiteSpace: 'nowrap', }}>
{data.tags && {data.tags &&
data.tags.map((tag, tagIndex) => ( data?.tags?.map((tag, tagIndex) => (
<span key={tagIndex}> <span key={tagIndex}>
{normalizedString(tag)} {normalizedString(tag)}
{tagIndex < data.tags.length - 1 ? ", " : ""} {tagIndex < data.tags.length - 1 ? ", " : ""}
@@ -760,7 +760,7 @@ const AppGrid = (props) => {
}; };
const transformRefinementListItems = items => const transformRefinementListItems = items =>
items.map(item => ({ items?.map(item => ({
...item, ...item,
label: item.label === 'true' ? 'App Editor' : 'Python', label: item.label === 'true' ? 'App Editor' : 'Python',
})); }));
@@ -1103,7 +1103,7 @@ const AppGrid = (props) => {
} }
}); });
const categoryArray = Object.keys(categoryCountMap).map((category) => ({ const categoryArray = Object.keys(categoryCountMap)?.map((category) => ({
category, category,
count: categoryCountMap[category], count: categoryCountMap[category],
})); }));
@@ -1169,7 +1169,7 @@ const AppGrid = (props) => {
{!isLoading && ( {!isLoading && (
<Collapse in={isCategoreListExpanded}> <Collapse in={isCategoreListExpanded}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}> <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}>
{topCategories.map((data, index) => ( {topCategories?.map((data, index) => (
<Button <Button
key={data.category} key={data.category}
style={{ style={{
@@ -1247,7 +1247,7 @@ const AppGrid = (props) => {
}); });
} }
const tagArray = Object.keys(tagCountMap).map((tag) => ({ const tagArray = Object.keys(tagCountMap)?.map((tag) => ({
tag, tag,
count: tagCountMap[tag], count: tagCountMap[tag],
})); }));
@@ -1308,7 +1308,7 @@ const AppGrid = (props) => {
</Button> </Button>
<Collapse in={isActionLabelExpanded}> <Collapse in={isActionLabelExpanded}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%', }}> <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%', }}>
{topTags && topTags.length > 0 && topTags.map((data, index) => ( {topTags && topTags.length > 0 && topTags?.map((data, index) => (
<Button <Button
key={index} key={index}
onClick={() => handleCheckboxChange(index)} onClick={() => handleCheckboxChange(index)}
@@ -1419,7 +1419,7 @@ const AppGrid = (props) => {
<Collapse in={isCreatedWithExpanded}> <Collapse in={isCreatedWithExpanded}>
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}> <div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}>
{AppCreatedWithOptions.map((data, index) => ( {AppCreatedWithOptions?.map((data, index) => (
<Button <Button
style={{ style={{
display: "inline-flex", display: "inline-flex",
@@ -1689,7 +1689,7 @@ const AppGrid = (props) => {
maxHeight: 570, maxHeight: 570,
}} }}
> >
{filteredUserAppdata.map((data, index) => { {filteredUserAppdata?.map((data, index) => {
const isMouseOverOnCloudIcon = false; const isMouseOverOnCloudIcon = false;
const xs = 12; const xs = 12;
const rowHandler = 12; const rowHandler = 12;
@@ -1847,8 +1847,8 @@ const AppGrid = (props) => {
<div style={{minWidth: 120, overflow: "hidden", }}> <div style={{minWidth: 120, overflow: "hidden", }}>
{data.generated !== true ? {data.generated !== true ?
<div> <div>
{data.tags && {data?.tags &&
data.tags.slice(0,2).map((tag, tagIndex) => ( data?.tags?.slice(0,2)?.map((tag, tagIndex) => (
<span key={tagIndex}> <span key={tagIndex}>
{normalizedString(tag)} {normalizedString(tag)}
{tagIndex < data.tags.length - 1 ? ", " : ""} {tagIndex < data.tags.length - 1 ? ", " : ""}
@@ -1888,7 +1888,7 @@ const AppGrid = (props) => {
}) })
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
if (responseJson.success === false) { if (responseJson?.success === false) {
toast.error(responseJson.reason); toast.error(responseJson.reason);
} else { } else {
toast.success("App Deactivated Successfully. Reload UI to see updated changes.") toast.success("App Deactivated Successfully. Reload UI to see updated changes.")
+1 -1
View File
@@ -179,7 +179,7 @@ const AppSearchButtons = (props) => {
return ( return (
<Grid item xs={xsValue} style={{ alignItems: "center", marginTop: 5, }} <Grid item xs={xsValue} style={{ alignItems: "center", marginTop: 5, maxWidth: "50%", minWidth: "50%" }}
onMouseEnter={handleMouseEnter} onMouseEnter={handleMouseEnter}
onMouseLeave={handleMouseLeave} onMouseLeave={handleMouseLeave}
> >
+27 -4
View File
@@ -191,6 +191,10 @@ const EditWorkflow = (props) => {
var upload = ""; var upload = "";
var total_count = 0 var total_count = 0
const isCloud =
window.location.host === "localhost:3002" ||
window.location.host === "shuffler.io";
return ( return (
<Drawer <Drawer
anchor={"right"} anchor={"right"}
@@ -622,6 +626,7 @@ const EditWorkflow = (props) => {
All All
</MenuItem> </MenuItem>
{userdata.orgs.map((data, index) => { {userdata.orgs.map((data, index) => {
var skipOrg = false; var skipOrg = false;
if (data.creator_org !== undefined && data.creator_org !== null && data.creator_org === userdata.active_org.id) { if (data.creator_org !== undefined && data.creator_org !== null && data.creator_org === userdata.active_org.id) {
// Finds the parent org // Finds the parent org
@@ -629,6 +634,8 @@ const EditWorkflow = (props) => {
return null return null
} }
const correctRegion = data?.region_url === userdata?.region_url
const imagesize = 22 const imagesize = 22
const imageStyle = { const imageStyle = {
width: imagesize, width: imagesize,
@@ -662,7 +669,11 @@ const EditWorkflow = (props) => {
return ( return (
<MenuItem key={index} value={data.id}> <MenuItem
key={index}
value={data.id}
disabled={isCloud && !correctRegion}
>
<Checkbox checked={innerWorkflow.suborg_distribution !== undefined && innerWorkflow.suborg_distribution !== null && innerWorkflow.suborg_distribution.includes(data.id)} /> <Checkbox checked={innerWorkflow.suborg_distribution !== undefined && innerWorkflow.suborg_distribution !== null && innerWorkflow.suborg_distribution.includes(data.id)} />
{image}{" "} {image}{" "}
<span style={{ marginLeft: 8 }}> <span style={{ marginLeft: 8 }}>
@@ -1170,9 +1181,21 @@ const EditWorkflow = (props) => {
setInnerWorkflow(innerWorkflow) setInnerWorkflow(innerWorkflow)
}} }}
> >
<FormControlLabel value="trigger" control={<Radio />} label="Trigger" /> <Tooltip title="Agentic workflows takes an input based on input questions (forms) and performs actions based on it by itself, using Large Action Models & Singul">
<FormControlLabel value="subflow" control={<Radio />} label="Subflow" /> <FormControlLabel value="agentic" control={<Radio />} label="Agentic" />
<FormControlLabel value="standalone" control={<Radio />} label="Standalone" /> </Tooltip>
<Tooltip title="Trigger workflows are typically running a schedule to get some data, doing some deduplication before sending it to a subflow or standalone workflow.">
<FormControlLabel value="trigger" control={<Radio />} label="Trigger" />
</Tooltip>
<Tooltip title="Subflow workflows are typically used to subprocess some data, and in some cases return the result to the parent workflow.">
<FormControlLabel value="subflow" control={<Radio />} label="Subflow" />
</Tooltip>
<Tooltip title="Standalone is default. This has no impact on Shuffle as a system.">
<FormControlLabel value="standalone" control={<Radio />} label="Standalone" />
</Tooltip>
</RadioGroup> </RadioGroup>
</FormControl> </FormControl>
+1 -5
View File
@@ -721,11 +721,7 @@ useEffect(() => {
margin_left: margin_left:
org.creator_org !== undefined && org.creator_org !== undefined &&
org.creator_org !== null && org.creator_org !== null &&
org.creator_org.length > 0 org.creator_org.length > 0 ? 20 : 0,
? org.id === userdata.active_org.id
? 0
: 20
: 0,
}; };
}) || [] }) || []
); );
+207 -202
View File
@@ -74,7 +74,7 @@ const OrgHeaderexpandedNew = (props) => {
getContentAnchorEl: () => null, getContentAnchorEl: () => null,
}; };
const [orgName, setOrgName] = useState(selectedOrganization?.name); const [orgName, setOrgName] = useState(selectedOrganization?.name);
const [orgDescription, setOrgDescription] = React.useState( const [orgDescription, setOrgDescription] = React.useState(
selectedOrganization.description selectedOrganization.description
); );
@@ -180,41 +180,41 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
const [uploadUsername, setUploadUsername] = React.useState(selectedOrganization.defaults === undefined ? "" : selectedOrganization.defaults.workflow_upload_username === undefined || selectedOrganization.defaults.workflow_upload_username.length === 0 ? "" : selectedOrganization.defaults.workflow_upload_username) const [uploadUsername, setUploadUsername] = React.useState(selectedOrganization.defaults === undefined ? "" : selectedOrganization.defaults.workflow_upload_username === undefined || selectedOrganization.defaults.workflow_upload_username.length === 0 ? "" : selectedOrganization.defaults.workflow_upload_username)
const [uploadToken, setUploadToken] = React.useState(selectedOrganization.defaults === undefined ? "" : selectedOrganization.defaults.workflow_upload_token === undefined || selectedOrganization.defaults.workflow_upload_token.length === 0 ? "" : selectedOrganization.defaults.workflow_upload_token) const [uploadToken, setUploadToken] = React.useState(selectedOrganization.defaults === undefined ? "" : selectedOrganization.defaults.workflow_upload_token === undefined || selectedOrganization.defaults.workflow_upload_token.length === 0 ? "" : selectedOrganization.defaults.workflow_upload_token)
const [regionStatus, setRegionStatus] = useState(); const [regionStatus, setRegionStatus] = useState();
useEffect(() => { useEffect(() => {
if (documentationReference !== selectedOrganization?.defaults?.documentation_reference) { if (documentationReference !== selectedOrganization?.defaults?.documentation_reference) {
setDocumentationReference(selectedOrganization?.defaults?.documentation_reference) setDocumentationReference(selectedOrganization?.defaults?.documentation_reference)
} }
if (uploadRepo !== selectedOrganization?.defaults?.workflow_upload_repo){ if (uploadRepo !== selectedOrganization?.defaults?.workflow_upload_repo) {
setUploadRepo(selectedOrganization?.defaults?.workflow_upload_repo) setUploadRepo(selectedOrganization?.defaults?.workflow_upload_repo)
} }
if (uploadBranch !== selectedOrganization?.defaults?.workflow_upload_branch){ if (uploadBranch !== selectedOrganization?.defaults?.workflow_upload_branch) {
setUploadBranch(selectedOrganization?.defaults?.workflow_upload_branch) setUploadBranch(selectedOrganization?.defaults?.workflow_upload_branch)
} }
if (uploadUsername !== selectedOrganization?.defaults?.workflow_upload_username){ if (uploadUsername !== selectedOrganization?.defaults?.workflow_upload_username) {
setUploadUsername(selectedOrganization?.defaults?.workflow_upload_username) setUploadUsername(selectedOrganization?.defaults?.workflow_upload_username)
} }
if (uploadToken !== selectedOrganization?.defaults?.workflow_upload_token){ if (uploadToken !== selectedOrganization?.defaults?.workflow_upload_token) {
setUploadToken(selectedOrganization?.defaults?.workflow_upload_token) setUploadToken(selectedOrganization?.defaults?.workflow_upload_token)
} }
}, [selectedOrganization]) }, [selectedOrganization])
useEffect(() => { useEffect(() => {
if (selectedOrganization !== undefined && selectedOrganization !== null) { if (selectedOrganization !== undefined && selectedOrganization !== null) {
if((orgName === undefined || orgName === null || orgName.length === 0) && selectedOrganization?.name !== orgName) { if ((orgName === undefined || orgName === null || orgName.length === 0) && selectedOrganization?.name !== orgName) {
setOrgName(selectedOrganization?.name) setOrgName(selectedOrganization?.name)
} }
if((orgDescription === undefined || orgDescription === null || orgDescription.length === 0) && selectedOrganization?.description !== orgDescription) { if ((orgDescription === undefined || orgDescription === null || orgDescription.length === 0) && selectedOrganization?.description !== orgDescription) {
setOrgDescription(selectedOrganization?.description) setOrgDescription(selectedOrganization?.description)
} }
} }
}, [selectedOrganization]) }, [selectedOrganization])
const handleEditOrg = ( const handleEditOrg = (
name, name,
description, description,
@@ -262,21 +262,21 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}); });
} }
const handleSendChangeRegionMail = (region)=> { const handleSendChangeRegionMail = (region) => {
if(selectedOrganization === undefined || selectedOrganization === null){ if (selectedOrganization === undefined || selectedOrganization === null) {
toast.error("Failed to send request for changing region. Please contact support@shuffler.io.") toast.error("Failed to send request for changing region. Please contact support@shuffler.io.")
return return
} }
let destinationRegion = region;
if (region === "US") { const regionToCloudRegion = {
destinationRegion = "us-west2"; 'US': 'us-west2',
} else if (region === "EU") { 'EU': 'europe-west3',
destinationRegion = "europe-west3"; 'CA': 'northamerica-northeast1',
} else if (region === "CA") { 'UK': 'europe-west2',
destinationRegion = "northamerica-northeast1"; 'EU-2': 'europe-west3'
} else if (region === "UK") { };
destinationRegion = "europe-west2";
} const destinationRegion = regionToCloudRegion[region] || region;
var data = { var data = {
dst_region: destinationRegion dst_region: destinationRegion
@@ -284,7 +284,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
toast.info("Sending request for changing region to " + region) toast.info("Sending request for changing region to " + region)
fetch(`${globalUrl}/api/v1/orgs/${selectedOrganization?.id}/change/region/request`,{ fetch(`${globalUrl}/api/v1/orgs/${selectedOrganization?.id}/change/region/request`, {
method: "POST", method: "POST",
headers: { headers: {
"Content-Type": "application/json", "Content-Type": "application/json",
@@ -292,13 +292,13 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
credentials: "include", credentials: "include",
body: JSON.stringify(data), body: JSON.stringify(data),
}).then((response)=>{ }).then((response) => {
if(response.status !== 200){ if (response.status !== 200) {
toast.error("Failed to send request for changing region. Please contact support@shuffler.io.") toast.error("Failed to send request for changing region. Please contact support@shuffler.io.")
}else{ } else {
toast.success("successfully send request for changing region. We will contact you shortly.") toast.success("Successfully sent request for region change. We will process the move and contact you shortly.")
} }
}).catch((err)=>{ }).catch((err) => {
console.log(err) console.log(err)
toast.error("Failed to send request for changing region. Please contact support@shuffler.io.") toast.error("Failed to send request for changing region. Please contact support@shuffler.io.")
}) })
@@ -307,13 +307,13 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
const setSelectedRegion = (region) => { const setSelectedRegion = (region) => {
// send a POST request to /api/v1/orgs/{org_id}/region with the region as the body // send a POST request to /api/v1/orgs/{org_id}/region with the region as the body
if(region === "US") { if (region === "US") {
region = "us-west2" region = "us-west2"
} else if(region === "EU") { } else if (region === "EU") {
region = "europe-west2" region = "europe-west2"
} else if(region === "CA") { } else if (region === "CA") {
region = "northamerica-northeast1" region = "northamerica-northeast1"
} else if(region === "UK") { } else if (region === "UK") {
region = "europe-west2" region = "europe-west2"
} else if (region === "EU-2") { } else if (region === "EU-2") {
region = "europe-west3" region = "europe-west3"
@@ -355,7 +355,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
const orgSaveButton = ( const orgSaveButton = (
<Tooltip title="Save any unsaved data" placement="bottom"> <Tooltip title="Save any unsaved data" placement="bottom">
<Button <Button
style={{ width: 244, height: 51, display: 'flex', justifyContent:'center', textTransform: 'capitalize', padding: "16px, 24px, 16px, 24px", borderRadius: 4, backgroundColor: "#ff8544", color: "#1a1a1a", fontSize: 16, }} style={{ width: 244, height: 51, display: 'flex', justifyContent: 'center', textTransform: 'capitalize', padding: "16px, 24px, 16px, 24px", borderRadius: 4, backgroundColor: "#ff8544", color: "#1a1a1a", fontSize: 16, }}
variant="contained" variant="contained"
color="primary" color="primary"
disabled={ disabled={
@@ -444,29 +444,29 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
<div style={{ flex: "3", color: "white" }}> <div style={{ flex: "3", color: "white" }}>
<div style={{ marginTop: 8, display: "flex" }} /> <div style={{ marginTop: 8, display: "flex" }} />
<div style={{ display: "flex" }}> <div style={{ display: "flex" }}>
<div style={{width: "100%", maxWidth: 434, marginRight: 10}}> <div style={{ width: "100%", maxWidth: 434, marginRight: 10 }}>
Name Name
<TextField <TextField
required required
style={{ style={{
flex: "1", flex: "1",
display: "flex", display: "flex",
height: 35, height: 35,
width: "100%", width: "100%",
maxWidth: 434, maxWidth: 434,
marginTop: "5px", marginTop: "5px",
marginRight: "15px", marginRight: "15px",
backgroundColor: isEditOrgTab ? "#212121" : theme.palette.inputColor, backgroundColor: isEditOrgTab ? "#212121" : theme.palette.inputColor,
}} }}
fullWidth={true} fullWidth={true}
placeholder="Name" placeholder="Name"
type="name" type="name"
id="standard-required" id="standard-required"
margin="normal" margin="normal"
variant="outlined" variant="outlined"
value={orgName} value={orgName}
onBlur={() => { onBlur={() => {
if((orgName !== selectedOrganization?.name) && (orgName !== "")) { if ((orgName !== selectedOrganization?.name) && (orgName !== "")) {
handleEditOrg( handleEditOrg(
orgName, orgName,
orgDescription, orgDescription,
@@ -497,61 +497,62 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
auto_provision: selectedOrganization?.sso_config?.auto_provision, auto_provision: selectedOrganization?.sso_config?.auto_provision,
} }
) )
}}} }
onChange={(e) => { }}
if (e.target.value.length > 100) { onChange={(e) => {
toast("Choose a shorter name."); if (e.target.value.length > 100) {
return; toast("Choose a shorter name.");
} return;
}
setOrgName(e.target.value); setOrgName(e.target.value);
}} }}
color="primary" color="primary"
InputProps={{ InputProps={{
style: { style: {
color: "white", color: "white",
height: "35px", height: "35px",
fontSize: "1em", fontSize: "1em",
borderRadius: 4, borderRadius: 4,
}, },
classes: { classes: {
notchedOutline: isEditOrgTab ? null : classes.notchedOutline, notchedOutline: isEditOrgTab ? null : classes.notchedOutline,
}, },
}} }}
/> />
</div> </div>
{userdata?.support ? ( {userdata?.support ? (
<div style={{ alignItems: 'center' }}> <div style={{ alignItems: 'center' }}>
<div style={{ marginRight: '12px', color: 'white' }}>Status</div> <div style={{ marginRight: '12px', color: 'white' }}>Status</div>
<FormControl style={{ width: 220, height: 35 }}> <FormControl style={{ width: 220, height: 35 }}>
<Select <Select
style={{ minWidth: 220, marginTop: 5, maxWidth: 220, height: 35, borderRadius: 4 }} style={{ minWidth: 220, marginTop: 5, maxWidth: 220, height: 35, borderRadius: 4 }}
id="multiselect-status" id="multiselect-status"
multiple multiple
value={selectedStatus} value={selectedStatus}
onChange={(event) => {handleStatusChange(event);setSelectedStatus(event.target.value)}} onChange={(event) => { handleStatusChange(event); setSelectedStatus(event.target.value) }}
input={<OutlinedInput />} input={<OutlinedInput />}
renderValue={(selected) => selected.join(', ')} renderValue={(selected) => selected.join(', ')}
MenuProps={MenuProps} MenuProps={MenuProps}
> >
{["contacted", "lead", "demo done", "pov", "customer", "open source", "student", "internal", "creator", "tech partner", "old customer", "old lead"].map((name) => ( {["contacted", "lead", "demo done", "pov", "customer", "open source", "student", "internal", "creator", "tech partner", "old customer", "old lead"].map((name) => (
<MenuItem key={name} value={name}> <MenuItem key={name} value={name}>
<Checkbox checked={selectedStatus.indexOf(name) > -1} /> <Checkbox checked={selectedStatus.indexOf(name) > -1} />
<ListItemText primary={name} /> <ListItemText primary={name} />
</MenuItem> </MenuItem>
))} ))}
</Select> </Select>
</FormControl> </FormControl>
</div> </div>
): null} ) : null}
{isCloud ? ( {isCloud ? (
<div style={{ marginLeft: 13, fontSize: 16, color: "#9E9E9E" }} > <div style={{ marginLeft: 13, fontSize: 16, color: "#9E9E9E" }} >
Region Region
<RegionChangeModal selectedOrganization={selectedOrganization} setSelectedRegion={setSelectedRegion} userdata={userdata} handleSendChangeRegionMail={handleSendChangeRegionMail}/> <RegionChangeModal selectedOrganization={selectedOrganization} setSelectedRegion={setSelectedRegion} userdata={userdata} handleSendChangeRegionMail={handleSendChangeRegionMail} />
</div> </div>
): null} ) : null}
</div> </div>
<div style={{ marginTop: "10px" }} /> <div style={{ marginTop: "10px" }} />
About About
@@ -575,38 +576,40 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
variant="outlined" variant="outlined"
placeholder="A description for the organization" placeholder="A description for the organization"
value={orgDescription} value={orgDescription}
onBlur={() => {if((orgDescription !== selectedOrganization?.description) && (orgDescription !== "")) { onBlur={() => {
handleEditOrg( if ((orgDescription !== selectedOrganization?.description) && (orgDescription !== "")) {
orgName, handleEditOrg(
orgDescription, orgName,
selectedOrganization.id, orgDescription,
selectedOrganization.image, selectedOrganization.id,
{ selectedOrganization.image,
app_download_repo: selectedOrganization?.defaults?.app_download_repo, {
app_download_branch: selectedOrganization?.defaults?.app_download_branch, app_download_repo: selectedOrganization?.defaults?.app_download_repo,
workflow_download_repo: selectedOrganization?.defaults?.workflow_download_repo, app_download_branch: selectedOrganization?.defaults?.app_download_branch,
workflow_download_branch: selectedOrganization?.defaults?.workflow_download_branch, workflow_download_repo: selectedOrganization?.defaults?.workflow_download_repo,
notification_workflow: selectedOrganization?.defaults?.notification_workflow, workflow_download_branch: selectedOrganization?.defaults?.workflow_download_branch,
documentation_reference: selectedOrganization?.defaults?.documentation_reference, notification_workflow: selectedOrganization?.defaults?.notification_workflow,
workflow_upload_repo: selectedOrganization?.defaults?.workflow_upload_repo, documentation_reference: selectedOrganization?.defaults?.documentation_reference,
workflow_upload_branch: selectedOrganization?.defaults?.workflow_upload_branch, workflow_upload_repo: selectedOrganization?.defaults?.workflow_upload_repo,
workflow_upload_username: selectedOrganization?.defaults?.workflow_upload_username, workflow_upload_branch: selectedOrganization?.defaults?.workflow_upload_branch,
workflow_upload_token: selectedOrganization?.defaults?.workflow_upload_token, workflow_upload_username: selectedOrganization?.defaults?.workflow_upload_username,
newsletter: !newsletter, workflow_upload_token: selectedOrganization?.defaults?.workflow_upload_token,
weekly_recommendations: !weeklyRecommendations, newsletter: !newsletter,
}, weekly_recommendations: !weeklyRecommendations,
{ },
sso_entrypoint: selectedOrganization?.sso_config?.sso_entrypoint, {
sso_certificate: selectedOrganization?.sso_config?.sso_certificate, sso_entrypoint: selectedOrganization?.sso_config?.sso_entrypoint,
client_id: selectedOrganization?.sso_config?.client_id, sso_certificate: selectedOrganization?.sso_config?.sso_certificate,
client_secret: selectedOrganization?.sso_config?.client_secret, client_id: selectedOrganization?.sso_config?.client_id,
openid_authorization: selectedOrganization?.sso_config?.openid_authorization, client_secret: selectedOrganization?.sso_config?.client_secret,
openid_token: selectedOrganization?.sso_config?.openid_token, openid_authorization: selectedOrganization?.sso_config?.openid_authorization,
SSORequired: selectedOrganization?.sso_config?.SSORequired, openid_token: selectedOrganization?.sso_config?.openid_token,
auto_provision: selectedOrganization?.sso_config?.auto_provision, SSORequired: selectedOrganization?.sso_config?.SSORequired,
} auto_provision: selectedOrganization?.sso_config?.auto_provision,
) }
}}} )
}
}}
onChange={(e) => { onChange={(e) => {
setOrgDescription(e.target.value); setOrgDescription(e.target.value);
}} }}
@@ -626,7 +629,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
</div> </div>
</div> </div>
<Typography variant="h5" style={{ color: "rgba(241, 241, 241, 1)", fontSize: 24, fontWeight: 600, marginTop: 40, textAlign: "left" }}> <Typography variant="h5" style={{ color: "rgba(241, 241, 241, 1)", fontSize: 24, fontWeight: 600, marginTop: 40, textAlign: "left" }}>
Preferences Preferences
</Typography> </Typography>
@@ -647,9 +650,9 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
</Grid> </Grid>
<Grid item xs={12}> <Grid item xs={12}>
<span> <span>
<Typography style={{ fontWeight: 400, fontSize: 16 }}>Org Documentation reference</Typography> <Typography style={{ fontWeight: 400, fontSize: 16 }}>Org Documentation reference</Typography>
<Typography variant="body2" color="textSecondary" style={{ fontWeight: 400, fontSize: 16, marginTop: 8 }}> <Typography variant="body2" color="textSecondary" style={{ fontWeight: 400, fontSize: 16, marginTop: 8 }}>
Add a URL that is added as a link, pointing to any external documentation page you want. Add a URL that is added as a link, pointing to any external documentation page you want.
</Typography> </Typography>
@@ -672,7 +675,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
placeholder="Paste a URL to an external reference for this implementation" placeholder="Paste a URL to an external reference for this implementation"
value={documentationReference} value={documentationReference}
onBlur={() => { onBlur={() => {
if(documentationReference !== selectedOrganization?.defaults?.documentation_reference) { if (documentationReference !== selectedOrganization?.defaults?.documentation_reference) {
handleEditOrg( handleEditOrg(
orgName, orgName,
orgDescription, orgDescription,
@@ -714,7 +717,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -728,16 +731,16 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
globalUrl={globalUrl} globalUrl={globalUrl}
userdata={userdata} userdata={userdata}
serverside={false} serverside={false}
/> />
<Grid item xs={12} style={{ marginTop: 20, }}> <Grid item xs={12} style={{ marginTop: 20, }}>
<Typography variant="h4" style={{ textAlign: "left", color: "rgba(241, 241, 241, 1)", fontSize: 24, fontWeight: 600, }}>Workflow Backup Repository</Typography> <Typography variant="h4" style={{ textAlign: "left", color: "rgba(241, 241, 241, 1)", fontSize: 24, fontWeight: 600, }}>Workflow Backup Repository</Typography>
<Typography variant="body2" style={{ textAlign: "left", marginTop: 8, color: "#9E9E9E", fontSize: 16, fontWeight: 400 }}> <Typography variant="body2" style={{ textAlign: "left", marginTop: 8, color: "#9E9E9E", fontSize: 16, fontWeight: 400 }}>
Decide where workflows are backed up in a Git repository. Will create logs and notifications if upload fails. The repository and branch must already have been initialized. Files will show up in the repo root in the /orgId/workflow-status/workflowId.json format. <b>MSSP:</b> If suborg exists, this will automatically be applied for them as well (not retroactive). <a href="/docs/configuration#environment-variables" style={{textDecoration: "none", color: "#f86a3e"}} target="_blank">Credentials are encrypted.</a> Decide where workflows are backed up in a Git repository. Will create logs and notifications if upload fails. The repository and branch must already have been initialized. Files will show up in the repo root in the /orgId/workflow-status/workflowId.json format. <b>MSSP:</b> If suborg exists, this will automatically be applied for them as well (not retroactive). <a href="/docs/configuration#environment-variables" style={{ textDecoration: "none", color: "#f86a3e" }} target="_blank">Credentials are encrypted.</a>
</Typography> </Typography>
<Grid container style={{ marginTop: 10, }} spacing={2}> <Grid container style={{ marginTop: 10, }} spacing={2}>
<Grid item xs={6} style={{}}> <Grid item xs={6} style={{}}>
<span> <span>
<Typography style={{ fontWeight: 400, fontSize: 16 }}>Repository for workflow backup</Typography> <Typography style={{ fontWeight: 400, fontSize: 16 }}>Repository for workflow backup</Typography>
<TextField <TextField
required required
style={{ style={{
@@ -765,7 +768,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -777,7 +780,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
</Grid> </Grid>
<Grid item xs={6} style={{}}> <Grid item xs={6} style={{}}>
<span> <span>
<Typography style={{ fontWeight: 400, fontSize: 16 }}>Branch</Typography> <Typography style={{ fontWeight: 400, fontSize: 16 }}>Branch</Typography>
<TextField <TextField
required required
style={{ style={{
@@ -805,7 +808,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -819,7 +822,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
<Grid container style={{ marginTop: 10, }} spacing={2}> <Grid container style={{ marginTop: 10, }} spacing={2}>
<Grid item xs={6} style={{}}> <Grid item xs={6} style={{}}>
<span> <span>
<Typography style={{ fontWeight: 400, fontSize: 16 }}>Username for backup of workflows</Typography> <Typography style={{ fontWeight: 400, fontSize: 16 }}>Username for backup of workflows</Typography>
<TextField <TextField
required required
style={{ style={{
@@ -847,7 +850,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -859,7 +862,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
</Grid> </Grid>
<Grid item xs={6} style={{}}> <Grid item xs={6} style={{}}>
<span> <span>
<Typography style={{ fontWeight: 400, fontSize: 16 }}>Git token/password</Typography> <Typography style={{ fontWeight: 400, fontSize: 16 }}>Git token/password</Typography>
<TextField <TextField
required required
style={{ style={{
@@ -886,7 +889,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -930,7 +933,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -970,7 +973,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -1010,7 +1013,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -1050,7 +1053,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
}, },
style: { style: {
color: "white", color: "white",
fontWeight: 400, fontWeight: 400,
fontSize: 16, fontSize: 16,
borderRadius: 4, borderRadius: 4,
@@ -1080,14 +1083,14 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
export default OrgHeaderexpandedNew; export default OrgHeaderexpandedNew;
const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userdata, handleSendChangeRegionMail}) => { const RegionChangeModal = memo(({ selectedOrganization, setSelectedRegion, userdata, handleSendChangeRegionMail }) => {
// Show from options: "us-west2", "europe-west2", "europe-west3", "northamerica-northeast1" // Show from options: "us-west2", "europe-west2", "europe-west3", "northamerica-northeast1"
// var regions = ["us-west2", "europe-west2", "europe-west3", "northamerica-northeast1"] // var regions = ["us-west2", "europe-west2", "europe-west3", "northamerica-northeast1"]
const regionMapping = { const regionMapping = {
"US": "us", "US": "us",
"EU-2": "eu", "EU-2": "eu",
"CA": "ca", "CA": "ca",
"UK": "gb" "UK": "gb",
}; };
//let regiontag = "UK"; //let regiontag = "UK";
@@ -1095,6 +1098,7 @@ const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userda
let regionCode = "gb"; let regionCode = "gb";
const regionsplit = selectedOrganization?.region_url?.split("."); const regionsplit = selectedOrganization?.region_url?.split(".");
if (regionsplit?.length > 2 && !regionsplit[0]?.includes("shuffler")) { if (regionsplit?.length > 2 && !regionsplit[0]?.includes("shuffler")) {
const namesplit = regionsplit[0]?.split("/"); const namesplit = regionsplit[0]?.split("/");
regiontag = namesplit[namesplit.length - 1]; regiontag = namesplit[namesplit.length - 1];
@@ -1103,58 +1107,59 @@ const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userda
regiontag = "US"; regiontag = "US";
regionCode = "us"; regionCode = "us";
} else if (regiontag === "frankfurt") { } else if (regiontag === "frankfurt") {
regiontag = "EU"; regiontag = "EU-2";
regionCode = "eu"; regionCode = "eu";
} else if (regiontag === "ca") { } else if (regiontag === "ca") {
regiontag = "CA"; regiontag = "CA";
regionCode = "ca"; regionCode = "ca";
} }
} }
return (
<FormControl style={{ display: "flex", flexDirection: "column", marginTop: 5, alignItems: "center" }} >
{/* <InputLabel id="demo-simple-select-label">Region</InputLabel> */}
<Select
labelId="demo-simple-select-label"
id="demo-simple-select"
value={regiontag}
style={{minWidth: 120, height: 35, borderRadius: 4 }}
onChange={(e) => {
if(userdata?.support){
setSelectedRegion(e.target.value)
}else{
handleSendChangeRegionMail(e.target.value)
}
}}
>
{Object.keys(regionMapping).map((region, index) => {
const regionImageCode = regionMapping[region];
// Set the default region if selectedOrganization.region is not set
if (selectedOrganization.region === undefined) {
selectedOrganization.region = "europe-west2";
}
// Check if the current region matches the selected region return (
if (region === selectedOrganization.region) { <FormControl style={{ display: "flex", flexDirection: "column", marginTop: 5, alignItems: "center" }} >
// If the region matches, set the MenuItem as selected {/* <InputLabel id="demo-simple-select-label">Region</InputLabel> */}
return ( <Select
<MenuItem value={region} key={index} disabled> labelId="demo-simple-select-label"
{/* show region image through cdn */} id="demo-simple-select"
<img src={`https://flagcdn.com/48x36/${regionImageCode}.png`} alt={region} style={{ marginRight: 10 }} /> value={regiontag}
style={{ minWidth: 120, height: 35, borderRadius: 4 }}
onChange={(e) => {
if (userdata?.support) {
setSelectedRegion(e.target.value)
} else {
handleSendChangeRegionMail(e.target.value)
}
}}
>
{Object.keys(regionMapping).map((region, index) => {
const regionImageCode = regionMapping[region];
// Set the default region if selectedOrganization.region is not set
if (selectedOrganization.region === undefined) {
selectedOrganization.region = "europe-west2";
}
// Check if the current region matches the selected region
if (region === selectedOrganization.region) {
// If the region matches, set the MenuItem as selected
return (
<MenuItem value={region} key={index} disabled>
{/* show region image through cdn */}
<img src={`https://flagcdn.com/48x36/${regionImageCode}.png`} alt={region} style={{ marginRight: 10 }} />
{region}
</MenuItem>
);
} else {
return <MenuItem sx={{ display: 'flex' }} key={index} value={region}>
<img
src={`https://flagcdn.com/48x36/${regionImageCode}.png`}
alt={region}
style={{ marginRight: 10, width: 20, height: 18, }}
/>
{region} {region}
</MenuItem>
);
} else {
return <MenuItem sx={{display: 'flex'}} key={index} value={region}>
<img
src={`https://flagcdn.com/48x36/${regionImageCode}.png`}
alt={region}
style={{ marginRight: 10, width: 20, height: 18,}}
/>
{region}
</MenuItem>; </MenuItem>;
} }
})} })}
</Select> </Select>
</FormControl> </FormControl>
); );
}) })
+29 -5
View File
@@ -214,6 +214,20 @@ const ParsedAction = (props) => {
} }
}, [expansionModalOpen]) }, [expansionModalOpen])
/*
useEffect(() => {
// This will have the OLD selectedAction, not the new one huh?
// How do we map the fields correctly?
if (selectedAction === undefined || selectedAction === null) {
console.log("Selected action is undefined")
return
}
console.log("Selected action: ", selectedAction?.name, selectedAction)
}, [selectedAction])
*/
useEffect(() => { useEffect(() => {
// Changes the order of params to show in order: // Changes the order of params to show in order:
// auth, required, optional // auth, required, optional
@@ -347,7 +361,7 @@ const ParsedAction = (props) => {
} }
if (keyorder.join(",") !== newkeyorder.join(",")) { if (keyorder.join(",") !== newkeyorder.join(",")) {
//toast("KEYORDER CHANGED!") console.log("KEYORDER CHANGED! DID ACTION AS WELL?", keyorder, newkeyorder)
setSelectedActionParameters(newparams) setSelectedActionParameters(newparams)
selectedAction.parameters = newparams selectedAction.parameters = newparams
@@ -872,7 +886,7 @@ const ParsedAction = (props) => {
} }
} }
return { ...param, value: paramvalue, error: message } return { ...param, value: paramvalue, error: message }
}); })
setSelectedActionParameters(newParameters) setSelectedActionParameters(newParameters)
setActionlist(newActionList) setActionlist(newActionList)
@@ -3645,6 +3659,14 @@ const ParsedAction = (props) => {
); );
if ((multiline === undefined || multiline === false) && ((data?.autocompleted === true || data?.field_active === true) || data.name.startsWith("${") && data.name.endsWith("}"))) {
multiline = true
}
if (data?.autocompleted === true || data?.field_active === true) {
rows = "1"
}
var datafield = ( var datafield = (
<Tooltip <Tooltip
title={tooltipDescription} title={tooltipDescription}
@@ -3725,7 +3747,8 @@ const ParsedAction = (props) => {
setScrollConfig(scrollConfig) setScrollConfig(scrollConfig)
} }
}} }}
rows={data.name.startsWith("${") && data.name.endsWith("}") ? 2 : rows} minRows={rows}
maxRows={6}
color="primary" color="primary"
// defaultValue={data.value} // defaultValue={data.value}
value={ value={
@@ -4034,7 +4057,8 @@ const ParsedAction = (props) => {
helperText={returnHelperText(data.name, data.value)} helperText={returnHelperText(data.name, data.value)}
fullWidth fullWidth
multiline={multiline} multiline={multiline}
rows={"3"} minRows={3}
maxRows={6}
color="primary" color="primary"
defaultValue={data.value} defaultValue={data.value}
type={"text"} type={"text"}
@@ -4580,7 +4604,7 @@ const ParsedAction = (props) => {
data.field_active === true ? data.field_active === true ?
<Tooltip <Tooltip
color="primary" color="primary"
title={"This is an Simplified field to make the body easier to use. NOT required according to the API documentation. If this is filled, it will be overridden in the Advanced Body"} title={"This is a Simplified Field to make the body easier to use. NOT required according to the API documentation. If this is filled, it will be overridden in the Advanced Body"}
placement="top" placement="top"
> >
<PriorityHighIcon <PriorityHighIcon
+4 -19
View File
@@ -354,13 +354,13 @@ const RuntimeDebugger = (props) => {
var imageSource = ""; var imageSource = "";
if (params?.row?.org?.id?.length > 0) { if (params?.row?.org?.id?.length > 0) {
if (params?.row?.org?.image?.length > 0){ if (params?.row?.org?.image?.length > 0){
imageSource = params.row.org.image imageSource = params?.row.org?.image
}else { }else {
imageSource = "/images/no_image.png" imageSource = "/images/no_image.png"
} }
}else { }else {
if (userdata.active_org.image?.length > 0){ if (userdata.active_org.image?.length > 0){
imageSource = userdata.active_org.image imageSource = userdata?.active_org?.image
}else { }else {
imageSource = "/images/no_image.png" imageSource = "/images/no_image.png"
} }
@@ -370,7 +370,7 @@ const RuntimeDebugger = (props) => {
<span style={{}} onClick={() => { <span style={{}} onClick={() => {
//setStatus(params.row.status) //setStatus(params.row.status)
}}> }}>
{userdata?.active_org?.creator_org?.length === 0 ? ( {userdata?.active_org?.creator_org?.length === 0 && suborgWorkflowRuns ? (
<img src={imageSource} alt={source} style={{borderRadius: theme.palette?.borderRadius, height: imageSize, width: imageSize, }} /> <img src={imageSource} alt={source} style={{borderRadius: theme.palette?.borderRadius, height: imageSize, width: imageSize, }} />
) : null} ) : null}
<Tooltip title={source} placement="top"> <Tooltip title={source} placement="top">
@@ -924,28 +924,13 @@ const RuntimeDebugger = (props) => {
onClick={() => setSearchQuery('')} onClick={() => setSearchQuery('')}
/> />
)} )}
<button
type="button"
style={{
color: "#1A1A1A",
border: "none",
padding: "10px 20px",
width: 100,
height: 35,
borderRadius: 4,
backgroundColor: "#FF8544",
cursor: "pointer",
}}
>
Search
</button>
</InputAdornment> </InputAdornment>
), ),
}} }}
onChange={(e)=>{handleQueryChange(e)}} onChange={(e)=>{handleQueryChange(e)}}
color="primary" color="primary"
placeholder="Filter by Workflow Name, Status, Execution Argument, Results.." placeholder="Filter by Workflow Name, Status, Execution Argument, Results"
id="shuffle_search_field" id="shuffle_search_field"
/> />
</div> </div>
+6
View File
@@ -109,6 +109,12 @@ const SearchData = props => {
} }
}, [searchOpen]); }, [searchOpen]);
useEffect(() => {
if (currentRefinement !== inputValue) {
refine(inputValue);
}
}, [currentRefinement]);
return ( return (
<form id="search_form" noValidate type="searchbox" action="" role="search" onClick={() => { <form id="search_form" noValidate type="searchbox" action="" role="search" onClick={() => {
@@ -27,6 +27,7 @@ import { SetJsonDotnotation } from "../views/AngularWorkflow.jsx";
import Draggable from "react-draggable"; import Draggable from "react-draggable";
import { import {
Storage as StorageIcon,
FullscreenExit as FullscreenExitIcon, FullscreenExit as FullscreenExitIcon,
Extension as ExtensionIcon, Extension as ExtensionIcon,
Apps as AppsIcon, Apps as AppsIcon,
@@ -90,7 +91,7 @@ const pythonFilters = [
{ "name": "Using Shuffle variables", "value": `import json\nnodevalue = r\"\"\"$exec\"\"\"\nif not nodevalue:\n nodevalue = r\"\"\"{\"sample\": \"string\", \"int\": 1}\"\"\"\n \njsondata = json.loads(nodevalue)\nprint(jsondata)`, "example": `` }, { "name": "Using Shuffle variables", "value": `import json\nnodevalue = r\"\"\"$exec\"\"\"\nif not nodevalue:\n nodevalue = r\"\"\"{\"sample\": \"string\", \"int\": 1}\"\"\"\n \njsondata = json.loads(nodevalue)\nprint(jsondata)`, "example": `` },
{ "name": "Print Execution ID", "value": `print(self.current_execution_id)`, "example": `` }, { "name": "Print Execution ID", "value": `print(self.current_execution_id)`, "example": `` },
{ "name": "Get full execution details", "value": `print(self.full_execution)`, "example": `` }, { "name": "Get full execution details", "value": `print(self.full_execution)`, "example": `` },
{ "name": "Use files", "value": `# Create a sample file\nfiles = [{\n \"name\": \"test.txt\",\n \"data\": \"Testdata\"\n}]\nret = self.set_files(files)\n\n# Get the content of the file from Shuffle storage\n# Originally a byte string in the \"data\" key\nfile_content = (self.get_file(ret[0])[\"data\"]).decode()\nprint(file_content)`, "example": `` }, { "name": "Use files", "value": `# Create a sample file\nfiles = [{\n \"filename\": \"test.txt\",\n \"data\": \"Testdata\"\n}]\nret = self.set_files(files)\n\n# Get the content of the file from Shuffle storage\n# Originally a byte string in the \"data\" key\nfile_content = (self.get_file(ret[0])[\"data\"]).decode()\nprint(file_content)`, "example": `` },
{ "name": "Use datastore", "value": `key = \"testkey\"\nvalue = \"The value of the testkey\"\n\nself.set_cache(key, value)\n\n# Print the details of the key after it's been updated\n# To get the value, use self.get_cache(key)[\"value\"]\nprint(self.get_cache(key))`, "example": `` }, { "name": "Use datastore", "value": `key = \"testkey\"\nvalue = \"The value of the testkey\"\n\nself.set_cache(key, value)\n\n# Print the details of the key after it's been updated\n# To get the value, use self.get_cache(key)[\"value\"]\nprint(self.get_cache(key))`, "example": `` },
{ "name": "Run an App Action", "value": `response = shuffle.run_app(app_id="app", action="action_name", auth="authentication_id", params={})\nprint(response)`, "example": ``, "disabled": true, }, { "name": "Run an App Action", "value": `response = shuffle.run_app(app_id="app", action="action_name", auth="authentication_id", params={})\nprint(response)`, "example": ``, "disabled": true, },
@@ -1805,9 +1806,11 @@ const CodeEditor = (props) => {
) : innerdata.type === "workflow_variable" || ) : innerdata.type === "workflow_variable" ||
innerdata.type === "execution_variable" ? ( innerdata.type === "execution_variable" ? (
<FavoriteBorderIcon style={{ marginRight: 10 }} /> <FavoriteBorderIcon style={{ marginRight: 10 }} />
) : ( ) :
innerdata.type === "Shuffle DB" ?
<StorageIcon style={{ marginRight: 10, }} />
:
<ScheduleIcon style={{ marginRight: 10 }} /> <ScheduleIcon style={{ marginRight: 10 }} />
);
const handleExecArgumentHover = (inside) => { const handleExecArgumentHover = (inside) => {
var exec_text_field = document.getElementById( var exec_text_field = document.getElementById(
@@ -1877,8 +1880,6 @@ const CodeEditor = (props) => {
menuPosition1.left = 0 menuPosition1.left = 0
} }
//console.log("POS1: ", menuPosition1)
return parsedPaths.length > 0 ? ( return parsedPaths.length > 0 ? (
<NestedMenuItem <NestedMenuItem
key={innerdata.name} key={innerdata.name}
+11 -1
View File
@@ -1335,7 +1335,7 @@ const UserManagmentTab = memo((props) => {
}} }}
> >
<ListItem style={{ width: "100%", padding: "10px 10px 10px 0px", verticalAlign: 'middle', borderBottom: "1px solid #494949", display: "table-row" }}> <ListItem style={{ width: "100%", padding: "10px 10px 10px 0px", verticalAlign: 'middle', borderBottom: "1px solid #494949", display: "table-row" }}>
{["Username", "API Key", "Role", "Active", "Type", "MFA", ...(selectedOrganization?.child_orgs?.length > 0 ? ["Suborgs"]: []), "Actions", "Last Login"].map((header, index) => ( {["Username", /*"API Key",*/ "Role", /*"Active",*/ "Type", "MFA", ...(selectedOrganization?.child_orgs?.length > 0 ? ["Suborgs"]: []), "Actions", "Last Login"].map((header, index) => (
<ListItemText <ListItemText
key={index} key={index}
primary={header} primary={header}
@@ -1458,6 +1458,8 @@ const UserManagmentTab = memo((props) => {
}} }}
style={{display:'table-cell', verticalAlign: 'middle' }} style={{display:'table-cell', verticalAlign: 'middle' }}
/> />
{/*
<ListItemText <ListItemText
style={{ style={{
textAlign: "center", textAlign: "center",
@@ -1488,6 +1490,8 @@ const UserManagmentTab = memo((props) => {
) )
} }
/> />
*/}
<ListItemText <ListItemText
primary={ primary={
<Select <Select
@@ -1552,10 +1556,12 @@ const UserManagmentTab = memo((props) => {
} }
style={{ display:'table-cell', verticalAlign: 'middle' }} style={{ display:'table-cell', verticalAlign: 'middle' }}
/> />
<ListItemText <ListItemText
primary={data.active ? "True" : "False"} primary={data.active ? "True" : "False"}
style={{display:'table-cell',verticalAlign: 'middle' , padding: "8px", textAlign: "center", color: data.active ? "#02CB70" : "#F53434" }} style={{display:'table-cell',verticalAlign: 'middle' , padding: "8px", textAlign: "center", color: data.active ? "#02CB70" : "#F53434" }}
/> />
<ListItemText <ListItemText
primary={ primary={
data.login_type === undefined || data.login_type === undefined ||
@@ -1566,6 +1572,8 @@ const UserManagmentTab = memo((props) => {
} }
style={{ display:'table-cell',verticalAlign: 'middle', padding: "8px", }} style={{ display:'table-cell',verticalAlign: 'middle', padding: "8px", }}
/> />
{/*
<ListItemText <ListItemText
primary={ primary={
data?.mfa_info !== undefined && data?.mfa_info !== undefined &&
@@ -1576,6 +1584,8 @@ const UserManagmentTab = memo((props) => {
} }
style={{ display:'table-cell', verticalAlign: 'middle',padding: "8px", color: data.mfa_info.active ? "#02CB70" : "#F53434" }} style={{ display:'table-cell', verticalAlign: 'middle',padding: "8px", color: data.mfa_info.active ? "#02CB70" : "#F53434" }}
/> />
*/}
{selectedOrganization?.child_orgs !== undefined && {selectedOrganization?.child_orgs !== undefined &&
selectedOrganization?.child_orgs !== null && selectedOrganization?.child_orgs !== null &&
selectedOrganization?.child_orgs?.length > 0 ? ( selectedOrganization?.child_orgs?.length > 0 ? (
+225 -183
View File
@@ -1203,18 +1203,15 @@ const AngularWorkflow = (defaultprops) => {
if (workflowExecutions.length > 0) { if (workflowExecutions.length > 0) {
// Look for the ID // Look for the ID
for (let execkey in workflowExecutions) { for (let execkey in workflowExecutions) {
if ( if (workflowExecutions[execkey].results === undefined || workflowExecutions[execkey].results === null) {
workflowExecutions[execkey].results === undefined || continue
workflowExecutions[execkey].results === null
) {
continue;
} }
var foundResult = workflowExecutions[execkey].results.find( var foundResult = workflowExecutions[execkey].results.find(
(result) => result.action.id === item.id (result) => result.action.id === item.id
); )
if (foundResult === undefined) { if (foundResult === undefined) {
continue; continue
} }
const validated = validateJson(foundResult.result) const validated = validateJson(foundResult.result)
@@ -4863,6 +4860,177 @@ const AngularWorkflow = (defaultprops) => {
}) })
}; };
// Check if it already has any non-decorator branches attached to it
const findClosestNode = (event, nodedata) => {
if (cy === undefined || cy === null) {
console.log("Cy is undefined or null")
return
}
if (event === undefined || event === null) {
console.log("Event is undefined or null")
return
}
if (event.target === undefined || event.target === null) {
console.log("Event target is undefined or null")
return
}
if (!((nodedata?.trigger_type === "SUBFLOW" || nodedata?.trigger_type === "USERINPUT" || nodedata?.type === "ACTION") && !nodedata?.isStartNode)) {
//console.log("Not a valid node to find closest node for")
return
}
if (nodedata.finished === false) {
//console.log("Node is not finished")
return
}
const branches = cy.elements('edge').jsons()
var branchFound = false
var decoratorNodeIds = []
var decoratorIds = []
for (var branchkey in branches) {
if (branches[branchkey].data.source === nodedata.id || branches[branchkey].data.target === nodedata.id) {
decoratorIds.push(branches[branchkey].data.id)
if (branches[branchkey].data.decorator === true) {
// Add the source/destination
if (branches[branchkey].data.source === nodedata.id) {
decoratorNodeIds.push(branches[branchkey].data.target)
} else {
decoratorNodeIds.push(branches[branchkey].data.source)
}
continue
}
//branchFound = true
//break
}
}
if (!branchFound) {
var relevantNodes = []
const minDistance = 225
const draggedNode = event.target
const allnodes = cy.nodes().jsons()
for (var nodekey in allnodes) {
const node = allnodes[nodekey]
if (node.data.id === nodedata.id) {
continue
}
// Decorators
if (node.data.attachedTo !== undefined) {
continue
}
if (node.position === undefined || node.position === null || node.position.x === undefined || node.position.y === undefined) {
continue
}
if (node.data.type !== "ACTION" && node.data.type !== "TRIGGER") {
continue
}
const distance = Math.sqrt(
Math.pow(draggedNode.position('x') - node.position.x, 2) +
Math.pow(draggedNode.position('y') - node.position.y, 2)
)
if (decoratorNodeIds.includes(node.data.id)) {
// Drag a little farther to remove it
if (distance > minDistance + 75) {
// Remove the branch? Why?
const edgeToRemove = cy.getElementById(branches[branchkey].data.id)
if (edgeToRemove !== null && edgeToRemove !== undefined) {
//console.log("Removing edge: ", edgeToRemove)
edgeToRemove.remove()
break
}
}
}
if (distance < minDistance) {
relevantNodes.push(node)
//minDistance = distance
//closestNode = node
}
}
for (var key in relevantNodes) {
const closestNode = relevantNodes[key]
if (closestNode.data.app_name === "Webhook" || closestNode.data.app_name === "Schedule") {
return
}
// Checks if the branch already exists between the nodes
if (decoratorIds.length > 0) {
var foundBranch = false
for (var decoratorkey in decoratorIds) {
const decoratorEdge = cy.getElementById(decoratorIds[decoratorkey])
if (decoratorEdge === null || decoratorEdge === undefined) {
continue
}
// Check if source and destination exists with a branch
const sourceId = decoratorEdge.data("source")
const targetId = decoratorEdge.data("target")
if ((sourceId === closestNode.data.id && targetId === nodedata.id) || (sourceId === nodedata.id && targetId === closestNode.data.id)) {
foundBranch = true
break
}
}
if (foundBranch) {
continue
}
}
const newId = uuidv4()
cy.add({
group: "edges",
data: {
decorator: true,
id: newId,
_id: newId,
source: closestNode.data.id,
target: nodedata.id,
label: releaseToConnectLabel,
conditions: [],
}
})
}
}
/*
// FIXME: This is the start of a highlighter for the node
// to better match it up with other elements
// 1. Get current node's position in X/Y on the screen
// 2. Draw a red line on the X and Y axis for positioning
// Draw a red div line in the HTML
const position = event.target.position()
const redline = document.getElementById("redline")
if (redline !== null && redline !== undefined) {
redline.style.display = "block"
redline.style.position = "absolute"
redline.style.left = position.x + "px"
redline.style.top = position.y + "px"
redline.style.height = "10000px"
redline.style.width = 1
console.log("REDLINE!")
}
*/
}
const onNodeDrag = (event, selectedAction) => { const onNodeDrag = (event, selectedAction) => {
const nodedata = event.target.data(); const nodedata = event.target.data();
@@ -4906,161 +5074,9 @@ const AngularWorkflow = (defaultprops) => {
return; return;
} }
// Finds closest partner to show edge to connect to
if ((nodedata.trigger_type === "SUBFLOW" || nodedata.trigger_type === "USERINPUT" || nodedata.type === "ACTION") && !nodedata.isStartNode) { if ((nodedata.trigger_type === "SUBFLOW" || nodedata.trigger_type === "USERINPUT" || nodedata.type === "ACTION") && !nodedata.isStartNode) {
// Check if it already has any non-decorator branches attached to it findClosestNode(event, nodedata)
const branches = cy.elements('edge').jsons()
var branchFound = false
var decoratorIds = []
for (var branchkey in branches) {
if (branches[branchkey].data.source === nodedata.id || branches[branchkey].data.target === nodedata.id) {
if (branches[branchkey].data.decorator === true) {
// Add the source/destination
if (branches[branchkey].data.source === nodedata.id) {
decoratorIds.push(branches[branchkey].data.target)
} else {
decoratorIds.push(branches[branchkey].data.source)
}
continue
}
branchFound = true
break
}
}
if (!branchFound) {
//console.log("Found action during drag. Checking closest nodes as it doesn't have a valid branch")
var closestNode = null
var minDistance = 300
const draggedNode = event.target
const allnodes = cy.nodes().jsons()
for (var nodekey in allnodes) {
const node = allnodes[nodekey]
if (node.data.id === nodedata.id) {
continue
}
// Decorators
if (node.data.attachedTo !== undefined) {
continue
}
if (node.position === undefined || node.position === null || node.position.x === undefined || node.position.y === undefined) {
continue
}
if (node.data.type !== "ACTION" && node.data.type !== "TRIGGER") {
continue
}
const distance = Math.sqrt(
Math.pow(draggedNode.position('x') - node.position.x, 2) +
Math.pow(draggedNode.position('y') - node.position.y, 2)
)
if (decoratorIds.includes(node.data.id)) {
//console.log("Found existing decorator for: ", node.data.app_name, "Distance: ", distance)
if (distance > 300) {
// Remove the branch
const edgeToRemove = cy.getElementById(branches[branchkey].data.id)
if (edgeToRemove !== null && edgeToRemove !== undefined) {
//console.log("Removing edge: ", edgeToRemove)
edgeToRemove.remove()
//decoratorIds.splice(decoratorIds.indexOf(node.data.id), 1)
break
}
}
}
if (distance < minDistance) {
minDistance = distance
closestNode = node
}
}
if (closestNode !== null && closestNode !== undefined) {
if (closestNode.data.app_name === "Webhook" || closestNode.data.app_name === "Schedule") {
return
}
//console.log("Closest node app: ", closestNode.data.app_name, "Distance: ", minDistance)
/*
if (decoratorIds.length > 0) {
console.log("Decorators already exists. If within distance of 15 add to existing, otherwise remove old and add new: ", decoratorIds)
for (var decoratorkey in decoratorIds) {
const decoratorEdge = cy.getElementById(decoratorIds[decoratorkey])
if (decoratorEdge === null || decoratorEdge === undefined) {
continue
}
const sourceNode = cy.getElementById(decoratorEdge.data.source)
const targetNode = cy.getElementById(decoratorEdge.data.target)
const distance = Math.sqrt(
Math.pow(draggedNode.position('x') - sourceNode.position('x'), 2) +
Math.pow(draggedNode.position('y') - sourceNode.position('y'), 2)
)
// Check plus minus 15 in distance from mindistance
if (distance > minDistance - 15 && distance < minDistance + 15) {
console.log("Within distance of 15, add to existing edge")
} else {
console.log("Outside distance of 15, remove old edge and add new")
}
}
}
*/
if (decoratorIds.length === 0) {
//const edgeCurve = calculateEdgeCurve(draggedNode.position(), closestNode.position)
//currentedge.style('control-point-distance', edgeCurve.distance)
//currentedge.style('control-point-weight', edgeCurve.weight)
const newId = uuidv4()
cy.add({
group: "edges",
data: {
decorator: true,
id: newId,
_id: newId,
source: closestNode.data.id,
target: nodedata.id,
label: releaseToConnectLabel,
conditions: [],
}
})
}
}
}
/*
// FIXME: This is the start of a highlighter for the node
// to better match it up with other elements
// 1. Get current node's position in X/Y on the screen
// 2. Draw a red line on the X and Y axis for positioning
// Draw a red div line in the HTML
const position = event.target.position()
const redline = document.getElementById("redline")
if (redline !== null && redline !== undefined) {
redline.style.display = "block"
redline.style.position = "absolute"
redline.style.left = position.x + "px"
redline.style.top = position.y + "px"
redline.style.height = "10000px"
redline.style.width = 1
console.log("REDLINE!")
}
*/
} }
if (originalLocation.x === 0 && originalLocation.y === 0 && nodedata.position !== undefined) { if (originalLocation.x === 0 && originalLocation.y === 0 && nodedata.position !== undefined) {
@@ -5222,7 +5238,9 @@ const AngularWorkflow = (defaultprops) => {
name: item.label, name: item.label,
autocomplete: itemlabelComplete, autocomplete: itemlabelComplete,
example: exampledata, example: exampledata,
}; }
console.log("VALUE: ", actionvalue)
actionlist.push(actionvalue); actionlist.push(actionvalue);
} }
@@ -5736,7 +5754,6 @@ const AngularWorkflow = (defaultprops) => {
return return
} else if (data.buttonType === "copy") { } else if (data.buttonType === "copy") {
console.log("COPY!");
// 1. Find parent // 1. Find parent
// 2. Find branches for parent // 2. Find branches for parent
@@ -6198,8 +6215,10 @@ const AngularWorkflow = (defaultprops) => {
} }
} }
setSelectedApp(curapp) setTimeout(() => {
setSelectedAction(curaction) setSelectedApp(curapp)
setSelectedAction(curaction)
}, 50)
cy.removeListener("drag"); cy.removeListener("drag");
cy.removeListener("free"); cy.removeListener("free");
@@ -10658,6 +10677,7 @@ const AngularWorkflow = (defaultprops) => {
return return
} }
// HTML -> Canvas overlap check // HTML -> Canvas overlap check
if ( if (
e.pageX > cycontainer.offsetLeft e.pageX > cycontainer.offsetLeft
@@ -10670,6 +10690,9 @@ const AngularWorkflow = (defaultprops) => {
return return
} }
findClosestNode({
target: currentnode,
}, currentnode.data())
currentnode[0].renderedPosition("x", e.pageX - cycontainer.offsetLeft) currentnode[0].renderedPosition("x", e.pageX - cycontainer.offsetLeft)
currentnode[0].renderedPosition("y", e.pageY - cycontainer.offsetTop) currentnode[0].renderedPosition("y", e.pageY - cycontainer.offsetTop)
@@ -17734,10 +17757,24 @@ const AngularWorkflow = (defaultprops) => {
onChange={(e) => { onChange={(e) => {
if (lastSaved === false && originalWorkflow.id === workflow.id) { if (lastSaved === false && originalWorkflow.id === workflow.id) {
setSuborgWorkflows([]) setSuborgWorkflows([])
saveWorkflow(workflow, undefined, undefined, e.target.value) saveWorkflow(workflow, undefined, undefined, e.target.value)
toast.warn(`Saving workflow first due to detected changes. If more than 10 auth`, {
/* Standard re-loads */
setAllTriggers(undefined)
setSelectedTriggerIndex(-1)
getEnvironments(e.target.value)
getAppAuthentication(undefined, undefined, undefined, e.target.value)
getFiles(e.target.value)
listOrgCache(e.target.value)
/* Standard re-loads */
toast.warn(`Saving workflow first due to detected changes.`, {
autoClose: 2000, autoClose: 2000,
}) })
return return
} }
@@ -17761,12 +17798,14 @@ const AngularWorkflow = (defaultprops) => {
} }
ReactDOM.unstable_batchedUpdates(() => { ReactDOM.unstable_batchedUpdates(() => {
/* Standard re-loads */
setAllTriggers(undefined) setAllTriggers(undefined)
setSelectedTriggerIndex(-1) setSelectedTriggerIndex(-1)
getEnvironments(e.target.value) getEnvironments(e.target.value)
getAppAuthentication(undefined, undefined, undefined, e.target.value) getAppAuthentication(undefined, undefined, undefined, e.target.value)
getFiles(e.target.value) getFiles(e.target.value)
listOrgCache(e.target.value) listOrgCache(e.target.value)
/* Standard re-loads */
// Reset the save button to ensure random saves don't occur during move // Reset the save button to ensure random saves don't occur during move
setLastSaved(true) setLastSaved(true)
@@ -19035,7 +19074,7 @@ const AngularWorkflow = (defaultprops) => {
{workflow.public || userdata.support == true ? {workflow.public || userdata.support == true ?
<Tooltip <Tooltip
color="secondary" color="secondary"
title="Download public workflow" title="Download workflow"
placement="top-start" placement="top-start"
> >
<span> <span>
@@ -20038,7 +20077,8 @@ const AngularWorkflow = (defaultprops) => {
} }
} }
to_be_copied.replaceAll(" ", "_"); to_be_copied = to_be_copied.replaceAll(" ", "_");
console.log("COPY: ", to_be_copied);
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) {
@@ -21562,19 +21602,21 @@ const AngularWorkflow = (defaultprops) => {
const checked = validateJson(data.value.trim()) const checked = validateJson(data.value.trim())
if (data.name === "shuffle_action_logs" && data.value !== undefined && data.value !== null && data.value.length > 0 && data.value.includes("add env SHUFFLE_LOGS_DISABLED")) { if (data.name === "shuffle_action_logs" && data.value !== undefined && data.value !== null && data.value.length > 0 && data.value.includes("add env SHUFFLE_LOGS_DISABLED")) {
return ( data.value = `Logs for this action are not available without <a style={{ color: "#FF8544", }} href="/admin?tab=locations" target="_blank" rel="noopener noreferrer">an onprem environment</a> with the <a style={{ color: "#FF8544", }} href="/docs/configuration#scaling-shuffle" target="_blank" rel="noopener noreferrer">SHUFFLE_LOGS_DISABLED</a> environment variable set to false: SHUFFLE_LOGS_DISABLED=false. Logs are enabled by default, except in scale mode.`
<div style={{ maxWidth: 600, marginTop: 15, overflowX: "hidden", }}> /*
<Typography return (
variant="body1" <div style={{ maxWidth: 600, marginTop: 15, overflowX: "hidden", }}>
style={{}} <Typography
> variant="body1"
<b>Action Logs</b> style={{}}
</Typography> >
<Typography variant="body2" style={{ whiteSpace: 'pre-line', }}> <b>Action Logs</b>
Logs for an action are not available without <a style={{ color: "#FF8544", }} href="/admin?tab=locations" target="_blank" rel="noopener noreferrer">an onprem environment</a> with the <a style={{ color: "#FF8544", }} href="/docs/configuration#scaling-shuffle" target="_blank" rel="noopener noreferrer">SHUFFLE_LOGS_DISABLED</a> environment variable set to false: SHUFFLE_LOGS_DISABLED=false. Logs are enabled by default, except in scale mode. </Typography>
</Typography> <Typography variant="body2" style={{ whiteSpace: 'pre-line', }}>
</div> </Typography>
) </div>
)
*/
} }
var showlink = false var showlink = false
@@ -22139,9 +22181,9 @@ const AngularWorkflow = (defaultprops) => {
variant="h6" variant="h6"
style={{ marginBottom: 0, marginTop: 0 }} style={{ marginBottom: 0, marginTop: 0 }}
> >
Variables <span style={{ fontSize: 10 }}>(click to expand)</span> Variable & Debug info <span style={{ fontSize: 10 }}>({selectedResult?.action?.parameters?.length})</span>
</Typography> </Typography>
{selectedResult.action.parameters.map((data, index) => { {selectedResult?.action?.parameters?.map((data, index) => {
if (data.value.length === 0) { if (data.value.length === 0) {
return null; return null;
} }
+7 -4
View File
@@ -176,16 +176,18 @@ export const GetParsedPaths = (inputdata, basekey) => {
} }
if (typeof inputdata !== "object") { if (typeof inputdata !== "object") {
return parsedValues; return parsedValues
} }
for (const [key, value] of Object.entries(inputdata)) { for (var [key, value] of Object.entries(inputdata)) {
key = key.replaceAll(" ", "_")
// Check if loop or JSON // Check if loop or JSON
const extra = basekey.length > 0 ? splitkey : ""; const extra = basekey.length > 0 ? splitkey : "";
const basekeyname = `${basekey const basekeyname = `${basekey
.slice(1, basekey.length) .slice(1, basekey.length)
.split(".") .split(".")
.join(splitkey)}${extra}${key}`; .join(splitkey)}${extra}${key}`
// Handle direct loop! // Handle direct loop!
if (!isNaN(key) && basekey === "") { if (!isNaN(key) && basekey === "") {
@@ -205,7 +207,8 @@ export const GetParsedPaths = (inputdata, basekey) => {
type: "list", type: "list",
name: `${splitkey}list`, name: `${splitkey}list`,
autocomplete: `${basekey.replaceAll(" ", "_")}.#`, autocomplete: `${basekey.replaceAll(" ", "_")}.#`,
}); })
const returnValues = GetParsedPaths(value, `${basekey}.#`); const returnValues = GetParsedPaths(value, `${basekey}.#`);
for (var subkey in returnValues) { for (var subkey in returnValues) {
parsedValues.push(returnValues[subkey]); parsedValues.push(returnValues[subkey]);
+29 -8
View File
@@ -49,7 +49,7 @@ const searchClient = algoliasearch(
); );
// AppCard Component // AppCard Component
const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl, deactivatedIndexes, currTab, handleAppClick, leftSideBarOpenByClick, userdata, fetchApps }) => { const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl, deactivatedIndexes, currTab, handleAppClick, leftSideBarOpenByClick, userdata, fetchApps, appsToShow, setAppsToShow, setUserApps, }) => {
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}`;
@@ -223,6 +223,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
) )
} }
<Button <Button
disabled={data?.reference_org === userdata?.active_org?.id}
className="deactivate-button" className="deactivate-button"
sx={{ sx={{
width: 110, width: 110,
@@ -244,7 +245,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
event.preventDefault(); event.preventDefault();
event.stopPropagation(); event.stopPropagation();
const url = `${globalUrl}/api/v1/apps/${data.id}/deactivate`; const url = `${globalUrl}/api/v1/apps/${data.id}/deactivate`;
toast("Deactivating app. Please wait..."); //toast("Deactivating app. Please wait...");
fetch(url, { fetch(url, {
method: 'GET', method: 'GET',
headers: { headers: {
@@ -256,11 +257,26 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
.then((response) => response.json()) .then((response) => response.json())
.then((responseJson) => { .then((responseJson) => {
if (responseJson.success === false) { if (responseJson.success === false) {
toast.error(responseJson.reason); if (responseJson?.reason !== undefined && responseJson?.reason !== null && responseJson?.reason !== "") {
toast.error(responseJson.reason);
} else {
toast.error("Failed to deactivate app. Please try again later.")
}
} else { } else {
toast.success("App Deactivated Successfully."); toast.success("App deactivated successfully. Will take effect on refresh..")
fetchApps();
} /*
// This somehow didn't work
if (appsToShow !== undefined && appsToShow !== null && appsToShow.length > 0) {
const newApps = appsToShow?.filter((app) => app.id !== data.id)
if (newApps !== undefined && newApps !== null && newApps.length > 0) {
setAppsToShow(newApps)
setUserApps(newApps)
}
}
}
*/
}
}) })
.catch(error => { .catch(error => {
console.log("app error: ", error.toString()); console.log("app error: ", error.toString());
@@ -1860,8 +1876,6 @@ 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">
@@ -2247,6 +2261,10 @@ const Apps2 = (props) => {
leftSideBarOpenByClick={leftSideBarOpenByClick} leftSideBarOpenByClick={leftSideBarOpenByClick}
userdata={userdata} userdata={userdata}
fetchApps={fetchApps} fetchApps={fetchApps}
setUserApps={setUserApps}
appsToShow={appsToShow}
setAppsToShow={setAppsToShow}
/> />
))} ))}
</div> </div>
@@ -2296,6 +2314,9 @@ const Apps2 = (props) => {
<AppCard key={index} data={data} index={index} mouseHoverIndex={mouseHoverIndex} setMouseHoverIndex={setMouseHoverIndex} globalUrl={globalUrl} deactivatedIndexes={deactivatedIndexes} currTab={currTab} userdata={userdata} <AppCard key={index} data={data} index={index} mouseHoverIndex={mouseHoverIndex} setMouseHoverIndex={setMouseHoverIndex} globalUrl={globalUrl} deactivatedIndexes={deactivatedIndexes} currTab={currTab} userdata={userdata}
handleAppClick={handleAppClick} leftSideBarOpenByClick={leftSideBarOpenByClick} handleAppClick={handleAppClick} leftSideBarOpenByClick={leftSideBarOpenByClick}
fetchApps={fetchApps} fetchApps={fetchApps}
setUserApps={setUserApps}
appsToShow={appsToShow}
setAppsToShow={setAppsToShow}
/> />
))} ))}
</div> </div>
+18
View File
@@ -77,6 +77,24 @@ const RunWorkflow = (defaultprops) => {
const [boxWidth, setBoxWidth] = React.useState(500) const [boxWidth, setBoxWidth] = React.useState(500)
const [inputQuestions, setInputQuestions] = React.useState([]) const [inputQuestions, setInputQuestions] = React.useState([])
useEffect(() => {
if (workflow === undefined || workflow === null || Object.keys(workflow).length === 0) {
return
}
if (workflow.input_questions === undefined || workflow.input_questions === null) {
return
}
// Checks if it's a user input-node based or not
if ((answer !== undefined && answer !== null) || (foundSourcenode !== undefined && foundSourcenode !== null)) {
} else {
setInputQuestions(workflow.input_questions)
setUpdate(Math.random())
}
}, [workflow])
const IframeWrapper = (props) => { const IframeWrapper = (props) => {
var propsCopy = JSON.parse(JSON.stringify(props)) var propsCopy = JSON.parse(JSON.stringify(props))
propsCopy.width = 400 propsCopy.width = 400
+1
View File
@@ -447,6 +447,7 @@ const Welcome = (props) => {
} }
navigate("/welcome?tab=2") navigate("/welcome?tab=2")
setActiveStep(1)
setShowWelcome(true) setShowWelcome(true)
}}> }}>
<CardActionArea style={actionObject}> <CardActionArea style={actionObject}>
+14 -2
View File
@@ -553,6 +553,10 @@ export const validateJson = (showResult) => {
// Check fields if they can be parsed too // Check fields if they can be parsed too
try { try {
for (const [key, value] of Object.entries(result)) { for (const [key, value] of Object.entries(result)) {
if (typeof value === "string") {
value = value.replaceAll(" ", "_")
}
if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) { if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) {
//console.log("CHECKING STRING: ", value) //console.log("CHECKING STRING: ", value)
@@ -573,6 +577,10 @@ export const validateJson = (showResult) => {
// Usually only reaches here if raw array > dict > value // Usually only reaches here if raw array > dict > value
if (typeof showResult !== "array") { if (typeof showResult !== "array") {
for (const [subkey, subvalue] of Object.entries(value)) { for (const [subkey, subvalue] of Object.entries(value)) {
if (typeof subvalue === "string") {
subvalue = subvalue.replaceAll(" ", "_")
}
if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) { if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) {
const inside_result = validateJson(subvalue) const inside_result = validateJson(subvalue)
if (inside_result.valid) { if (inside_result.valid) {
@@ -1841,9 +1849,13 @@ const Workflows = (props) => {
var parsedworkflows = []; var parsedworkflows = [];
for (var key in newSubflows) { for (var key in newSubflows) {
if (key === data.id) {
continue
}
const foundWorkflow = workflows.find( const foundWorkflow = workflows.find(
(workflow) => workflow.id === newSubflows[key] (workflow) => workflow.id === newSubflows[key]
); )
if (foundWorkflow !== undefined && foundWorkflow !== null) { if (foundWorkflow !== undefined && foundWorkflow !== null) {
parsedworkflows.push(foundWorkflow); parsedworkflows.push(foundWorkflow);
} }
@@ -1854,7 +1866,7 @@ const Workflows = (props) => {
"Appending subflows during export: ", "Appending subflows during export: ",
parsedworkflows.length parsedworkflows.length
); );
data.subflows = parsedworkflows; data.subflows = parsedworkflows
} }
} }
+4 -1
View File
@@ -1935,6 +1935,10 @@ const Workflows2 = (props) => {
var parsedworkflows = []; var parsedworkflows = [];
for (var key in newSubflows) { for (var key in newSubflows) {
if (key === data.id) {
continue
}
const foundWorkflow = workflows.find( const foundWorkflow = workflows.find(
(workflow) => workflow.id === newSubflows[key] (workflow) => workflow.id === newSubflows[key]
); );
@@ -2362,7 +2366,6 @@ const Workflows2 = (props) => {
<MenuItem <MenuItem
style={{ backgroundColor: theme.palette.inputColor, color: "white" }} style={{ backgroundColor: theme.palette.inputColor, color: "white" }}
disabled={isDistributed}
onClick={() => { onClick={() => {
setDeleteModalOpen(true); setDeleteModalOpen(true);
setSelectedWorkflowId(data.id); setSelectedWorkflowId(data.id);
+2 -2
View File
@@ -4,13 +4,13 @@ go 1.22.7
toolchain go1.22.11 toolchain go1.22.11
//replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared
require ( require (
github.com/docker/docker v27.5.0+incompatible github.com/docker/docker v27.5.0+incompatible
github.com/docker/go-connections v0.5.0 github.com/docker/go-connections v0.5.0
github.com/satori/go.uuid v1.2.0 github.com/satori/go.uuid v1.2.0
github.com/shuffle/shuffle-shared v0.7.96 github.com/shuffle/shuffle-shared v0.7.99
k8s.io/api v0.30.2 k8s.io/api v0.30.2
k8s.io/apimachinery v0.30.2 k8s.io/apimachinery v0.30.2
) )
+2
View File
@@ -319,6 +319,8 @@ github.com/shuffle/shuffle-shared v0.7.82 h1:La11F5jp9bNtM3VuR9PawyWo90/vZ+1Txo4
github.com/shuffle/shuffle-shared v0.7.82/go.mod h1:bBXhEsPKjxln0mFnSeri7gIJ3tL/636Sh5NyTyNrvIQ= github.com/shuffle/shuffle-shared v0.7.82/go.mod h1:bBXhEsPKjxln0mFnSeri7gIJ3tL/636Sh5NyTyNrvIQ=
github.com/shuffle/shuffle-shared v0.7.83 h1:OyyDo0ii8rOYHN5wGbcM94JuDKLmbZ9jhMQ0+/KMb0A= github.com/shuffle/shuffle-shared v0.7.83 h1:OyyDo0ii8rOYHN5wGbcM94JuDKLmbZ9jhMQ0+/KMb0A=
github.com/shuffle/shuffle-shared v0.7.83/go.mod h1:bBXhEsPKjxln0mFnSeri7gIJ3tL/636Sh5NyTyNrvIQ= github.com/shuffle/shuffle-shared v0.7.83/go.mod h1:bBXhEsPKjxln0mFnSeri7gIJ3tL/636Sh5NyTyNrvIQ=
github.com/shuffle/shuffle-shared v0.7.96 h1:mH6Bkzn8QIFntkcUxPfyMZJY2r7PNKfc0zWYjZXYQm8=
github.com/shuffle/shuffle-shared v0.7.96/go.mod h1:bBXhEsPKjxln0mFnSeri7gIJ3tL/636Sh5NyTyNrvIQ=
github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0=
github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
+37 -37
View File
@@ -1240,18 +1240,20 @@ func deployK8sWorker(image string, identifier string, env []string) error {
} }
func deployWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error { func deployWorker(image string, identifier string, env []string, executionRequest shuffle.ExecutionRequest) error {
if len(os.Getenv("REGISTRY_URL")) > 0 && os.Getenv("REGISTRY_URL") != "" { if len(os.Getenv("REGISTRY_URL")) > 0 && os.Getenv("REGISTRY_URL") != "" {
env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL"))) env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL")))
} }
// if isKubernetes == "true" { if swarmConfig == "run" || swarmConfig == "swarm" || isKubernetes == "true" {
// err := deployK8sWorker(image, identifier, env, executionRequest) // FIXME: Should we handle replies properly?
// if err != nil { // In certain cases, a workflow may e.g. be aborted already. If it's aborted, that returns
// log.Printf("[ERROR] Failed deploying Kubernetes worker: %s", err) // a 401 from the worker, which returns an error here
// } go sendWorkerRequest(executionRequest, image, env)
// return err return nil
// } }
// Binds is the actual "-v" volume. // Binds is the actual "-v" volume.
// Max 20% CPU every second // Max 20% CPU every second
@@ -1299,6 +1301,10 @@ func deployWorker(image string, identifier string, env []string, executionReques
} }
} }
//var swarmConfig = os.Getenv("SHUFFLE_SWARM_CONFIG")
parsedUuid := uuid.NewV4()
config := &container.Config{ config := &container.Config{
Image: image, Image: image,
Env: env, Env: env,
@@ -1312,17 +1318,6 @@ func deployWorker(image string, identifier string, env []string, executionReques
} }
} }
//var swarmConfig = os.Getenv("SHUFFLE_SWARM_CONFIG")
parsedUuid := uuid.NewV4()
if swarmConfig == "run" || swarmConfig == "swarm" || isKubernetes == "true" {
// FIXME: Should we handle replies properly?
// In certain cases, a workflow may e.g. be aborted already. If it's aborted, that returns
// a 401 from the worker, which returns an error here
go sendWorkerRequest(executionRequest, image, env)
return nil
}
//log.Printf("[INFO] Identifier: %s", identifier) //log.Printf("[INFO] Identifier: %s", identifier)
cont, err := dockercli.ContainerCreate( cont, err := dockercli.ContainerCreate(
context.Background(), context.Background(),
@@ -1356,6 +1351,8 @@ func deployWorker(image string, identifier string, env []string, executionReques
} }
} }
log.Printf("WORKER STARTING WITH ENV: %#v", env)
containerStartOptions := container.StartOptions{} containerStartOptions := container.StartOptions{}
err = dockercli.ContainerStart(context.Background(), cont.ID, containerStartOptions) err = dockercli.ContainerStart(context.Background(), cont.ID, containerStartOptions)
if err != nil { if err != nil {
@@ -1390,27 +1387,30 @@ func deployWorker(image string, identifier string, env []string, executionReques
log.Printf("[INFO][%s] Worker Container created (2). Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID) log.Printf("[INFO][%s] Worker Container created (2). Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID)
} }
//stats, err := cli.ContainerInspect(context.Background(), containerName) stats, err := dockercli.ContainerInspect(context.Background(), containerName)
//if err != nil { if err != nil {
// log.Printf("Failed checking worker %s", containerName) log.Printf("[WARNING] Failed checking worker %s", containerName)
// return return nil
//} }
//containerStatus := stats.ContainerJSONBase.State.Status containerStatus := stats.ContainerJSONBase.State.Status
//if containerStatus != "running" { if containerStatus != "running" {
// log.Printf("Status of %s is %s. Should be running. Will reset", containerName, containerStatus) log.Printf("[ERROR] Status of %s is %s. Should be running. Will reset", containerName, containerStatus)
// err = stopWorker(containerName) }
// if err != nil { /*
// log.Printf("Failed stopping worker %s", execution.ExecutionId) err = stopWorker(containerName)
// return if err != nil {
// } log.Printf("Failed stopping worker %s", execution.ExecutionId)
return nil
}
// err = deployWorke(cli, workerImage, containerName, env) err = deployWorker(dockercli, workerImage, containerName, env)
// if err != nil { if err != nil {
// log.Printf("Failed executing worker %s in state %s", execution.ExecutionId, containerStatus) log.Printf("Failed executing worker %s in state %s", execution.ExecutionId, containerStatus)
// return return nil
// } }
//} }
*/
} else { } else {
log.Printf("[INFO][%s] New Worker created. Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID) log.Printf("[INFO][%s] New Worker created. Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID)
} }