One of the final syncs before merges start happening for 2.0
This commit is contained in:
@@ -116,7 +116,7 @@ const AppGrid = (props) => {
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((response) => {
|
||||
if (response.success === true) {
|
||||
if (response?.success === true) {
|
||||
setFormMessage(response.reason);
|
||||
//toast("Thanks for submitting!")
|
||||
} else {
|
||||
@@ -307,7 +307,7 @@ const AppGrid = (props) => {
|
||||
})
|
||||
.then(response => response.json())
|
||||
.then(responseJson => {
|
||||
if (responseJson.success) {
|
||||
if (responseJson?.success) {
|
||||
setUserdata(responseJson);
|
||||
setAllActivatedAppIds(responseJson.active_apps)
|
||||
setIsLoggedIn(true);
|
||||
@@ -350,7 +350,7 @@ const AppGrid = (props) => {
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson?.success === false) {
|
||||
toast.error(responseJson.reason);
|
||||
} else {
|
||||
//toast.success(`App ${type}d Successfully!`);
|
||||
@@ -414,7 +414,7 @@ const AppGrid = (props) => {
|
||||
scrollbarColor: "#494949 #2f2f2f",
|
||||
}}
|
||||
>
|
||||
{hits.map((data, index) => {
|
||||
{hits?.map((data, index) => {
|
||||
const appUrl =
|
||||
isCloud === true ?
|
||||
`/apps/${data.objectID}`
|
||||
@@ -556,7 +556,7 @@ const AppGrid = (props) => {
|
||||
}}
|
||||
>
|
||||
<span>
|
||||
{data.tags.slice(0, 1).map((tag, tagIndex) => (
|
||||
{data?.tags?.slice(0, 1)?.map((tag, tagIndex) => (
|
||||
<span key={tagIndex}>
|
||||
{normalizedString(tag)}
|
||||
{tagIndex < 1 ? ", " : ""}
|
||||
@@ -569,7 +569,7 @@ const AppGrid = (props) => {
|
||||
) : (
|
||||
<div style={{ width: 230, textOverflow: "ellipsis", overflow: 'hidden', whiteSpace: 'nowrap', }}>
|
||||
{data.tags &&
|
||||
data.tags.map((tag, tagIndex) => (
|
||||
data?.tags?.map((tag, tagIndex) => (
|
||||
<span key={tagIndex}>
|
||||
{normalizedString(tag)}
|
||||
{tagIndex < data.tags.length - 1 ? ", " : ""}
|
||||
@@ -760,7 +760,7 @@ const AppGrid = (props) => {
|
||||
};
|
||||
|
||||
const transformRefinementListItems = items =>
|
||||
items.map(item => ({
|
||||
items?.map(item => ({
|
||||
...item,
|
||||
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,
|
||||
count: categoryCountMap[category],
|
||||
}));
|
||||
@@ -1169,7 +1169,7 @@ const AppGrid = (props) => {
|
||||
{!isLoading && (
|
||||
<Collapse in={isCategoreListExpanded}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}>
|
||||
{topCategories.map((data, index) => (
|
||||
{topCategories?.map((data, index) => (
|
||||
<Button
|
||||
key={data.category}
|
||||
style={{
|
||||
@@ -1247,7 +1247,7 @@ const AppGrid = (props) => {
|
||||
});
|
||||
}
|
||||
|
||||
const tagArray = Object.keys(tagCountMap).map((tag) => ({
|
||||
const tagArray = Object.keys(tagCountMap)?.map((tag) => ({
|
||||
tag,
|
||||
count: tagCountMap[tag],
|
||||
}));
|
||||
@@ -1308,7 +1308,7 @@ const AppGrid = (props) => {
|
||||
</Button>
|
||||
<Collapse in={isActionLabelExpanded}>
|
||||
<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
|
||||
key={index}
|
||||
onClick={() => handleCheckboxChange(index)}
|
||||
@@ -1419,7 +1419,7 @@ const AppGrid = (props) => {
|
||||
|
||||
<Collapse in={isCreatedWithExpanded}>
|
||||
<div style={{ display: 'flex', flexDirection: 'column', alignItems: 'flex-start', width: '100%' }}>
|
||||
{AppCreatedWithOptions.map((data, index) => (
|
||||
{AppCreatedWithOptions?.map((data, index) => (
|
||||
<Button
|
||||
style={{
|
||||
display: "inline-flex",
|
||||
@@ -1689,7 +1689,7 @@ const AppGrid = (props) => {
|
||||
maxHeight: 570,
|
||||
}}
|
||||
>
|
||||
{filteredUserAppdata.map((data, index) => {
|
||||
{filteredUserAppdata?.map((data, index) => {
|
||||
const isMouseOverOnCloudIcon = false;
|
||||
const xs = 12;
|
||||
const rowHandler = 12;
|
||||
@@ -1847,8 +1847,8 @@ const AppGrid = (props) => {
|
||||
<div style={{minWidth: 120, overflow: "hidden", }}>
|
||||
{data.generated !== true ?
|
||||
<div>
|
||||
{data.tags &&
|
||||
data.tags.slice(0,2).map((tag, tagIndex) => (
|
||||
{data?.tags &&
|
||||
data?.tags?.slice(0,2)?.map((tag, tagIndex) => (
|
||||
<span key={tagIndex}>
|
||||
{normalizedString(tag)}
|
||||
{tagIndex < data.tags.length - 1 ? ", " : ""}
|
||||
@@ -1888,7 +1888,7 @@ const AppGrid = (props) => {
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson?.success === false) {
|
||||
toast.error(responseJson.reason);
|
||||
} else {
|
||||
toast.success("App Deactivated Successfully. Reload UI to see updated changes.")
|
||||
|
||||
@@ -179,7 +179,7 @@ const AppSearchButtons = (props) => {
|
||||
|
||||
|
||||
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}
|
||||
onMouseLeave={handleMouseLeave}
|
||||
>
|
||||
|
||||
@@ -191,6 +191,10 @@ const EditWorkflow = (props) => {
|
||||
var upload = "";
|
||||
var total_count = 0
|
||||
|
||||
const isCloud =
|
||||
window.location.host === "localhost:3002" ||
|
||||
window.location.host === "shuffler.io";
|
||||
|
||||
return (
|
||||
<Drawer
|
||||
anchor={"right"}
|
||||
@@ -622,6 +626,7 @@ const EditWorkflow = (props) => {
|
||||
All
|
||||
</MenuItem>
|
||||
{userdata.orgs.map((data, index) => {
|
||||
|
||||
var skipOrg = false;
|
||||
if (data.creator_org !== undefined && data.creator_org !== null && data.creator_org === userdata.active_org.id) {
|
||||
// Finds the parent org
|
||||
@@ -629,6 +634,8 @@ const EditWorkflow = (props) => {
|
||||
return null
|
||||
}
|
||||
|
||||
const correctRegion = data?.region_url === userdata?.region_url
|
||||
|
||||
const imagesize = 22
|
||||
const imageStyle = {
|
||||
width: imagesize,
|
||||
@@ -662,7 +669,11 @@ const EditWorkflow = (props) => {
|
||||
|
||||
|
||||
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)} />
|
||||
{image}{" "}
|
||||
<span style={{ marginLeft: 8 }}>
|
||||
@@ -1170,9 +1181,21 @@ const EditWorkflow = (props) => {
|
||||
setInnerWorkflow(innerWorkflow)
|
||||
}}
|
||||
>
|
||||
<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="agentic" control={<Radio />} label="Agentic" />
|
||||
</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>
|
||||
</FormControl>
|
||||
|
||||
@@ -721,11 +721,7 @@ useEffect(() => {
|
||||
margin_left:
|
||||
org.creator_org !== undefined &&
|
||||
org.creator_org !== null &&
|
||||
org.creator_org.length > 0
|
||||
? org.id === userdata.active_org.id
|
||||
? 0
|
||||
: 20
|
||||
: 0,
|
||||
org.creator_org.length > 0 ? 20 : 0,
|
||||
};
|
||||
}) || []
|
||||
);
|
||||
|
||||
@@ -267,16 +267,16 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
|
||||
toast.error("Failed to send request for changing region. Please contact support@shuffler.io.")
|
||||
return
|
||||
}
|
||||
let destinationRegion = region;
|
||||
if (region === "US") {
|
||||
destinationRegion = "us-west2";
|
||||
} else if (region === "EU") {
|
||||
destinationRegion = "europe-west3";
|
||||
} else if (region === "CA") {
|
||||
destinationRegion = "northamerica-northeast1";
|
||||
} else if (region === "UK") {
|
||||
destinationRegion = "europe-west2";
|
||||
}
|
||||
|
||||
const regionToCloudRegion = {
|
||||
'US': 'us-west2',
|
||||
'EU': 'europe-west3',
|
||||
'CA': 'northamerica-northeast1',
|
||||
'UK': 'europe-west2',
|
||||
'EU-2': 'europe-west3'
|
||||
};
|
||||
|
||||
const destinationRegion = regionToCloudRegion[region] || region;
|
||||
|
||||
var data = {
|
||||
dst_region: destinationRegion
|
||||
@@ -296,7 +296,7 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
|
||||
if (response.status !== 200) {
|
||||
toast.error("Failed to send request for changing region. Please contact support@shuffler.io.")
|
||||
} 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) => {
|
||||
console.log(err)
|
||||
@@ -497,7 +497,8 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
|
||||
auto_provision: selectedOrganization?.sso_config?.auto_provision,
|
||||
}
|
||||
)
|
||||
}}}
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
if (e.target.value.length > 100) {
|
||||
toast("Choose a shorter name.");
|
||||
@@ -575,7 +576,8 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
|
||||
variant="outlined"
|
||||
placeholder="A description for the organization"
|
||||
value={orgDescription}
|
||||
onBlur={() => {if((orgDescription !== selectedOrganization?.description) && (orgDescription !== "")) {
|
||||
onBlur={() => {
|
||||
if ((orgDescription !== selectedOrganization?.description) && (orgDescription !== "")) {
|
||||
handleEditOrg(
|
||||
orgName,
|
||||
orgDescription,
|
||||
@@ -606,7 +608,8 @@ const [orgName, setOrgName] = useState(selectedOrganization?.name);
|
||||
auto_provision: selectedOrganization?.sso_config?.auto_provision,
|
||||
}
|
||||
)
|
||||
}}}
|
||||
}
|
||||
}}
|
||||
onChange={(e) => {
|
||||
setOrgDescription(e.target.value);
|
||||
}}
|
||||
@@ -1087,7 +1090,7 @@ const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userda
|
||||
"US": "us",
|
||||
"EU-2": "eu",
|
||||
"CA": "ca",
|
||||
"UK": "gb"
|
||||
"UK": "gb",
|
||||
};
|
||||
|
||||
//let regiontag = "UK";
|
||||
@@ -1095,6 +1098,7 @@ const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userda
|
||||
let regionCode = "gb";
|
||||
|
||||
const regionsplit = selectedOrganization?.region_url?.split(".");
|
||||
|
||||
if (regionsplit?.length > 2 && !regionsplit[0]?.includes("shuffler")) {
|
||||
const namesplit = regionsplit[0]?.split("/");
|
||||
regiontag = namesplit[namesplit.length - 1];
|
||||
@@ -1103,13 +1107,14 @@ const RegionChangeModal = memo(({selectedOrganization, setSelectedRegion, userda
|
||||
regiontag = "US";
|
||||
regionCode = "us";
|
||||
} else if (regiontag === "frankfurt") {
|
||||
regiontag = "EU";
|
||||
regiontag = "EU-2";
|
||||
regionCode = "eu";
|
||||
} else if (regiontag === "ca") {
|
||||
regiontag = "CA";
|
||||
regionCode = "ca";
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<FormControl style={{ display: "flex", flexDirection: "column", marginTop: 5, alignItems: "center" }} >
|
||||
{/* <InputLabel id="demo-simple-select-label">Region</InputLabel> */}
|
||||
|
||||
@@ -214,6 +214,20 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
}, [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(() => {
|
||||
// Changes the order of params to show in order:
|
||||
// auth, required, optional
|
||||
@@ -347,7 +361,7 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
|
||||
if (keyorder.join(",") !== newkeyorder.join(",")) {
|
||||
//toast("KEYORDER CHANGED!")
|
||||
console.log("KEYORDER CHANGED! DID ACTION AS WELL?", keyorder, newkeyorder)
|
||||
|
||||
setSelectedActionParameters(newparams)
|
||||
selectedAction.parameters = newparams
|
||||
@@ -872,7 +886,7 @@ const ParsedAction = (props) => {
|
||||
}
|
||||
}
|
||||
return { ...param, value: paramvalue, error: message }
|
||||
});
|
||||
})
|
||||
|
||||
setSelectedActionParameters(newParameters)
|
||||
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 = (
|
||||
<Tooltip
|
||||
title={tooltipDescription}
|
||||
@@ -3725,7 +3747,8 @@ const ParsedAction = (props) => {
|
||||
setScrollConfig(scrollConfig)
|
||||
}
|
||||
}}
|
||||
rows={data.name.startsWith("${") && data.name.endsWith("}") ? 2 : rows}
|
||||
minRows={rows}
|
||||
maxRows={6}
|
||||
color="primary"
|
||||
// defaultValue={data.value}
|
||||
value={
|
||||
@@ -4034,7 +4057,8 @@ const ParsedAction = (props) => {
|
||||
helperText={returnHelperText(data.name, data.value)}
|
||||
fullWidth
|
||||
multiline={multiline}
|
||||
rows={"3"}
|
||||
minRows={3}
|
||||
maxRows={6}
|
||||
color="primary"
|
||||
defaultValue={data.value}
|
||||
type={"text"}
|
||||
@@ -4580,7 +4604,7 @@ const ParsedAction = (props) => {
|
||||
data.field_active === true ?
|
||||
<Tooltip
|
||||
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"
|
||||
>
|
||||
<PriorityHighIcon
|
||||
|
||||
@@ -354,13 +354,13 @@ const RuntimeDebugger = (props) => {
|
||||
var imageSource = "";
|
||||
if (params?.row?.org?.id?.length > 0) {
|
||||
if (params?.row?.org?.image?.length > 0){
|
||||
imageSource = params.row.org.image
|
||||
imageSource = params?.row.org?.image
|
||||
}else {
|
||||
imageSource = "/images/no_image.png"
|
||||
}
|
||||
}else {
|
||||
if (userdata.active_org.image?.length > 0){
|
||||
imageSource = userdata.active_org.image
|
||||
imageSource = userdata?.active_org?.image
|
||||
}else {
|
||||
imageSource = "/images/no_image.png"
|
||||
}
|
||||
@@ -370,7 +370,7 @@ const RuntimeDebugger = (props) => {
|
||||
<span style={{}} onClick={() => {
|
||||
//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, }} />
|
||||
) : null}
|
||||
<Tooltip title={source} placement="top">
|
||||
@@ -924,28 +924,13 @@ const RuntimeDebugger = (props) => {
|
||||
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>
|
||||
),
|
||||
|
||||
}}
|
||||
onChange={(e)=>{handleQueryChange(e)}}
|
||||
color="primary"
|
||||
placeholder="Filter by Workflow Name, Status, Execution Argument, Results.."
|
||||
placeholder="Filter by Workflow Name, Status, Execution Argument, Results"
|
||||
id="shuffle_search_field"
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -109,6 +109,12 @@ const SearchData = props => {
|
||||
}
|
||||
}, [searchOpen]);
|
||||
|
||||
useEffect(() => {
|
||||
if (currentRefinement !== inputValue) {
|
||||
refine(inputValue);
|
||||
}
|
||||
}, [currentRefinement]);
|
||||
|
||||
return (
|
||||
|
||||
<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 {
|
||||
Storage as StorageIcon,
|
||||
FullscreenExit as FullscreenExitIcon,
|
||||
Extension as ExtensionIcon,
|
||||
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": "Print Execution ID", "value": `print(self.current_execution_id)`, "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": "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 === "execution_variable" ? (
|
||||
<FavoriteBorderIcon style={{ marginRight: 10 }} />
|
||||
) : (
|
||||
) :
|
||||
innerdata.type === "Shuffle DB" ?
|
||||
<StorageIcon style={{ marginRight: 10, }} />
|
||||
:
|
||||
<ScheduleIcon style={{ marginRight: 10 }} />
|
||||
);
|
||||
|
||||
const handleExecArgumentHover = (inside) => {
|
||||
var exec_text_field = document.getElementById(
|
||||
@@ -1877,8 +1880,6 @@ const CodeEditor = (props) => {
|
||||
menuPosition1.left = 0
|
||||
}
|
||||
|
||||
//console.log("POS1: ", menuPosition1)
|
||||
|
||||
return parsedPaths.length > 0 ? (
|
||||
<NestedMenuItem
|
||||
key={innerdata.name}
|
||||
|
||||
@@ -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" }}>
|
||||
{["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
|
||||
key={index}
|
||||
primary={header}
|
||||
@@ -1458,6 +1458,8 @@ const UserManagmentTab = memo((props) => {
|
||||
}}
|
||||
style={{display:'table-cell', verticalAlign: 'middle' }}
|
||||
/>
|
||||
|
||||
{/*
|
||||
<ListItemText
|
||||
style={{
|
||||
textAlign: "center",
|
||||
@@ -1488,6 +1490,8 @@ const UserManagmentTab = memo((props) => {
|
||||
)
|
||||
}
|
||||
/>
|
||||
*/}
|
||||
|
||||
<ListItemText
|
||||
primary={
|
||||
<Select
|
||||
@@ -1552,10 +1556,12 @@ const UserManagmentTab = memo((props) => {
|
||||
}
|
||||
style={{ display:'table-cell', verticalAlign: 'middle' }}
|
||||
/>
|
||||
|
||||
<ListItemText
|
||||
primary={data.active ? "True" : "False"}
|
||||
style={{display:'table-cell',verticalAlign: 'middle' , padding: "8px", textAlign: "center", color: data.active ? "#02CB70" : "#F53434" }}
|
||||
/>
|
||||
|
||||
<ListItemText
|
||||
primary={
|
||||
data.login_type === undefined ||
|
||||
@@ -1566,6 +1572,8 @@ const UserManagmentTab = memo((props) => {
|
||||
}
|
||||
style={{ display:'table-cell',verticalAlign: 'middle', padding: "8px", }}
|
||||
/>
|
||||
|
||||
{/*
|
||||
<ListItemText
|
||||
primary={
|
||||
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" }}
|
||||
/>
|
||||
*/}
|
||||
|
||||
{selectedOrganization?.child_orgs !== undefined &&
|
||||
selectedOrganization?.child_orgs !== null &&
|
||||
selectedOrganization?.child_orgs?.length > 0 ? (
|
||||
|
||||
@@ -1203,18 +1203,15 @@ const AngularWorkflow = (defaultprops) => {
|
||||
if (workflowExecutions.length > 0) {
|
||||
// Look for the ID
|
||||
for (let execkey in workflowExecutions) {
|
||||
if (
|
||||
workflowExecutions[execkey].results === undefined ||
|
||||
workflowExecutions[execkey].results === null
|
||||
) {
|
||||
continue;
|
||||
if (workflowExecutions[execkey].results === undefined || workflowExecutions[execkey].results === null) {
|
||||
continue
|
||||
}
|
||||
|
||||
var foundResult = workflowExecutions[execkey].results.find(
|
||||
(result) => result.action.id === item.id
|
||||
);
|
||||
)
|
||||
if (foundResult === undefined) {
|
||||
continue;
|
||||
continue
|
||||
}
|
||||
|
||||
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 nodedata = event.target.data();
|
||||
|
||||
@@ -4906,161 +5074,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Finds closest partner to show edge to connect to
|
||||
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
|
||||
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!")
|
||||
}
|
||||
*/
|
||||
|
||||
findClosestNode(event, nodedata)
|
||||
}
|
||||
|
||||
if (originalLocation.x === 0 && originalLocation.y === 0 && nodedata.position !== undefined) {
|
||||
@@ -5222,7 +5238,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
name: item.label,
|
||||
autocomplete: itemlabelComplete,
|
||||
example: exampledata,
|
||||
};
|
||||
}
|
||||
|
||||
console.log("VALUE: ", actionvalue)
|
||||
|
||||
actionlist.push(actionvalue);
|
||||
}
|
||||
@@ -5736,7 +5754,6 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return
|
||||
|
||||
} else if (data.buttonType === "copy") {
|
||||
console.log("COPY!");
|
||||
|
||||
// 1. Find parent
|
||||
// 2. Find branches for parent
|
||||
@@ -6198,8 +6215,10 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
setSelectedApp(curapp)
|
||||
setSelectedAction(curaction)
|
||||
}, 50)
|
||||
|
||||
cy.removeListener("drag");
|
||||
cy.removeListener("free");
|
||||
@@ -10658,6 +10677,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
// HTML -> Canvas overlap check
|
||||
if (
|
||||
e.pageX > cycontainer.offsetLeft
|
||||
@@ -10670,6 +10690,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
return
|
||||
}
|
||||
|
||||
findClosestNode({
|
||||
target: currentnode,
|
||||
}, currentnode.data())
|
||||
|
||||
currentnode[0].renderedPosition("x", e.pageX - cycontainer.offsetLeft)
|
||||
currentnode[0].renderedPosition("y", e.pageY - cycontainer.offsetTop)
|
||||
@@ -17734,10 +17757,24 @@ const AngularWorkflow = (defaultprops) => {
|
||||
onChange={(e) => {
|
||||
if (lastSaved === false && originalWorkflow.id === workflow.id) {
|
||||
setSuborgWorkflows([])
|
||||
|
||||
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,
|
||||
})
|
||||
|
||||
|
||||
return
|
||||
}
|
||||
|
||||
@@ -17761,12 +17798,14 @@ const AngularWorkflow = (defaultprops) => {
|
||||
}
|
||||
|
||||
ReactDOM.unstable_batchedUpdates(() => {
|
||||
/* 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 */
|
||||
|
||||
// Reset the save button to ensure random saves don't occur during move
|
||||
setLastSaved(true)
|
||||
@@ -19035,7 +19074,7 @@ const AngularWorkflow = (defaultprops) => {
|
||||
{workflow.public || userdata.support == true ?
|
||||
<Tooltip
|
||||
color="secondary"
|
||||
title="Download public workflow"
|
||||
title="Download workflow"
|
||||
placement="top-start"
|
||||
>
|
||||
<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";
|
||||
var copyText = document.getElementById(elementName);
|
||||
if (copyText !== null && copyText !== undefined) {
|
||||
@@ -21562,6 +21602,8 @@ const AngularWorkflow = (defaultprops) => {
|
||||
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")) {
|
||||
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.`
|
||||
/*
|
||||
return (
|
||||
<div style={{ maxWidth: 600, marginTop: 15, overflowX: "hidden", }}>
|
||||
<Typography
|
||||
@@ -21571,10 +21613,10 @@ const AngularWorkflow = (defaultprops) => {
|
||||
<b>Action Logs</b>
|
||||
</Typography>
|
||||
<Typography variant="body2" style={{ whiteSpace: 'pre-line', }}>
|
||||
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>
|
||||
</div>
|
||||
)
|
||||
*/
|
||||
}
|
||||
|
||||
var showlink = false
|
||||
@@ -22139,9 +22181,9 @@ const AngularWorkflow = (defaultprops) => {
|
||||
variant="h6"
|
||||
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>
|
||||
{selectedResult.action.parameters.map((data, index) => {
|
||||
{selectedResult?.action?.parameters?.map((data, index) => {
|
||||
if (data.value.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -176,16 +176,18 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
||||
}
|
||||
|
||||
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
|
||||
const extra = basekey.length > 0 ? splitkey : "";
|
||||
const basekeyname = `${basekey
|
||||
.slice(1, basekey.length)
|
||||
.split(".")
|
||||
.join(splitkey)}${extra}${key}`;
|
||||
.join(splitkey)}${extra}${key}`
|
||||
|
||||
// Handle direct loop!
|
||||
if (!isNaN(key) && basekey === "") {
|
||||
@@ -205,7 +207,8 @@ export const GetParsedPaths = (inputdata, basekey) => {
|
||||
type: "list",
|
||||
name: `${splitkey}list`,
|
||||
autocomplete: `${basekey.replaceAll(" ", "_")}.#`,
|
||||
});
|
||||
})
|
||||
|
||||
const returnValues = GetParsedPaths(value, `${basekey}.#`);
|
||||
for (var subkey in returnValues) {
|
||||
parsedValues.push(returnValues[subkey]);
|
||||
|
||||
@@ -49,7 +49,7 @@ const searchClient = algoliasearch(
|
||||
);
|
||||
|
||||
// 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 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}`;
|
||||
@@ -223,6 +223,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
|
||||
)
|
||||
}
|
||||
<Button
|
||||
disabled={data?.reference_org === userdata?.active_org?.id}
|
||||
className="deactivate-button"
|
||||
sx={{
|
||||
width: 110,
|
||||
@@ -244,7 +245,7 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
const url = `${globalUrl}/api/v1/apps/${data.id}/deactivate`;
|
||||
toast("Deactivating app. Please wait...");
|
||||
//toast("Deactivating app. Please wait...");
|
||||
fetch(url, {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
@@ -256,10 +257,25 @@ const AppCard = ({ data, index, mouseHoverIndex, setMouseHoverIndex, globalUrl,
|
||||
.then((response) => response.json())
|
||||
.then((responseJson) => {
|
||||
if (responseJson.success === false) {
|
||||
if (responseJson?.reason !== undefined && responseJson?.reason !== null && responseJson?.reason !== "") {
|
||||
toast.error(responseJson.reason);
|
||||
} else {
|
||||
toast.success("App Deactivated Successfully.");
|
||||
fetchApps();
|
||||
toast.error("Failed to deactivate app. Please try again later.")
|
||||
}
|
||||
} else {
|
||||
toast.success("App deactivated successfully. Will take effect on refresh..")
|
||||
|
||||
/*
|
||||
// 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 => {
|
||||
@@ -1860,8 +1876,6 @@ const Apps2 = (props) => {
|
||||
color: "#FF8544"
|
||||
}
|
||||
|
||||
console.log("User", userdata)
|
||||
|
||||
return (
|
||||
<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">
|
||||
@@ -2247,6 +2261,10 @@ const Apps2 = (props) => {
|
||||
leftSideBarOpenByClick={leftSideBarOpenByClick}
|
||||
userdata={userdata}
|
||||
fetchApps={fetchApps}
|
||||
|
||||
setUserApps={setUserApps}
|
||||
appsToShow={appsToShow}
|
||||
setAppsToShow={setAppsToShow}
|
||||
/>
|
||||
))}
|
||||
</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}
|
||||
handleAppClick={handleAppClick} leftSideBarOpenByClick={leftSideBarOpenByClick}
|
||||
fetchApps={fetchApps}
|
||||
setUserApps={setUserApps}
|
||||
appsToShow={appsToShow}
|
||||
setAppsToShow={setAppsToShow}
|
||||
/>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -77,6 +77,24 @@ const RunWorkflow = (defaultprops) => {
|
||||
const [boxWidth, setBoxWidth] = React.useState(500)
|
||||
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) => {
|
||||
var propsCopy = JSON.parse(JSON.stringify(props))
|
||||
propsCopy.width = 400
|
||||
|
||||
@@ -447,6 +447,7 @@ const Welcome = (props) => {
|
||||
}
|
||||
|
||||
navigate("/welcome?tab=2")
|
||||
setActiveStep(1)
|
||||
setShowWelcome(true)
|
||||
}}>
|
||||
<CardActionArea style={actionObject}>
|
||||
|
||||
@@ -553,6 +553,10 @@ export const validateJson = (showResult) => {
|
||||
// Check fields if they can be parsed too
|
||||
try {
|
||||
for (const [key, value] of Object.entries(result)) {
|
||||
if (typeof value === "string") {
|
||||
value = value.replaceAll(" ", "_")
|
||||
}
|
||||
|
||||
if (typeof value === "string" && (value.startsWith("{") || value.startsWith("["))) {
|
||||
//console.log("CHECKING STRING: ", value)
|
||||
|
||||
@@ -573,6 +577,10 @@ export const validateJson = (showResult) => {
|
||||
// Usually only reaches here if raw array > dict > value
|
||||
if (typeof showResult !== "array") {
|
||||
for (const [subkey, subvalue] of Object.entries(value)) {
|
||||
if (typeof subvalue === "string") {
|
||||
subvalue = subvalue.replaceAll(" ", "_")
|
||||
}
|
||||
|
||||
if (typeof subvalue === "string" && (subvalue.startsWith("{") || subvalue.startsWith("["))) {
|
||||
const inside_result = validateJson(subvalue)
|
||||
if (inside_result.valid) {
|
||||
@@ -1841,9 +1849,13 @@ const Workflows = (props) => {
|
||||
|
||||
var parsedworkflows = [];
|
||||
for (var key in newSubflows) {
|
||||
if (key === data.id) {
|
||||
continue
|
||||
}
|
||||
|
||||
const foundWorkflow = workflows.find(
|
||||
(workflow) => workflow.id === newSubflows[key]
|
||||
);
|
||||
)
|
||||
if (foundWorkflow !== undefined && foundWorkflow !== null) {
|
||||
parsedworkflows.push(foundWorkflow);
|
||||
}
|
||||
@@ -1854,7 +1866,7 @@ const Workflows = (props) => {
|
||||
"Appending subflows during export: ",
|
||||
parsedworkflows.length
|
||||
);
|
||||
data.subflows = parsedworkflows;
|
||||
data.subflows = parsedworkflows
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1935,6 +1935,10 @@ const Workflows2 = (props) => {
|
||||
|
||||
var parsedworkflows = [];
|
||||
for (var key in newSubflows) {
|
||||
if (key === data.id) {
|
||||
continue
|
||||
}
|
||||
|
||||
const foundWorkflow = workflows.find(
|
||||
(workflow) => workflow.id === newSubflows[key]
|
||||
);
|
||||
@@ -2362,7 +2366,6 @@ const Workflows2 = (props) => {
|
||||
|
||||
<MenuItem
|
||||
style={{ backgroundColor: theme.palette.inputColor, color: "white" }}
|
||||
disabled={isDistributed}
|
||||
onClick={() => {
|
||||
setDeleteModalOpen(true);
|
||||
setSelectedWorkflowId(data.id);
|
||||
|
||||
@@ -4,13 +4,13 @@ go 1.22.7
|
||||
|
||||
toolchain go1.22.11
|
||||
|
||||
//replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared
|
||||
replace github.com/shuffle/shuffle-shared => ../../../../shuffle-shared
|
||||
|
||||
require (
|
||||
github.com/docker/docker v27.5.0+incompatible
|
||||
github.com/docker/go-connections v0.5.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/apimachinery v0.30.2
|
||||
)
|
||||
|
||||
@@ -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.83 h1:OyyDo0ii8rOYHN5wGbcM94JuDKLmbZ9jhMQ0+/KMb0A=
|
||||
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.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ=
|
||||
github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ=
|
||||
|
||||
@@ -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 {
|
||||
|
||||
|
||||
if len(os.Getenv("REGISTRY_URL")) > 0 && os.Getenv("REGISTRY_URL") != "" {
|
||||
env = append(env, fmt.Sprintf("REGISTRY_URL=%s", os.Getenv("REGISTRY_URL")))
|
||||
}
|
||||
|
||||
// if isKubernetes == "true" {
|
||||
// err := deployK8sWorker(image, identifier, env, executionRequest)
|
||||
// if err != nil {
|
||||
// log.Printf("[ERROR] Failed deploying Kubernetes worker: %s", err)
|
||||
// }
|
||||
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 err
|
||||
// }
|
||||
return nil
|
||||
}
|
||||
|
||||
// Binds is the actual "-v" volume.
|
||||
// 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{
|
||||
Image: image,
|
||||
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)
|
||||
cont, err := dockercli.ContainerCreate(
|
||||
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{}
|
||||
err = dockercli.ContainerStart(context.Background(), cont.ID, containerStartOptions)
|
||||
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)
|
||||
}
|
||||
|
||||
//stats, err := cli.ContainerInspect(context.Background(), containerName)
|
||||
//if err != nil {
|
||||
// log.Printf("Failed checking worker %s", containerName)
|
||||
// return
|
||||
//}
|
||||
stats, err := dockercli.ContainerInspect(context.Background(), containerName)
|
||||
if err != nil {
|
||||
log.Printf("[WARNING] Failed checking worker %s", containerName)
|
||||
return nil
|
||||
}
|
||||
|
||||
//containerStatus := stats.ContainerJSONBase.State.Status
|
||||
//if containerStatus != "running" {
|
||||
// log.Printf("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)
|
||||
// return
|
||||
// }
|
||||
containerStatus := stats.ContainerJSONBase.State.Status
|
||||
if containerStatus != "running" {
|
||||
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)
|
||||
return nil
|
||||
}
|
||||
|
||||
// err = deployWorke(cli, workerImage, containerName, env)
|
||||
// if err != nil {
|
||||
// log.Printf("Failed executing worker %s in state %s", execution.ExecutionId, containerStatus)
|
||||
// return
|
||||
// }
|
||||
//}
|
||||
err = deployWorker(dockercli, workerImage, containerName, env)
|
||||
if err != nil {
|
||||
log.Printf("Failed executing worker %s in state %s", execution.ExecutionId, containerStatus)
|
||||
return nil
|
||||
}
|
||||
}
|
||||
*/
|
||||
} else {
|
||||
log.Printf("[INFO][%s] New Worker created. Environment %s: docker logs %s", executionRequest.ExecutionId, environment, cont.ID)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user