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 [selectedBrandColor, setSelectedBrandColor] = useState(theme?.palette?.main || "#FF8544")
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 handleEditOrg = (joinStatus) => {
@@ -391,7 +391,7 @@ const Branding = (props) => {
</div>
{ integrationPartner ? (
{integrationPartner ? (
<>
<Divider style={{marginTop: 50, marginBottom: 50, color: theme.palette.defaultBorder}} />
<Typography style={{fontSize: 24, fontWeight: "bold"}}>
@@ -414,9 +414,6 @@ const Branding = (props) => {
if (changingTheme === true) {
return
}
toast.info("Changing theme to " + newTheme + ". Please wait a moment.")
setChangingTheme(true)
handleEditOrg(newTheme);
}}
+41 -5
View File
@@ -403,7 +403,6 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
const handleChangeTheme = (newTheme) => {
toast.info("Changing theme to " + newTheme + " - please wait!");
const data = {
"org_id": userdata?.active_org?.id,
@@ -449,6 +448,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 = "/") => {
@@ -487,6 +518,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
console.error("Logout error:", error);
});
};
console.log("userdata: ", userdata);
const avatarMenu = (
<span>
<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
value={currentSelectedTheme}
@@ -555,7 +587,11 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
if (newTheme === currentSelectedTheme) {
return;
}
handleChangeTheme(newTheme);
if (userdata?.org_status?.includes("integration_partner")){
handleChangeTheme(newTheme);
}else {
handleUpdateTheme(newTheme);
}
}}
aria-label="theme"
style={{display: 'flex', justifyContent: "center", marginBottom: 10, }}
@@ -1648,7 +1684,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => {
<Button
component={Link}
to={isCloud ? "/admin?admin_tab=billingstats" : "/admin?admin_tab=locations"}
to={isCloud ? "/admin" : "/admin"}
onClick={(event) => {
setCurrentOpenTab("admin");
localStorage.setItem("lastTabOpenByUser", "admin");
@@ -2070,4 +2106,4 @@ const ModalView = memo(({searchBarModalOpen, setSearchBarModalOpen, globalUrl, s
</Dialog>
)
)
});
});
File diff suppressed because it is too large Load Diff
@@ -132,7 +132,7 @@ const CodeEditor = (props) => {
fieldname,
contentLoading,
editorData,
handleSubflowParamChange,
handleTriggerParamChange,
setAiQueryModalOpen,
fullScreenMode,
environment,
@@ -212,7 +212,7 @@ const CodeEditor = (props) => {
const triggerField = searchParams.get('trigger_field');
const triggerName = searchParams.get('trigger_name');
const conditionId = searchParams.get('condition_id');
const conditionField = searchParams.get('field');
const conditionField = searchParams.get('condition_field');
useEffect(() => {
if (actionId === undefined || actionId === null) {
@@ -251,7 +251,7 @@ const CodeEditor = (props) => {
setSelectedCondition(condition);
// Update available variables when condition changes
updateAvailableVariables(actionlist);
}, [conditionId, fieldName])
}, [conditionId, conditionField])
// Extract variable updating logic into a separate function
const updateAvailableVariables = (actionlist) => {
@@ -2588,7 +2588,7 @@ const CodeEditor = (props) => {
// Handle condition fields
if (conditionField !== null && handleConditionFieldChange !== undefined) {
handleConditionFieldChange(conditionField, fieldName, fixedcodedata);
handleConditionFieldChange(conditionField, fixedcodedata);
}
// Handle action fields
else if (actionId !== undefined && actionId !== null && actionId.length > 0) {
@@ -2596,7 +2596,7 @@ const CodeEditor = (props) => {
}
// Handle trigger fields
else if (triggerId !== undefined && triggerId !== null && triggerId.length > 0) {
handleSubflowParamChange(triggerId, triggerField, fixedcodedata)
handleTriggerParamChange(triggerId, triggerField, fixedcodedata)
}
setExpansionModalOpen(false)
+11 -7
View File
@@ -13032,7 +13032,7 @@ const AngularWorkflow = (defaultprops) => {
event.preventDefault()
setExpansionModalOpen(true)
setActiveDialog("codeeditor")
navigate(`?condition_id=${data.id}&field=${data.name}`)
navigate(`?condition_id=${data.id}&condition_field=${data.name}`)
setEditorData({
"name": data.name,
"value": data.value || "",
@@ -13117,9 +13117,9 @@ const AngularWorkflow = (defaultprops) => {
// Update the field value based on type
if (type === "source") {
handleConditionFieldChange("source", "value", toComplete);
handleConditionFieldChange("source", toComplete);
} else if (type === "destination") {
handleConditionFieldChange("destination", "value", toComplete);
handleConditionFieldChange("destination", toComplete);
}
handleMenuClose();
@@ -13996,7 +13996,7 @@ const AngularWorkflow = (defaultprops) => {
/>
</Dialog>
const handleConditionFieldChange = (fieldType, fieldName, value) => {
const handleConditionFieldChange = (fieldType, value) => {
if (fieldType === "source") {
setSourceValue({
...sourceValue,
@@ -15197,7 +15197,7 @@ const AngularWorkflow = (defaultprops) => {
}
]
const handleSubflowParamChange = (triggerId, triggerField, newData) => {
const handleTriggerParamChange = (triggerId, triggerField, newData) => {
var updateFail = ""
if (workflow !== undefined && workflow !== null) {
@@ -17336,9 +17336,13 @@ const AngularWorkflow = (defaultprops) => {
fullWidth
rows="4"
multiline
defaultValue={selectedTrigger.parameters[0]?.value}
value={selectedTriggerValue || ""}
color="primary"
placeholder=""
onChange={(e) => {
setLastSaved(false)
setSelectedTriggerValue(e.target.value)
}}
onBlur={(e) => {
setLastSaved(false)
setTriggerTextInformationWrapper(e.target.value);
@@ -25472,7 +25476,7 @@ const AngularWorkflow = (defaultprops) => {
// selectedTrigger={selectedTrigger}
aiSubmit={aiSubmit}
toolsAppId={toolsApp.id}
handleSubflowParamChange={handleSubflowParamChange}
handleTriggerParamChange={handleTriggerParamChange}
codedata={editorData.value}
setcodedata={setcodedata}
selectedEdge={selectedEdge}
+35 -26
View File
@@ -314,12 +314,15 @@ const LoginPage = props => {
},
})
if (serverside !== true) {
const tmpMessage = new URLSearchParams(window.location.search).get("message")
if (tmpMessage !== undefined && tmpMessage !== null && message !== tmpMessage) {
setMessage(tmpMessage)
useEffect(() => {
if (serverside !== true) {
const tmpMessage = new URLSearchParams(window.location.search).get("message")
if (tmpMessage !== undefined && tmpMessage !== null && message !== tmpMessage) {
setMessage(tmpMessage)
toast(tmpMessage)
}
}
}
}, [])
if (document !== undefined) {
if (register) {
@@ -444,13 +447,17 @@ const LoginPage = props => {
}
if (isLoggedIn === true && serverside !== true) {
const tmpView = new URLSearchParams(window.location.search).get("view")
if (tmpView !== undefined && tmpView !== null && tmpView === "pricing") {
window.location.pathname = "/pricing"
return
} else if (tmpView !== undefined && tmpView !== null) {
window.location.pathname = tmpView
return
const tmpView = new URLSearchParams(window.location.search).get("view");
if (tmpView !== undefined && tmpView !== null) {
let pathOnly = tmpView.split("?")[0];
if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
if (pathOnly === "/pricing" || pathOnly === "admin") {
window.location.replace(pathOnly + window.location.search);
} else {
window.location.replace(pathOnly);
}
return;
}
window.location.pathname = "/workflows"
@@ -575,20 +582,17 @@ const LoginPage = props => {
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) {
//const newUrl = `/${tmpView}${decodeURIComponent(window.location.search)}`
// Check if slash in the url
let pathOnly = tmpView.split("?")[0];
if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
var newUrl = `/${tmpView}`
if (tmpView.startsWith("/")) {
newUrl = `${tmpView}`
if (pathOnly === "/pricing" || pathOnly === "admin") {
window.location.replace(pathOnly + window.location.search);
} else {
window.location.replace(pathOnly);
}
console.log("Found url: ", newUrl)
window.location.pathname = newUrl
return
return;
}
console.log("LOGIN DATA: ", responseJson)
@@ -647,9 +651,14 @@ const LoginPage = props => {
const tmpView = new URLSearchParams(window.location.search).get("view")
if (tmpView !== undefined && tmpView !== null) {
//const newUrl = `/${tmpView}${decodeURIComponent(window.location.search)}`
const newUrl = `/${tmpView}`
window.location.pathname = newUrl
let pathOnly = tmpView.split("?")[0];
if (!pathOnly.startsWith("/")) pathOnly = "/" + pathOnly;
if (pathOnly === "/pricing" || pathOnly === "admin") {
window.location.replace(pathOnly + window.location.search);
} else {
window.location.replace(pathOnly);
}
return
}
+6 -1
View File
@@ -458,7 +458,12 @@ const Settings = (props) => {
if (responseJson["success"] === false) {
setPasswordFormMessage(responseJson["reason"]);
} 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("");
}
})
+4 -2
View File
@@ -5071,7 +5071,7 @@ const Workflows2 = (props) => {
//isLoaded && isLoggedIn && workflowDone ? (
const loadedCheck =
workflowDone ? (
workflowDone && isLoaded ? (
<div>
{/*
<ShepherdTour steps={newSteps} tourOptions={tourOptions}>
@@ -5134,7 +5134,9 @@ const Workflows2 = (props) => {
}}
>
<CircularProgress />
<Typography>Loading Workflows</Typography>
<Typography style={{marginTop: 5, }}>
Loading Workflows and Apps
</Typography>
</div>
);