From a137368eee07b405eef75a5a17bb4c0ac0ceedc6 Mon Sep 17 00:00:00 2001 From: monilprajapati Date: Fri, 10 Oct 2025 17:40:06 +0530 Subject: [PATCH] Sync UI files from cloud --- frontend/src/components/Billing.jsx | 5 +- frontend/src/components/LeftSideBar.jsx | 98 ++++++++++++++++++++- frontend/src/components/LicencePopup.jsx | 22 +++-- frontend/src/components/OrganizationTab.jsx | 78 +++++++++++++--- 4 files changed, 181 insertions(+), 22 deletions(-) diff --git a/frontend/src/components/Billing.jsx b/frontend/src/components/Billing.jsx index 3ed76123..b93848b1 100644 --- a/frontend/src/components/Billing.jsx +++ b/frontend/src/components/Billing.jsx @@ -2099,13 +2099,13 @@ const Billing = memo((props) => { {isCloud ? "Get more out of Shuffle by adding your credit card, such as no App Run limitations, and priority support from our team. We use Stripe to manage subscriptions and do not store any of your billing information. You can manage your subscription and billing information below." : - "Shuffle is an Open Source automation platform, and no license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update." + !(selectedOrganization?.subscriptions !== undefined && selectedOrganization?.subscriptions.length > 0 && selectedOrganization?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && selectedOrganization?.subscriptions[0]?.active) ? "Shuffle is an Enterprise automation platform, and a license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update." : "Here you can check your license and billing information." } : {isCloud ? "Get more out of Shuffle by adding your credit card, such as no App Run limitations, and priority support from our team. We use Stripe to manage subscriptions and do not store any of your billing information. You can manage your subscription and billing information below." : - "Shuffle is an Open Source automation platform, and no license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update." + !(selectedOrganization?.subscriptions !== undefined && selectedOrganization?.subscriptions.length > 0 && selectedOrganization?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && selectedOrganization?.subscriptions[0]?.active) ? "Shuffle is an Enterprise automation platform, and a license is required. We do however offer a Scale license with HA guarantees, along with support hours. By buying a license on https://shuffler.io, you can get access to the license immediately, and if Cloud Syncronisation is enabled, the UI in your local instance will also update." : "Here you can check your license and billing information." } } } @@ -2924,6 +2924,7 @@ const Billing = memo((props) => { userdata={userdata} currentTab={currentTab} syncStats={true} + statistics={statistics} /> } diff --git a/frontend/src/components/LeftSideBar.jsx b/frontend/src/components/LeftSideBar.jsx index cb851d43..8bc3b734 100644 --- a/frontend/src/components/LeftSideBar.jsx +++ b/frontend/src/components/LeftSideBar.jsx @@ -92,6 +92,8 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { region_url: org.region_url, })) || [] ); + const [activeOrgData, setActiveOrgData] = useState(null); + const [isProdStatusOn, setIsProdStatusOn] = useState(false); const userOrgs = React.useMemo(() => { return orgOptions.find((option) => option.name === selectedOrg); }, [selectedOrg, orgOptions]); @@ -682,7 +684,7 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { Version: - 2.1.0 + 2.1.1 @@ -936,6 +938,40 @@ const LeftSideBar = ({ userdata, serverside, globalUrl, notifications, }) => { const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent); const showPartnerLogo = userdata?.org_status?.includes("integration_partner") && userdata?.active_org?.image !== undefined && userdata?.active_org?.image !== null && userdata?.active_org?.image.length > 0 + useEffect(() => { + const orgId = userdata?.active_org?.id; + if (!orgId) { + return; + } + + let fetched = false; + fetch(`${globalUrl}/api/v1/orgs/${orgId}`, { + method: "GET", + credentials: "include", + headers: { "Content-Type": "application/json" }, + }) + .then((response) => (response.ok ? response.json() : null)) + .then((org) => { + if (!fetched && org) { + setActiveOrgData(org); + if (!isCloud) { + if (org?.cloud_sync && org?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && org?.subscriptions[0]?.active) { + setIsProdStatusOn(true); + } else if (org?.subscriptions[0]?.name?.toLowerCase().includes("enterprise") && org?.subscriptions[0]?.active) { + setIsProdStatusOn(true); + } else { + setIsProdStatusOn(false); + } + } + } + }) + .catch(() => {}); + + return () => { + fetched = true; + }; + }, [userdata?.active_org?.id, globalUrl]); + return (
{ } }} > + { style={{ width: showPartnerLogo ? 30 : 24, height: showPartnerLogo ? 30 : 24 }} /> - + + { + !isCloud && expandLeftNav && ( + + {isProdStatusOn ? "Enterprise" : "Open Source"} + + ) + } + { }} > + {!isCloud ? ( +
{ + navigate("/admin?admin_tab=prodstatus") + }} + > + + + {expandLeftNav ? isProdStatusOn ? "Prod. Status ON" : "Prod. Status OFF" : isProdStatusOn ? "ON" : "OFF"} + +
+ ) : null} + {userdata?.licensed !== true && !userdata?.org_status?.includes("integration_partner") && expandLeftNav &&
-
{ )}
+ )} {(localSub.enddate || localSub.Enddate) && localSub.active ? ( {`${ isPaidPlan ? "Next billing: " : "App runs resets on " @@ -1494,7 +1504,7 @@ const LicencePopup = (props) => { Manage subscription ) : null} - {subscription.amount === "0" && ( + {!isPaidPlan && (