Synced over bugfixes and theme control

This commit is contained in:
Frikky
2025-05-23 12:10:38 +02:00
parent 065f6f9332
commit c0aaebaff6
8 changed files with 1898 additions and 698 deletions
+2 -5
View File
@@ -39,7 +39,7 @@ const Branding = (props) => {
const theme = getTheme(themeMode, brandColor) const theme = getTheme(themeMode, brandColor)
const [selectedBrandColor, setSelectedBrandColor] = useState(theme?.palette?.main || "#FF8544") const [selectedBrandColor, setSelectedBrandColor] = useState(theme?.palette?.main || "#FF8544")
const [selectedBrandName, setSelectedBrandName] = useState(selectedOrganization?.branding?.brand_name || "") const [selectedBrandName, setSelectedBrandName] = useState(selectedOrganization?.branding?.brand_name || "")
const isCloud = window.location.host === "localhost:3002" || window.location.host === "shuffler.io";
const [isLoading,setIsLoading] = useState(false); const [isLoading,setIsLoading] = useState(false);
const handleEditOrg = (joinStatus) => { const handleEditOrg = (joinStatus) => {
@@ -391,7 +391,7 @@ const Branding = (props) => {
</div> </div>
{ integrationPartner ? ( {integrationPartner ? (
<> <>
<Divider style={{marginTop: 50, marginBottom: 50, color: theme.palette.defaultBorder}} /> <Divider style={{marginTop: 50, marginBottom: 50, color: theme.palette.defaultBorder}} />
<Typography style={{fontSize: 24, fontWeight: "bold"}}> <Typography style={{fontSize: 24, fontWeight: "bold"}}>
@@ -414,9 +414,6 @@ const Branding = (props) => {
if (changingTheme === true) { if (changingTheme === true) {
return return
} }
toast.info("Changing theme to " + newTheme + ". Please wait a moment.")
setChangingTheme(true) setChangingTheme(true)
handleEditOrg(newTheme); handleEditOrg(newTheme);
}} }}
+40 -4
View File
@@ -403,7 +403,6 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
const handleChangeTheme = (newTheme) => { const handleChangeTheme = (newTheme) => {
toast.info("Changing theme to " + newTheme + " - please wait!");
const data = { const data = {
"org_id": userdata?.active_org?.id, "org_id": userdata?.active_org?.id,
@@ -450,6 +449,38 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
}; };
const handleUpdateTheme = (newTheme) => {
const data = {
"user_id": userdata?.id,
"theme": newTheme,
}
const url = globalUrl + `/api/v1/users/updateuser`;
fetch(url, {
mode: "cors",
method: "PUT",
body: JSON.stringify(data),
credentials: "include",
crossDomain: true,
withCredentials: true,
headers: {
"Content-Type": "application/json; charset=utf-8",
},
}).then((response) =>
response.json().then((responseJson) => {
if (responseJson["success"] === false) {
toast("Failed updating theme: ", responseJson.reason);
} else {
handleThemeChange(newTheme);
setCurrentSelectedTheme(newTheme);
}
})
).catch((error) => {
console.log("Error changing theme: ", error);
});
};
const removeCookie = (name, path = "/") => { const removeCookie = (name, path = "/") => {
document.cookie = `${name}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT;`; document.cookie = `${name}=; path=${path}; expires=Thu, 01 Jan 1970 00:00:00 GMT;`;
@@ -487,6 +518,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
console.error("Logout error:", error); console.error("Logout error:", error);
}); });
}; };
console.log("userdata: ", userdata);
const avatarMenu = ( const avatarMenu = (
<span> <span>
<IconButton <IconButton
@@ -543,7 +575,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
}, },
}} }}
> >
{userdata && ( {userdata && (userdata?.org_status?.includes("integration_partner") && userdata?.org_status?.includes("sub_org")) ? null : (
<> <>
<ToggleButtonGroup <ToggleButtonGroup
value={currentSelectedTheme} value={currentSelectedTheme}
@@ -555,7 +587,11 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
if (newTheme === currentSelectedTheme) { if (newTheme === currentSelectedTheme) {
return; return;
} }
handleChangeTheme(newTheme); if (userdata?.org_status?.includes("integration_partner")){
handleChangeTheme(newTheme);
}else {
handleUpdateTheme(newTheme);
}
}} }}
aria-label="theme" aria-label="theme"
style={{display: 'flex', justifyContent: "center", marginBottom: 10, }} style={{display: 'flex', justifyContent: "center", marginBottom: 10, }}
@@ -1648,7 +1684,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
<Button <Button
component={Link} component={Link}
to={isCloud ? "/admin?admin_tab=billingstats" : "/admin?admin_tab=locations"} to={isCloud ? "/admin" : "/admin"}
onClick={(event) => { onClick={(event) => {
setCurrentOpenTab("admin"); setCurrentOpenTab("admin");
localStorage.setItem("lastTabOpenByUser", "admin"); localStorage.setItem("lastTabOpenByUser", "admin");
File diff suppressed because it is too large Load Diff
@@ -132,7 +132,7 @@ const CodeEditor = (props) => {
fieldname, fieldname,
contentLoading, contentLoading,
editorData, editorData,
handleSubflowParamChange, handleTriggerParamChange,
setAiQueryModalOpen, setAiQueryModalOpen,
fullScreenMode, fullScreenMode,
environment, environment,
@@ -212,7 +212,7 @@ const CodeEditor = (props) => {
const triggerField = searchParams.get('trigger_field'); const triggerField = searchParams.get('trigger_field');
const triggerName = searchParams.get('trigger_name'); const triggerName = searchParams.get('trigger_name');
const conditionId = searchParams.get('condition_id'); const conditionId = searchParams.get('condition_id');
const conditionField = searchParams.get('field'); const conditionField = searchParams.get('condition_field');
useEffect(() => { useEffect(() => {
if (actionId === undefined || actionId === null) { if (actionId === undefined || actionId === null) {
@@ -251,7 +251,7 @@ const CodeEditor = (props) => {
setSelectedCondition(condition); setSelectedCondition(condition);
// Update available variables when condition changes // Update available variables when condition changes
updateAvailableVariables(actionlist); updateAvailableVariables(actionlist);
}, [conditionId, fieldName]) }, [conditionId, conditionField])
// Extract variable updating logic into a separate function // Extract variable updating logic into a separate function
const updateAvailableVariables = (actionlist) => { const updateAvailableVariables = (actionlist) => {
@@ -2588,7 +2588,7 @@ const CodeEditor = (props) => {
// Handle condition fields // Handle condition fields
if (conditionField !== null && handleConditionFieldChange !== undefined) { if (conditionField !== null && handleConditionFieldChange !== undefined) {
handleConditionFieldChange(conditionField, fieldName, fixedcodedata); handleConditionFieldChange(conditionField, fixedcodedata);
} }
// Handle action fields // Handle action fields
else if (actionId !== undefined && actionId !== null && actionId.length > 0) { else if (actionId !== undefined && actionId !== null && actionId.length > 0) {
@@ -2596,7 +2596,7 @@ const CodeEditor = (props) => {
} }
// Handle trigger fields // Handle trigger fields
else if (triggerId !== undefined && triggerId !== null && triggerId.length > 0) { else if (triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
handleSubflowParamChange(triggerId, triggerField, fixedcodedata) handleTriggerParamChange(triggerId, triggerField, fixedcodedata)
} }
setExpansionModalOpen(false) setExpansionModalOpen(false)
+11 -7
View File
@@ -13032,7 +13032,7 @@ const AngularWorkflow = (defaultprops) => {
event.preventDefault() event.preventDefault()
setExpansionModalOpen(true) setExpansionModalOpen(true)
setActiveDialog("codeeditor") setActiveDialog("codeeditor")
navigate(`?condition_id=${data.id}&field=${data.name}`) navigate(`?condition_id=${data.id}&condition_field=${data.name}`)
setEditorData({ setEditorData({
"name": data.name, "name": data.name,
"value": data.value || "", "value": data.value || "",
@@ -13117,9 +13117,9 @@ const AngularWorkflow = (defaultprops) => {
// Update the field value based on type // Update the field value based on type
if (type === "source") { if (type === "source") {
handleConditionFieldChange("source", "value", toComplete); handleConditionFieldChange("source", toComplete);
} else if (type === "destination") { } else if (type === "destination") {
handleConditionFieldChange("destination", "value", toComplete); handleConditionFieldChange("destination", toComplete);
} }
handleMenuClose(); handleMenuClose();
@@ -13996,7 +13996,7 @@ const AngularWorkflow = (defaultprops) => {
/> />
</Dialog> </Dialog>
const handleConditionFieldChange = (fieldType, fieldName, value) => { const handleConditionFieldChange = (fieldType, value) => {
if (fieldType === "source") { if (fieldType === "source") {
setSourceValue({ setSourceValue({
...sourceValue, ...sourceValue,
@@ -15197,7 +15197,7 @@ const AngularWorkflow = (defaultprops) => {
} }
] ]
const handleSubflowParamChange = (triggerId, triggerField, newData) => { const handleTriggerParamChange = (triggerId, triggerField, newData) => {
var updateFail = "" var updateFail = ""
if (workflow !== undefined && workflow !== null) { if (workflow !== undefined && workflow !== null) {
@@ -17336,9 +17336,13 @@ const AngularWorkflow = (defaultprops) => {
fullWidth fullWidth
rows="4" rows="4"
multiline multiline
defaultValue={selectedTrigger.parameters[0]?.value} value={selectedTriggerValue || ""}
color="primary" color="primary"
placeholder="" placeholder=""
onChange={(e) => {
setLastSaved(false)
setSelectedTriggerValue(e.target.value)
}}
onBlur={(e) => { onBlur={(e) => {
setLastSaved(false) setLastSaved(false)
setTriggerTextInformationWrapper(e.target.value); setTriggerTextInformationWrapper(e.target.value);
@@ -25472,7 +25476,7 @@ const AngularWorkflow = (defaultprops) => {
// selectedTrigger={selectedTrigger} // selectedTrigger={selectedTrigger}
aiSubmit={aiSubmit} aiSubmit={aiSubmit}
toolsAppId={toolsApp.id} toolsAppId={toolsApp.id}
handleSubflowParamChange={handleSubflowParamChange} handleTriggerParamChange={handleTriggerParamChange}
codedata={editorData.value} codedata={editorData.value}
setcodedata={setcodedata} setcodedata={setcodedata}
selectedEdge={selectedEdge} selectedEdge={selectedEdge}
+35 -26
View File
@@ -314,12 +314,15 @@ const LoginPage = props => {
}, },
}) })
if (serverside !== true) { useEffect(() => {
const tmpMessage = new URLSearchParams(window.location.search).get("message") if (serverside !== true) {
if (tmpMessage !== undefined && tmpMessage !== null && message !== tmpMessage) { const tmpMessage = new URLSearchParams(window.location.search).get("message")
setMessage(tmpMessage) if (tmpMessage !== undefined && tmpMessage !== null && message !== tmpMessage) {
setMessage(tmpMessage)
toast(tmpMessage)
}
} }
} }, [])
if (document !== undefined) { if (document !== undefined) {
if (register) { if (register) {
@@ -444,13 +447,17 @@ const LoginPage = props => {
} }
if (isLoggedIn === true && serverside !== true) { if (isLoggedIn === true && serverside !== true) {
const tmpView = new URLSearchParams(window.location.search).get("view") const tmpView = new URLSearchParams(window.location.search).get("view");
if (tmpView !== undefined && tmpView !== null && tmpView === "pricing") { if (tmpView !== undefined && tmpView !== null) {
window.location.pathname = "/pricing" let pathOnly = tmpView.split("?")[0];
return if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
} else if (tmpView !== undefined && tmpView !== null) {
window.location.pathname = tmpView if (pathOnly === "/pricing" || pathOnly === "admin") {
return window.location.replace(pathOnly + window.location.search);
} else {
window.location.replace(pathOnly);
}
return;
} }
window.location.pathname = "/workflows" window.location.pathname = "/workflows"
@@ -575,20 +582,17 @@ const LoginPage = props => {
setCookie(responseJson["cookies"][key].key, responseJson["cookies"][key].value, { path: "/" }) setCookie(responseJson["cookies"][key].key, responseJson["cookies"][key].value, { path: "/" })
} }
const tmpView = new URLSearchParams(window.location.search).get("view") const tmpView = new URLSearchParams(window.location.search).get("view");
if (tmpView !== undefined && tmpView !== null) { if (tmpView !== undefined && tmpView !== null) {
//const newUrl = `/${tmpView}${decodeURIComponent(window.location.search)}` let pathOnly = tmpView.split("?")[0];
// Check if slash in the url if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
var newUrl = `/${tmpView}` if (pathOnly === "/pricing" || pathOnly === "admin") {
if (tmpView.startsWith("/")) { window.location.replace(pathOnly + window.location.search);
newUrl = `${tmpView}` } else {
window.location.replace(pathOnly);
} }
return;
console.log("Found url: ", newUrl)
window.location.pathname = newUrl
return
} }
console.log("LOGIN DATA: ", responseJson) console.log("LOGIN DATA: ", responseJson)
@@ -647,9 +651,14 @@ const LoginPage = props => {
const tmpView = new URLSearchParams(window.location.search).get("view") const tmpView = new URLSearchParams(window.location.search).get("view")
if (tmpView !== undefined && tmpView !== null) { if (tmpView !== undefined && tmpView !== null) {
//const newUrl = `/${tmpView}${decodeURIComponent(window.location.search)}` let pathOnly = tmpView.split("?")[0];
const newUrl = `/${tmpView}` if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
window.location.pathname = newUrl
if (pathOnly === "/pricing" || pathOnly === "admin") {
window.location.replace(pathOnly + window.location.search);
} else {
window.location.replace(pathOnly);
}
return return
} }
+6 -1
View File
@@ -458,7 +458,12 @@ const Settings = (props) => {
if (responseJson["success"] === false) { if (responseJson["success"] === false) {
setPasswordFormMessage(responseJson["reason"]); setPasswordFormMessage(responseJson["reason"]);
} else { } else {
toast("Changed password!"); var reason = ""
if (responseJson.reason !== undefined && responseJson.reason !== null && responseJson.reason.length > 0) {
reason += responseJson.reason
}
toast.success("Changed password! " + reason);
setPasswordFormMessage(""); setPasswordFormMessage("");
} }
}) })
+4 -2
View File
@@ -5071,7 +5071,7 @@ const Workflows2 = (props) => {
//isLoaded && isLoggedIn && workflowDone ? ( //isLoaded && isLoggedIn && workflowDone ? (
const loadedCheck = const loadedCheck =
workflowDone ? ( workflowDone && isLoaded ? (
<div> <div>
{/* {/*
<ShepherdTour steps={newSteps} tourOptions={tourOptions}> <ShepherdTour steps={newSteps} tourOptions={tourOptions}>
@@ -5134,7 +5134,9 @@ const Workflows2 = (props) => {
}} }}
> >
<CircularProgress /> <CircularProgress />
<Typography>Loading Workflows</Typography> <Typography style={{marginTop: 5, }}>
Loading Workflows and Apps
</Typography>
</div> </div>
); );