Skip to content

Commit

Permalink
update logo as per mineos plans (#3383)
Browse files Browse the repository at this point in the history
  • Loading branch information
prakashsvmx committed Jun 13, 2024
1 parent e77d1be commit c8a39f9
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 14 deletions.
10 changes: 10 additions & 0 deletions api/license.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ const (
PlanAGPL SubnetPlan = iota
PlanStandard
PlanEnterprise
PlanEnterpriseLite
PlanEnterprisePlus
)

func (sp SubnetPlan) String() string {
Expand All @@ -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"
}
Expand Down Expand Up @@ -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
}
Expand Down
39 changes: 37 additions & 2 deletions web-app/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,34 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.

import { ApplicationLogoProps } from "mds";

export const MinIOPlan =
(
document.head.querySelector(
"[name~=minio-license][content]",
) 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;
Expand All @@ -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");
};
4 changes: 2 additions & 2 deletions web-app/src/screens/AnonymousAccess/AnonymousAccess.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand All @@ -46,7 +46,7 @@ const AnonymousAccess = () => {
>
<div style={{ width: 200, flexShrink: 1 }}>
<ApplicationLogo
applicationName={"console"}
applicationName={getLogoApplicationVariant()}
subVariant={getLogoVar()}
inverse={true}
/>
Expand Down
6 changes: 5 additions & 1 deletion web-app/src/screens/Console/License/License.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 10 additions & 2 deletions web-app/src/screens/Console/License/LicensePlans.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -385,15 +385,23 @@ 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);

/*In smaller screen use tabbed view to show features*/
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 (
Expand Down
9 changes: 8 additions & 1 deletion web-app/src/screens/Console/License/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ export const LICENSE_PLANS = {
COMMUNITY: "community",
STANDARD: "standard",
ENTERPRISE: "enterprise",
ENTERPRISE_LITE: "enterprise-lite",
ENTERPRISE_PLUS: "enterprise-plus",
};

type FeatureItem = {
Expand Down Expand Up @@ -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;
Expand Down
11 changes: 9 additions & 2 deletions web-app/src/screens/Console/Menu/MenuWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand Down Expand Up @@ -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);
}}
Expand Down
7 changes: 5 additions & 2 deletions web-app/src/screens/LoginPage/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down Expand Up @@ -149,7 +149,10 @@ const Login = () => {
<Fragment>
<MainError />
<LoginWrapper
logoProps={{ applicationName: "console", subVariant: getLogoVar() }}
logoProps={{
applicationName: getLogoApplicationVariant(),
subVariant: getLogoVar(),
}}
form={loginComponent}
formFooter={
<Box
Expand Down
7 changes: 5 additions & 2 deletions web-app/src/screens/LoginPage/LoginCallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { useNavigate } from "react-router-dom";
import api from "../../common/api";
import { baseUrl } from "../../history";
import { Box, Button, LoginWrapper, WarnIcon } from "mds";
import { getLogoVar } from "../../config";
import { getLogoApplicationVariant, getLogoVar } from "../../config";
import get from "lodash/get";

const CallBackContainer = styled.div(({ theme }) => ({
Expand Down Expand Up @@ -107,7 +107,10 @@ const LoginCallback = () => {
return error !== "" || errorDescription !== "" ? (
<Fragment>
<LoginWrapper
logoProps={{ applicationName: "console", subVariant: getLogoVar() }}
logoProps={{
applicationName: getLogoApplicationVariant(),
subVariant: getLogoVar(),
}}
form={
<CallBackContainer>
<div className={"errorTitle"}>
Expand Down

0 comments on commit c8a39f9

Please sign in to comment.