From c8a39f95448631ee6c4fcca12a523ed51cef98da Mon Sep 17 00:00:00 2001 From: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com> Date: Thu, 13 Jun 2024 20:31:25 +0530 Subject: [PATCH] update logo as per mineos plans (#3383) --- api/license.go | 10 +++++ web-app/src/config.ts | 39 ++++++++++++++++++- .../AnonymousAccess/AnonymousAccess.tsx | 4 +- .../src/screens/Console/License/License.tsx | 6 ++- .../screens/Console/License/LicensePlans.tsx | 12 +++++- web-app/src/screens/Console/License/utils.tsx | 9 ++++- .../src/screens/Console/Menu/MenuWrapper.tsx | 11 +++++- web-app/src/screens/LoginPage/Login.tsx | 7 +++- .../src/screens/LoginPage/LoginCallback.tsx | 7 +++- 9 files changed, 91 insertions(+), 14 deletions(-) diff --git a/api/license.go b/api/license.go index 4a13171dd..54ab0574e 100644 --- a/api/license.go +++ b/api/license.go @@ -30,6 +30,8 @@ const ( PlanAGPL SubnetPlan = iota PlanStandard PlanEnterprise + PlanEnterpriseLite + PlanEnterprisePlus ) func (sp SubnetPlan) String() string { @@ -38,6 +40,10 @@ func (sp SubnetPlan) String() string { return "standard" case PlanEnterprise: return "enterprise" + case PlanEnterpriseLite: + return "enterprise-lite" + case PlanEnterprisePlus: + return "enterprise-plus" default: return "agpl" } @@ -65,6 +71,10 @@ func fetchLicensePlan() { InstanceLicensePlan = PlanStandard case "ENTERPRISE": InstanceLicensePlan = PlanEnterprise + case "ENTERPRISE-LITE": + InstanceLicensePlan = PlanEnterpriseLite + case "ENTERPRISE-PLUS": + InstanceLicensePlan = PlanEnterprisePlus default: InstanceLicensePlan = PlanAGPL } diff --git a/web-app/src/config.ts b/web-app/src/config.ts index 8760528a6..2248ec3bd 100644 --- a/web-app/src/config.ts +++ b/web-app/src/config.ts @@ -14,6 +14,8 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . +import { ApplicationLogoProps } from "mds"; + export const MinIOPlan = ( document.head.querySelector( @@ -21,11 +23,25 @@ export const MinIOPlan = ) as HTMLMetaElement )?.content || "AGPL"; -type LogoVar = "simple" | "AGPL" | "standard" | "enterprise"; +type LogoVar = + | "AGPL" + | "simple" + | "standard" + | "enterprise" + | "new" + | "enterpriseos" + | "enterpriseosvertical" + | undefined; export const getLogoVar = (): LogoVar => { let logoVar: LogoVar = "AGPL"; switch (MinIOPlan.toLowerCase()) { + case "enterprise-lite": + logoVar = "enterpriseos"; + break; + case "enterprise-plus": + logoVar = "enterpriseos"; + break; case "enterprise": logoVar = "enterprise"; break; @@ -39,7 +55,26 @@ export const getLogoVar = (): LogoVar => { return logoVar; }; +export const getLogoApplicationVariant = + (): ApplicationLogoProps["applicationName"] => { + switch (MinIOPlan.toLowerCase()) { + case "enterprise-lite": + case "enterprise-plus": + return "minio"; + default: + return "console"; + } + }; + export const registeredCluster = (): boolean => { const plan = getLogoVar(); - return plan === "standard" || plan === "enterprise"; + return [ + "AGPL", + "simple", + "standard", + "enterprise", + "new", + "enterpriseos", + "enterpriseosvertical", + ].includes(plan || "AGPL"); }; diff --git a/web-app/src/screens/AnonymousAccess/AnonymousAccess.tsx b/web-app/src/screens/AnonymousAccess/AnonymousAccess.tsx index 756c43a21..f4321fa13 100644 --- a/web-app/src/screens/AnonymousAccess/AnonymousAccess.tsx +++ b/web-app/src/screens/AnonymousAccess/AnonymousAccess.tsx @@ -21,7 +21,7 @@ import { IAM_PAGES } from "../../common/SecureComponent/permissions"; import { resetSession } from "../Console/consoleSlice"; import { useAppDispatch } from "../../store"; import { resetSystem } from "../../systemSlice"; -import { getLogoVar } from "../../config"; +import { getLogoApplicationVariant, getLogoVar } from "../../config"; import ObjectBrowser from "../Console/ObjectBrowser/ObjectBrowser"; import LoadingComponent from "../../common/LoadingComponent"; import ObjectManager from "../Console/Common/ObjectManager/ObjectManager"; @@ -46,7 +46,7 @@ const AnonymousAccess = () => { >
diff --git a/web-app/src/screens/Console/License/License.tsx b/web-app/src/screens/Console/License/License.tsx index fd03751e5..f8bdb0296 100644 --- a/web-app/src/screens/Console/License/License.tsx +++ b/web-app/src/screens/Console/License/License.tsx @@ -89,7 +89,11 @@ const License = () => { if (res) { if (res.plan === "STANDARD") { setCurrentPlanID(1); - } else if (res.plan === "ENTERPRISE") { + } else if ( + ["ENTERPRISE", "ENTERPRISE-LITE", "ENTERPRISE-PLUS"].includes( + res.plan, + ) + ) { setCurrentPlanID(2); } else { setCurrentPlanID(1); diff --git a/web-app/src/screens/Console/License/LicensePlans.tsx b/web-app/src/screens/Console/License/LicensePlans.tsx index d5d4eb65d..bdeba96f0 100644 --- a/web-app/src/screens/Console/License/LicensePlans.tsx +++ b/web-app/src/screens/Console/License/LicensePlans.tsx @@ -385,7 +385,11 @@ const LicensePlans = ({ licenseInfo }: IRegisterStatus) => { const isCommunityPlan = currentPlan === LICENSE_PLANS.COMMUNITY; const isStandardPlan = currentPlan === LICENSE_PLANS.STANDARD; - const isEnterprisePlan = currentPlan === LICENSE_PLANS.ENTERPRISE; + const isEnterprisePlan = [ + LICENSE_PLANS.ENTERPRISE, + LICENSE_PLANS.ENTERPRISE_LITE, + LICENSE_PLANS.ENTERPRISE_PLUS, + ].includes(currentPlan); const isPaidPlan = PAID_PLANS.includes(currentPlan); @@ -393,7 +397,11 @@ const LicensePlans = ({ licenseInfo }: IRegisterStatus) => { const [xsPlanView, setXsPlanView] = useState(""); let isXsViewCommunity = xsPlanView === LICENSE_PLANS.COMMUNITY; let isXsViewStandard = xsPlanView === LICENSE_PLANS.STANDARD; - let isXsViewEnterprise = xsPlanView === LICENSE_PLANS.ENTERPRISE; + let isXsViewEnterprise = [ + LICENSE_PLANS.ENTERPRISE, + LICENSE_PLANS.ENTERPRISE_LITE, + LICENSE_PLANS.ENTERPRISE_PLUS, + ].includes(xsPlanView); const getCommunityPlanHeader = () => { return ( diff --git a/web-app/src/screens/Console/License/utils.tsx b/web-app/src/screens/Console/License/utils.tsx index 8ee0f1c8a..d7d453d6c 100644 --- a/web-app/src/screens/Console/License/utils.tsx +++ b/web-app/src/screens/Console/License/utils.tsx @@ -24,6 +24,8 @@ export const LICENSE_PLANS = { COMMUNITY: "community", STANDARD: "standard", ENTERPRISE: "enterprise", + ENTERPRISE_LITE: "enterprise-lite", + ENTERPRISE_PLUS: "enterprise-plus", }; type FeatureItem = { @@ -439,7 +441,12 @@ export const ENTERPRISE_PLAN_FEATURES = [ }, ]; -export const PAID_PLANS = [LICENSE_PLANS.STANDARD, LICENSE_PLANS.ENTERPRISE]; +export const PAID_PLANS = [ + LICENSE_PLANS.STANDARD, + LICENSE_PLANS.ENTERPRISE, + LICENSE_PLANS.ENTERPRISE_LITE, + LICENSE_PLANS.ENTERPRISE_PLUS, +]; export const getRenderValue = (val: any) => { return typeof val === "function" ? val() : val; diff --git a/web-app/src/screens/Console/Menu/MenuWrapper.tsx b/web-app/src/screens/Console/Menu/MenuWrapper.tsx index 0d179ee76..93c33f301 100644 --- a/web-app/src/screens/Console/Menu/MenuWrapper.tsx +++ b/web-app/src/screens/Console/Menu/MenuWrapper.tsx @@ -21,7 +21,11 @@ import { AppState, useAppDispatch } from "../../../store"; import { validRoutes } from "../valid-routes"; import { menuOpen } from "../../../systemSlice"; import { selFeatures } from "../consoleSlice"; -import { getLogoVar, registeredCluster } from "../../../config"; +import { + getLogoApplicationVariant, + getLogoVar, + registeredCluster, +} from "../../../config"; import { useLocation, useNavigate } from "react-router-dom"; import { getLicenseConsent } from "../License/utils"; @@ -55,7 +59,10 @@ const MenuWrapper = () => { isOpen={sidebarOpen} displayGroupTitles options={allowedMenuItems} - applicationLogo={{ applicationName: "console", subVariant: getLogoVar() }} + applicationLogo={{ + applicationName: getLogoApplicationVariant(), + subVariant: getLogoVar(), + }} callPathAction={(path) => { navigate(path); }} diff --git a/web-app/src/screens/LoginPage/Login.tsx b/web-app/src/screens/LoginPage/Login.tsx index d9499d64e..8a2623d5e 100644 --- a/web-app/src/screens/LoginPage/Login.tsx +++ b/web-app/src/screens/LoginPage/Login.tsx @@ -24,7 +24,7 @@ import { useSelector } from "react-redux"; import { getFetchConfigurationAsync } from "./loginThunks"; import { resetForm } from "./loginSlice"; import StrategyForm from "./StrategyForm"; -import { getLogoVar } from "../../config"; +import { getLogoApplicationVariant, getLogoVar } from "../../config"; import { RedirectRule } from "api/consoleApi"; import { redirectRules } from "./login.utils"; import { setHelpName } from "../../systemSlice"; @@ -149,7 +149,10 @@ const Login = () => { ({ @@ -107,7 +107,10 @@ const LoginCallback = () => { return error !== "" || errorDescription !== "" ? (