From e3836538fcbe2b64764bccf85afd68184379722b Mon Sep 17 00:00:00 2001 From: Prakash Senthil Vel <23444145+prakashsvmx@users.noreply.github.com> Date: Wed, 16 Mar 2022 17:22:02 +0000 Subject: [PATCH] UX back button to be consistent in all screens (#1726) --- portal-ui/src/common/BackLink.tsx | 66 ++++++++++++------- portal-ui/src/icons/BackIcon.tsx | 44 +++++++++++++ portal-ui/src/icons/index.ts | 1 + .../Buckets/BucketDetails/BrowserHandler.tsx | 9 +-- .../Console/Buckets/ListBuckets/AddBucket.tsx | 2 +- .../screens/Console/Common/IconsScreen.tsx | 5 ++ .../Common/ModalWrapper/ModalWrapper.tsx | 5 -- .../Console/Common/PageHeader/PageHeader.tsx | 2 +- .../AddTierConfiguration.tsx | 11 +++- .../TiersConfiguration/TierTypeSelector.tsx | 10 ++- .../Console/Groups/GroupDetailsHeader.tsx | 6 +- .../src/screens/Console/Groups/Groups.tsx | 2 +- .../screens/Console/Groups/GroupsDetails.tsx | 2 - portal-ui/src/screens/Console/Menu/Menu.tsx | 2 +- .../AddNotificationEndpoint.tsx | 14 ++-- .../NotificationTypeSelector.tsx | 15 +++-- .../Console/Policies/PolicyDetails.tsx | 7 +- .../src/screens/Console/Support/Register.tsx | 47 ++++++------- .../Console/Tenants/AddTenant/AddTenant.tsx | 2 +- .../Tenants/TenantDetails/TenantDetails.tsx | 8 +-- .../src/screens/Console/Users/ListUsers.tsx | 2 +- .../src/screens/Console/Users/UserDetails.tsx | 7 +- 22 files changed, 168 insertions(+), 101 deletions(-) create mode 100644 portal-ui/src/icons/BackIcon.tsx diff --git a/portal-ui/src/common/BackLink.tsx b/portal-ui/src/common/BackLink.tsx index 4966d483e..9e9168200 100644 --- a/portal-ui/src/common/BackLink.tsx +++ b/portal-ui/src/common/BackLink.tsx @@ -19,30 +19,45 @@ import { Link } from "react-router-dom"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; -import { BackSettingsIcon } from "../icons"; +import { BackIcon } from "../icons"; +import { Box } from "@mui/material"; const styles = (theme: Theme) => createStyles({ link: { - display: "flex", + display: "inline-block", alignItems: "center", + justifyContent: "center", textDecoration: "none", - maxWidth: "300px", - padding: "2rem 2rem 0rem 2rem", - color: theme.palette.primary.light, - fontSize: ".8rem", - "&:hover": { - textDecoration: "underline", + maxWidth: "40px", + "&:active": { + color: theme.palette.primary.light, }, }, icon: { - marginRight: ".3rem", + marginRight: "11px", display: "flex", alignItems: "center", justifyContent: "center", - "& svg.min-icon": { - width: 12, + height: "35px", + width: "35px", + borderRadius: "2px", + "&:hover": { + background: "rgba(234,237,238)", }, + "& svg.min-icon": { + width: "18px", + height: "12px", + }, + }, + label: { + display: "flex", + alignItems: "center", + height: "35px", + padding: "0 0px 0 5px", + fontSize: "18px", + fontWeight: 600, + color: theme.palette.primary.light, }, }); @@ -62,20 +77,27 @@ const BackLink = ({ executeOnClick, }: IBackLink) => { return ( - { - if (executeOnClick) { - executeOnClick(); - } + -
- -
+ { + if (executeOnClick) { + executeOnClick(); + } + }} + > +
+ +
+
{label}
- +
); }; diff --git a/portal-ui/src/icons/BackIcon.tsx b/portal-ui/src/icons/BackIcon.tsx new file mode 100644 index 000000000..12c0d7a01 --- /dev/null +++ b/portal-ui/src/icons/BackIcon.tsx @@ -0,0 +1,44 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2022 MinIO, Inc. +// +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU Affero General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Affero General Public License for more details. +// +// You should have received a copy of the GNU Affero General Public License +// along with this program. If not, see . + +import React, { SVGProps } from "react"; + +const BackIcon = (props: SVGProps) => { + return ( + + + + + + + + + ); +}; + +export default BackIcon; diff --git a/portal-ui/src/icons/index.ts b/portal-ui/src/icons/index.ts index 6994b618f..9466931df 100644 --- a/portal-ui/src/icons/index.ts +++ b/portal-ui/src/icons/index.ts @@ -179,3 +179,4 @@ export { default as OpenSourceIcon } from "./OpenSourceIcon"; export { default as ArrowRightLink } from "./ArrowRightLink"; export { default as LicenseDocIcon } from "./LicenseDocIcon"; export { default as SelectAllIcon } from "./SelectAllIcon"; +export { default as BackIcon } from "./BackIcon"; diff --git a/portal-ui/src/screens/Console/Buckets/BucketDetails/BrowserHandler.tsx b/portal-ui/src/screens/Console/Buckets/BucketDetails/BrowserHandler.tsx index d549941f8..5ada4164a 100644 --- a/portal-ui/src/screens/Console/Buckets/BucketDetails/BrowserHandler.tsx +++ b/portal-ui/src/screens/Console/Buckets/BucketDetails/BrowserHandler.tsx @@ -38,6 +38,7 @@ import { IAM_PERMISSIONS, IAM_ROLES, IAM_SCOPES, + IAM_PAGES, } from "../../../../common/SecureComponent/permissions"; import SearchBox from "../../Common/SearchBox"; import BackLink from "../../../../common/BackLink"; @@ -98,13 +99,7 @@ const BrowserHandler = ({ return ( - } + label={} actions={ - +
{
LicenseDocIcon + + +
+ BackIcon +

Menu Icons

createStyles({ ...deleteDialogStyles, - root: { - "& .MuiPaper-root": { - padding: "0 2rem 2rem 1rem", - }, - }, content: { padding: 25, paddingBottom: 0, diff --git a/portal-ui/src/screens/Console/Common/PageHeader/PageHeader.tsx b/portal-ui/src/screens/Console/Common/PageHeader/PageHeader.tsx index 27dad51c0..5bb47b565 100644 --- a/portal-ui/src/screens/Console/Common/PageHeader/PageHeader.tsx +++ b/portal-ui/src/screens/Console/Common/PageHeader/PageHeader.tsx @@ -60,7 +60,7 @@ const styles = (theme: Theme) => color: "#000", fontSize: 18, fontWeight: 700, - marginLeft: 34, + marginLeft: 21, marginTop: 8, }, rightMenu: { diff --git a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx index 74d207f5a..92432779c 100644 --- a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx +++ b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx @@ -310,9 +310,14 @@ const AddTierConfiguration = ({ return ( - - - + + + + } + actions={} + /> { return ( - - + + + + } + actions={} + /> createStyles({ @@ -23,9 +23,7 @@ const GroupDetailsHeader = ({ classes }: DetailsHeaderProps) => { - - Groups - + } actions={} diff --git a/portal-ui/src/screens/Console/Groups/Groups.tsx b/portal-ui/src/screens/Console/Groups/Groups.tsx index 1f4780294..dadc508f1 100644 --- a/portal-ui/src/screens/Console/Groups/Groups.tsx +++ b/portal-ui/src/screens/Console/Groups/Groups.tsx @@ -259,7 +259,7 @@ const Groups = ({ classes, setErrorSnackMessage }: IGroupsProps) => { /> - + } diff --git a/portal-ui/src/screens/Console/Groups/GroupsDetails.tsx b/portal-ui/src/screens/Console/Groups/GroupsDetails.tsx index da2254e2b..e46ad9cb3 100644 --- a/portal-ui/src/screens/Console/Groups/GroupsDetails.tsx +++ b/portal-ui/src/screens/Console/Groups/GroupsDetails.tsx @@ -33,7 +33,6 @@ import DeleteGroup from "./DeleteGroup"; import VerticalTabs from "../Common/VerticalTabs/VerticalTabs"; import FormSwitchWrapper from "../Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper"; import PageLayout from "../Common/Layout/PageLayout"; -import BackLink from "../../../common/BackLink"; import PanelTitle from "../Common/PanelTitle/PanelTitle"; import SearchBox from "../Common/SearchBox"; import { @@ -277,7 +276,6 @@ const GroupsDetails = ({ classes }: IGroupDetailsProps) => { return ( - diff --git a/portal-ui/src/screens/Console/Menu/Menu.tsx b/portal-ui/src/screens/Console/Menu/Menu.tsx index ead77bcaa..d184d2cea 100644 --- a/portal-ui/src/screens/Console/Menu/Menu.tsx +++ b/portal-ui/src/screens/Console/Menu/Menu.tsx @@ -35,7 +35,7 @@ import MenuToggle from "./MenuToggle"; import ConsoleMenuList from "./ConsoleMenuList"; import { validRoutes } from "../valid-routes"; -const drawerWidth = 245; +const drawerWidth = 250; const styles = (theme: Theme) => createStyles({ diff --git a/portal-ui/src/screens/Console/NotificationEndpoints/AddNotificationEndpoint.tsx b/portal-ui/src/screens/Console/NotificationEndpoints/AddNotificationEndpoint.tsx index a80ae621f..8e46e229a 100644 --- a/portal-ui/src/screens/Console/NotificationEndpoints/AddNotificationEndpoint.tsx +++ b/portal-ui/src/screens/Console/NotificationEndpoints/AddNotificationEndpoint.tsx @@ -187,10 +187,16 @@ const AddNotificationEndpoint = ({ return ( - - + + + } + actions={} /> diff --git a/portal-ui/src/screens/Console/NotificationEndpoints/NotificationTypeSelector.tsx b/portal-ui/src/screens/Console/NotificationEndpoints/NotificationTypeSelector.tsx index af9e62da9..88bf8cdc3 100644 --- a/portal-ui/src/screens/Console/NotificationEndpoints/NotificationTypeSelector.tsx +++ b/portal-ui/src/screens/Console/NotificationEndpoints/NotificationTypeSelector.tsx @@ -44,11 +44,16 @@ const styles = (theme: Theme) => const NotificationTypeSelector = ({ classes }: INotificationTypeSelector) => { return ( - - + + + } + actions={} />
diff --git a/portal-ui/src/screens/Console/Policies/PolicyDetails.tsx b/portal-ui/src/screens/Console/Policies/PolicyDetails.tsx index 7ac9417d1..f34490046 100644 --- a/portal-ui/src/screens/Console/Policies/PolicyDetails.tsx +++ b/portal-ui/src/screens/Console/Policies/PolicyDetails.tsx @@ -31,7 +31,6 @@ import { Button, LinearProgress } from "@mui/material"; import TableWrapper from "../Common/TableWrapper/TableWrapper"; import api from "../../../common/api"; import PageHeader from "../Common/PageHeader/PageHeader"; -import { Link } from "react-router-dom"; import { setErrorSnackMessage, setSnackBarMessage } from "../../../actions"; import { ErrorResponseHandler } from "../../../common/types"; import CodeMirrorWrapper from "../Common/FormComponents/CodeMirrorWrapper/CodeMirrorWrapper"; @@ -333,13 +332,11 @@ const PolicyDetails = ({ - - Policy - + } /> - + ) : null} - {!onlineActivation ? ( - - - setOnlineActivation(!onlineActivation)} - > - Back to Online Activation - - - ) : null} - {clusterRegistered ? null : formTitle} {clusterRegistered ? null : clusterRegistrationForm} @@ -1019,7 +995,26 @@ const Register = ({ return ( - + + {!onlineActivation ? ( + { + fetchSubnetRegToken(); + setOnlineActivation(!onlineActivation); + }} + /> + ) : ( + "Register" + )} + + } + actions={} + /> + {uiToShow} ); diff --git a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx index fefd1f98f..9c7f834bb 100644 --- a/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx +++ b/portal-ui/src/screens/Console/Tenants/AddTenant/AddTenant.tsx @@ -766,7 +766,7 @@ const AddTenant = ({ diff --git a/portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx b/portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx index e7f3b77e5..9fa446411 100644 --- a/portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx +++ b/portal-ui/src/screens/Console/Tenants/TenantDetails/TenantDetails.tsx @@ -328,16 +328,16 @@ const TenantDetails = ({ closeDeleteModalAndRefresh={closeDeleteModalAndRefresh} /> )} + - - Tenants - + } + actions={} /> - + { /> - + } diff --git a/portal-ui/src/screens/Console/Users/UserDetails.tsx b/portal-ui/src/screens/Console/Users/UserDetails.tsx index 389d3b339..eba1984ab 100644 --- a/portal-ui/src/screens/Console/Users/UserDetails.tsx +++ b/portal-ui/src/screens/Console/Users/UserDetails.tsx @@ -16,8 +16,6 @@ import React, { Fragment, useCallback, useEffect, useState } from "react"; import { connect } from "react-redux"; -import { Link } from "react-router-dom"; - import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; @@ -189,9 +187,7 @@ const UserDetails = ({ classes, match }: IUserDetailsProps) => { - - Users - + } actions={} @@ -233,7 +229,6 @@ const UserDetails = ({ classes, match }: IUserDetailsProps) => { closeModal={() => setChangeUserPasswordModalOpen(false)} /> )} -