From b125121ac857cacd21b28038ac8264ee74ae681e Mon Sep 17 00:00:00 2001 From: Alex <33497058+bexsoft@users.noreply.github.com> Date: Mon, 21 Aug 2023 22:30:04 -0600 Subject: [PATCH] Migrated available mds components in Tiers Page (#3007) Signed-off-by: Benjamin Perez --- .../DistributedOnly/DistributedOnly.tsx | 26 +- .../FileSelector/FileSelector.tsx | 23 +- .../AddTierConfiguration.tsx | 79 ++--- .../ListTiersConfiguration.tsx | 322 ++++++++---------- .../RegionSelectWrapper.tsx | 15 +- .../TiersConfiguration/TierTypeCard.tsx | 81 ++--- .../UpdateTierCredentialsModal.tsx | 200 +++++------ 7 files changed, 312 insertions(+), 434 deletions(-) diff --git a/portal-ui/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx b/portal-ui/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx index a9502b29d..0bf77814c 100644 --- a/portal-ui/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx +++ b/portal-ui/src/screens/Console/Common/DistributedOnly/DistributedOnly.tsx @@ -15,8 +15,7 @@ // along with this program. If not, see . import React from "react"; -import { Box, Grid } from "@mui/material"; -import { HelpBox } from "mds"; +import { HelpBox, Box, Grid, breakPoints } from "mds"; interface IDistributedOnly { iconComponent: any; @@ -25,7 +24,7 @@ interface IDistributedOnly { const DistributedOnly = ({ iconComponent, entity }: IDistributedOnly) => { return ( - + { theme.colors.link, - textDecoration: "underline", + [`@media (max-width: ${breakPoints.sm}px)`]: { + display: "flex", + flexFlow: "column", }, }} > -
This feature is not available for a single-disk setup.
- -
+ + This feature is not available for a single-disk setup.  + + Please deploy a server in{" "} { Distributed Mode {" "} to use this feature. -
+
} /> diff --git a/portal-ui/src/screens/Console/Common/FormComponents/FileSelector/FileSelector.tsx b/portal-ui/src/screens/Console/Common/FormComponents/FileSelector/FileSelector.tsx index 6aaf126cb..f4a391726 100644 --- a/portal-ui/src/screens/Console/Common/FormComponents/FileSelector/FileSelector.tsx +++ b/portal-ui/src/screens/Console/Common/FormComponents/FileSelector/FileSelector.tsx @@ -16,8 +16,7 @@ import React, { useState } from "react"; import get from "lodash/get"; -import { Grid, InputLabel, Tooltip } from "@mui/material"; -import IconButton from "@mui/material/IconButton"; +import { Grid, InputLabel, Tooltip, IconButton } from "mds"; import AttachFileIcon from "@mui/icons-material/AttachFile"; import CancelIcon from "@mui/icons-material/Cancel"; import { Theme } from "@mui/material/styles"; @@ -96,16 +95,16 @@ const FileSelector = ({ {label !== "" && ( {label} @@ -113,7 +112,7 @@ const FileSelector = ({ {tooltip !== "" && (
- +
@@ -144,12 +143,9 @@ const FileSelector = ({ { setShowSelector(false); }} - disableRipple={false} - disableFocusRipple={false} size="small" > @@ -164,12 +160,9 @@ const FileSelector = ({ { setShowSelector(true); }} - disableRipple={false} - disableFocusRipple={false} size="small" > diff --git a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx index 14f084ce0..f840dc951 100644 --- a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx +++ b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/AddTierConfiguration.tsx @@ -18,19 +18,25 @@ import React, { Fragment, useCallback, useEffect, useState } from "react"; import { useNavigate, useParams } from "react-router-dom"; import get from "lodash/get"; -import Grid from "@mui/material/Grid"; import { Theme } from "@mui/material/styles"; -import { BackLink, Button, PageLayout } from "mds"; +import { + BackLink, + breakPoints, + Button, + Grid, + PageLayout, + InputBox, + SectionTitle, +} from "mds"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; -import { Box } from "@mui/material"; import { fileInputStyles, formFieldStyles, modalBasic, + modalStyleUtils, settingsCommon, } from "../../Common/FormComponents/common/styleLibrary"; -import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; import FileSelector from "../../Common/FormComponents/FileSelector/FileSelector"; import { azureServiceName, @@ -348,53 +354,28 @@ const AddTierConfiguration = ({ classes }: IAddNotificationEndpointProps) => { >
{type !== "" && targetElement ? ( - - {targetElement.logo ? ( - - {targetElement.logo} - - ) : null} - -
- - {titleSelection ? titleSelection : ""} - Add Tier - Configuration - -
-
+ + {titleSelection ? titleSelection : ""} - Add Tier Configuration + ) : null} - {type !== "" && ( - { error={nameInputError} required /> - { /> {(type === s3ServiceName || type === minioServiceName) && ( - { }} required /> - { )} {type === azureServiceName && ( - { }} required /> - { /> )} - { }} required /> - { type={type as "azure" | "s3" | "minio" | "gcs"} /> {type === s3ServiceName && ( - { )} - +
+
- {isLoading && } + {isLoading && } {!isLoading && ( {records.length > 0 && ( - + - - { - setSelectedTier(tierData); - setUpdateCredentialsOpen(true); - }, + { + setSelectedTier(tierData); + setUpdateCredentialsOpen(true); }, - ]} - columns={[ - { - label: "Tier Name", - elementKey: "type", - renderFunction: renderTierName, - renderFullObject: true, - }, - { - label: "Status", - elementKey: "status", - renderFunction: renderTierStatus, - width: 50, - }, - { - label: "Type", - elementKey: "type", - renderFunction: renderTierType, - width: 50, - }, - { - label: "Endpoint", - elementKey: "type", - renderFunction: renderTierEndpoint, - renderFullObject: true, - }, - { - label: "Bucket", - elementKey: "type", - renderFunction: renderTierBucket, - renderFullObject: true, - }, - { - label: "Prefix", - elementKey: "type", - renderFunction: renderTierPrefix, - renderFullObject: true, - }, - { - label: "Region", - elementKey: "type", - renderFunction: renderTierRegion, - renderFullObject: true, - }, - { - label: "Usage", - elementKey: "type", - renderFunction: renderTierUsage, - renderFullObject: true, - }, - { - label: "Objects", - elementKey: "type", - renderFunction: renderTierObjects, - renderFullObject: true, - }, - { - label: "Versions", - elementKey: "type", - renderFunction: renderTierVersions, - renderFullObject: true, - }, - ]} - isLoading={isLoading} - records={filteredRecords} - entityName="Tiers" - idField="service_name" - customPaperHeight={classes.customConfigurationPage} - /> - + }, + ]} + columns={[ + { + label: "Tier Name", + elementKey: "type", + renderFunction: renderTierName, + renderFullObject: true, + }, + { + label: "Status", + elementKey: "status", + renderFunction: renderTierStatus, + width: 50, + }, + { + label: "Type", + elementKey: "type", + renderFunction: renderTierType, + width: 50, + }, + { + label: "Endpoint", + elementKey: "type", + renderFunction: renderTierEndpoint, + renderFullObject: true, + }, + { + label: "Bucket", + elementKey: "type", + renderFunction: renderTierBucket, + renderFullObject: true, + }, + { + label: "Prefix", + elementKey: "type", + renderFunction: renderTierPrefix, + renderFullObject: true, + }, + { + label: "Region", + elementKey: "type", + renderFunction: renderTierRegion, + renderFullObject: true, + }, + { + label: "Usage", + elementKey: "type", + renderFunction: renderTierUsage, + renderFullObject: true, + }, + { + label: "Objects", + elementKey: "type", + renderFunction: renderTierObjects, + renderFullObject: true, + }, + { + label: "Versions", + elementKey: "type", + renderFunction: renderTierVersions, + renderFullObject: true, + }, + ]} + isLoading={isLoading} + records={filteredRecords} + entityName="Tiers" + idField="service_name" + customPaperHeight={"400px"} + /> { )} {records.length === 0 && ( - - - } - help={ - - Tiers are used by the MinIO Object Lifecycle - Management which allows creating rules for time or - date based automatic transition or expiry of - objects. For object transition, MinIO automatically - moves the object to a configured remote storage - tier. -
-
- {hasSetTier ? ( -
- To get started,{" "} - Create Tier - . -
- ) : ( - "" - )} -
- } - /> -
-
+ } + help={ + + Tiers are used by the MinIO Object Lifecycle Management + which allows creating rules for time or date based + automatic transition or expiry of objects. For object + transition, MinIO automatically moves the object to a + configured remote storage tier. +
+
+ {hasSetTier ? ( +
+ To get started,{" "} + + Create Tier + + . +
+ ) : ( + "" + )} +
+ } + /> )}
)} @@ -546,4 +504,4 @@ const ListTiersConfiguration = ({ classes }: IListTiersConfig) => { ); }; -export default withStyles(styles)(ListTiersConfiguration); +export default ListTiersConfiguration; diff --git a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/RegionSelectWrapper.tsx b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/RegionSelectWrapper.tsx index 55d719975..8f643e6fb 100644 --- a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/RegionSelectWrapper.tsx +++ b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/RegionSelectWrapper.tsx @@ -13,8 +13,9 @@ // // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . + import React from "react"; -import { Grid, IconButton, InputLabel, Tooltip } from "@mui/material"; +import { Grid, IconButton, InputLabel, Tooltip } from "mds"; import { InputProps as StandardInputProps } from "@mui/material/Input"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; @@ -127,19 +128,14 @@ const RegionSelectWrapper = ({ )} > {label !== "" && ( - + {label} {required ? "*" : ""} {tooltip !== "" && (
- +
@@ -171,9 +167,6 @@ const RegionSelectWrapper = ({ } id={overlayId} size={"small"} - disableFocusRipple={false} - disableRipple={false} - disableTouchRipple={false} > {overlayIcon} diff --git a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/TierTypeCard.tsx b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/TierTypeCard.tsx index 33a4be243..a50193dbe 100644 --- a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/TierTypeCard.tsx +++ b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/TierTypeCard.tsx @@ -15,9 +15,39 @@ // along with this program. If not, see . import React from "react"; -import { Box, Grid } from "@mui/material"; +import styled from "styled-components"; +import get from "lodash/get"; -import { Button } from "mds"; +const TierButtonBase = styled.button(({ theme }) => ({ + background: get(theme, "boxBackground", "#FFF"), + border: `${get(theme, "borderColor", "#E2E2E2")} 1px solid`, + borderRadius: 5, + height: 80, + display: "flex", + alignItems: "center", + justifyContent: "start", + marginBottom: 16, + marginRight: 8, + cursor: "pointer", + overflow: "hidden", + "&:hover": { + backgroundColor: get(theme, "buttons.regular.hover.background", "#ebebeb"), + }, + "& .imageContainer": { + width: 80, + "& .min-icon": { + maxWidth: 46, + maxHeight: 46, + }, + }, + "& .tierNotifTitle": { + color: get(theme, "buttons.callAction.enabled.background", "#07193E"), + fontSize: 16, + fontFamily: "Inter,sans-serif", + paddingLeft: 18, + fontWeight: "bold", + }, +})); type TierTypeCardProps = { onClick: (name: string) => void; @@ -25,54 +55,15 @@ type TierTypeCardProps = { name: string; }; const TierTypeCard = ({ onClick, icon, name }: TierTypeCardProps) => { - const styles = { - tierTypeCard: { - height: "80px", - width: "auto", - display: "flex", - alignItems: "center", - justifyContent: "flex-start", - padding: 5, - border: "1px solid #E5E5E5", - borderRadius: 2, - cursor: "pointer", - overflow: "hidden", - "&:hover": { background: "#ebebeb" }, - }, - tierTypeTitle: { - fontWeight: 600, - fontSize: 14, - justifyContent: "center", - }, - }; return ( - + {icon} + {name} + ); }; diff --git a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/UpdateTierCredentialsModal.tsx b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/UpdateTierCredentialsModal.tsx index 2a30189dd..723c6106e 100644 --- a/portal-ui/src/screens/Console/Configurations/TiersConfiguration/UpdateTierCredentialsModal.tsx +++ b/portal-ui/src/screens/Console/Configurations/TiersConfiguration/UpdateTierCredentialsModal.tsx @@ -16,47 +16,25 @@ import React, { Fragment, useEffect, useState } from "react"; import get from "lodash/get"; -import { Button, LockIcon } from "mds"; -import { Theme } from "@mui/material/styles"; -import createStyles from "@mui/styles/createStyles"; -import withStyles from "@mui/styles/withStyles"; -import { LinearProgress } from "@mui/material"; -import Grid from "@mui/material/Grid"; -import { - formFieldStyles, - modalBasic, -} from "../../Common/FormComponents/common/styleLibrary"; - -import InputBoxWrapper from "../../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; -import FileSelector from "../../Common/FormComponents/FileSelector/FileSelector"; -import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper"; -import { setModalErrorSnackMessage } from "../../../../systemSlice"; -import { useAppDispatch } from "../../../../store"; +import { Button, FormLayout, Grid, InputBox, LockIcon, ProgressBar } from "mds"; import { Tier } from "api/consoleApi"; import { api } from "api"; import { errorToHandler } from "api/errors"; +import { modalStyleUtils } from "../../Common/FormComponents/common/styleLibrary"; +import { setModalErrorSnackMessage } from "../../../../systemSlice"; +import { useAppDispatch } from "../../../../store"; +import FileSelector from "../../Common/FormComponents/FileSelector/FileSelector"; +import ModalWrapper from "../../Common/ModalWrapper/ModalWrapper"; interface ITierCredentialsModal { open: boolean; closeModalAndRefresh: (refresh: boolean) => any; - classes: any; tierData: Tier; } -const styles = (theme: Theme) => - createStyles({ - buttonContainer: { - display: "flex", - justifyContent: "flex-end", - }, - ...modalBasic, - ...formFieldStyles, - }); - const UpdateTierCredentialsModal = ({ open, closeModalAndRefresh, - classes, tierData, }: ITierCredentialsModal) => { const dispatch = useAppDispatch(); @@ -142,98 +120,88 @@ const UpdateTierCredentialsModal = ({ addRecord(); }} > - - - {(type === "s3" || type === "minio") && ( - -
- ) => { - setAccountName(e.target.value); - }} - /> -
-
- ) => { - setAccountKey(e.target.value); - }} - /> -
-
- )} - {type === "gcs" && ( - - { - setEncodedCreds(encodedValue); - setCreds(fileName); - }} - value={creds} - /> - - )} - {type === "azure" && ( - -
- ) => { - setAccountName(e.target.value); - }} - /> -
-
- ) => { - setAccountKey(e.target.value); - }} - /> -
-
- )} -
- -