From afe052fc48beb3807ce95b1944e44b1c9b2df26d Mon Sep 17 00:00:00 2001 From: Frikky Date: Thu, 5 Jun 2025 00:30:30 +0200 Subject: [PATCH] Minor left sidebar fixes for notification discovery --- frontend/src/components/LeftSideBar.jsx | 138 ++++++++++++++++-------- frontend/src/views/AppCreator.jsx | 39 ++++--- 2 files changed, 115 insertions(+), 62 deletions(-) diff --git a/frontend/src/components/LeftSideBar.jsx b/frontend/src/components/LeftSideBar.jsx index 395f58f8..27ecf529 100644 --- a/frontend/src/components/LeftSideBar.jsx +++ b/frontend/src/components/LeftSideBar.jsx @@ -562,7 +562,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { "& .MuiPaper-root": { backgroundColor: theme.palette.backgroundColor, color: theme.palette.text.primary, - borderRadius: 1, + borderRadius: theme.palette.borderRadius/3, }, "& .MuiList-root": { backgroundColor: theme.palette.backgroundColor, @@ -602,6 +602,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { aria-label="theme" style={{display: 'flex', justifyContent: "center", marginBottom: 10, }} > + @@ -622,7 +623,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { }} style={{fontSize: 18}} > - Organization + Org Admin @@ -632,11 +633,13 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { }} style={{fontSize: 18}} > - Account + User Account + + {/* { @@ -644,7 +647,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { }} style={{fontSize: 18}} > - Notifications ({ + Org Notifications ({ notifications === undefined || notifications === null ? 0 : notifications?.filter((notification) => notification.read === false).length }) @@ -652,6 +655,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { + */} 0 ? userdata?.active_org?.branding?.documentation_link : "/docs" } target={userdata?.active_org?.branding?.documentation_link?.length > 0 && userdata?.org_status?.includes("integration_partner") ? "_blank" : "_self" } style={hrefStyle}> { + { setOpenSecurityTab((prev) => !prev); @@ -1456,10 +1461,11 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { )} + { - - + + + + + + ): null} diff --git a/frontend/src/views/AppCreator.jsx b/frontend/src/views/AppCreator.jsx index ee6d8831..1a4c5104 100755 --- a/frontend/src/views/AppCreator.jsx +++ b/frontend/src/views/AppCreator.jsx @@ -1983,6 +1983,8 @@ const AppCreator = (defaultprops) => { const schemes = [splitBase[0]]; const basePath = "/" + splitBase.slice(3).join("/"); + const newBaseUrl = baseUrl.replaceAll("http//", "http://").replaceAll("https//", "https://") + const data = { openapi: "3.0.0", info: { @@ -1991,7 +1993,7 @@ const AppCreator = (defaultprops) => { version: "1.0", "x-logo": fileBase64, }, - servers: [{ url: baseUrl }], + servers: [{ url: newBaseUrl }], host: host, basePath: basePath, schemes: schemes, @@ -2637,12 +2639,17 @@ const AppCreator = (defaultprops) => { credentials: "include", }) .then((response) => { + setAppBuilding(false) if (response.status === 403) { + + var urlParams = new URLSearchParams(window.location.search) if (urlParams.has("id")) { toast.error(`Please log in to build this app. If this error persists, please contact ${supportEmail}`) } else { - toast.error("Failed to save the app as you are not the owner. Redirecting you to the forking page. When there, save again.") + toast.error("Failed to save the app as you are not the owner. Redirecting you to the forking page. If this does not load, please download and re-import the app.", { + autoClose: 10000 + }) if (props.match.params.appid !== undefined && props.match.params.appid !== null && props.match.params.appid.length > 0) { setTimeout(() => { window.open(`/apps/new?id=${props.match.params.appid}`, "_blank") @@ -2658,19 +2665,16 @@ const AppCreator = (defaultprops) => { //throw new Error("NOT 200 :O") } - setAppBuilding(false); return response.json(); }) .then((responseJson) => { - if (!responseJson.success) { - if (responseJson.extra !== undefined && responseJson.extra !== null) { + if (responseJson?.success !== true) { + if (responseJson?.extra !== undefined && responseJson?.extra !== null) { toast("Failed building: " + responseJson.extra); - } - - if (responseJson.reason !== undefined) { + } else if (responseJson?.reason !== undefined) { setErrorCode(responseJson.reason); - if (responseJson.details !== undefined && responseJson.details !== null) { + if (responseJson?.details !== undefined && responseJson?.details !== null) { toast.error("Failed to build - contact support@shuffler.io: " + responseJson.details, { autoClose: 60000 }) @@ -2679,7 +2683,8 @@ const AppCreator = (defaultprops) => { autoClose: 10000 }) } - } + } else { + } } else { toast.success("Successfully built openapi app! Added job to rebuild it in your hybrid runtime locations (Orborus)."); if (window.location.pathname.includes("/new")) { @@ -6117,7 +6122,7 @@ const AppCreator = (defaultprops) => { value={baseUrl} helperText={ - Must start with http(s):// and CANT end with /.{" "} + Must start with http(s):// and can NOT end with /.{" "} } placeholder="https://api.example.com" @@ -6136,12 +6141,12 @@ const AppCreator = (defaultprops) => { toast("URL must start with http(s)://"); } - if (tmpstring.includes("?")) { - var newtmp = tmpstring.split("?") - if (tmpstring.length > 1) { - tmpstring = newtmp[0] - } - } + if (tmpstring.includes("?")) { + var newtmp = tmpstring.split("?") + if (tmpstring.length > 1) { + tmpstring = newtmp[0] + } + } setBaseUrl(tmpstring); }}