diff --git a/portal-ui/src/icons/NewAccountIcon.tsx b/portal-ui/src/icons/NewAccountIcon.tsx new file mode 100644 index 000000000..a1096e18c --- /dev/null +++ b/portal-ui/src/icons/NewAccountIcon.tsx @@ -0,0 +1,81 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2021 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 from "react"; +import { SvgIcon } from "@mui/material"; +const NewAccountIcon = () => { + return ( + + + + + + + + + + + ); +}; + +export default NewAccountIcon; diff --git a/portal-ui/src/icons/WarnIcon.tsx b/portal-ui/src/icons/WarnIcon.tsx new file mode 100644 index 000000000..5695ca6ec --- /dev/null +++ b/portal-ui/src/icons/WarnIcon.tsx @@ -0,0 +1,35 @@ +// This file is part of MinIO Console Server +// Copyright (c) 2021 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 * as React from "react"; + +const WarnIcon = () => { + return ( + + + + + ); +}; + +export default WarnIcon; diff --git a/portal-ui/src/screens/Console/Account/AddServiceAccount.tsx b/portal-ui/src/screens/Console/Account/AddServiceAccount.tsx index bd5a9360f..293cc2993 100644 --- a/portal-ui/src/screens/Console/Account/AddServiceAccount.tsx +++ b/portal-ui/src/screens/Console/Account/AddServiceAccount.tsx @@ -21,7 +21,10 @@ import { Button, LinearProgress } from "@mui/material"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; -import { modalBasic } from "../Common/FormComponents/common/styleLibrary"; +import { + modalBasic, + serviceAccountStyles, +} from "../Common/FormComponents/common/styleLibrary"; import { NewServiceAccount } from "../Common/CredentialsPrompt/types"; import { setModalErrorSnackMessage } from "../../../actions"; import { ErrorResponseHandler } from "../../../common/types"; @@ -33,26 +36,7 @@ import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWr const styles = (theme: Theme) => createStyles({ - jsonPolicyEditor: { - minHeight: 400, - width: "100%", - }, - buttonContainer: { - textAlign: "right", - }, - infoDetails: { - color: "#393939", - fontSize: 12, - fontStyle: "italic", - marginBottom: "8px", - }, - containerScrollable: { - maxHeight: "calc(100vh - 300px)" as const, - overflowY: "auto" as const, - }, - codeMirrorContainer: { - marginBottom: 20, - }, + ...serviceAccountStyles, ...modalBasic, }); @@ -157,72 +141,82 @@ const AddServiceAccount = ({ - ) => { - setIsRestrictedByPolicy(event.target.checked); - }} - label={"Restrict with policy"} - /> - ) => { - setAddCredentials(event.target.checked); - }} - label={"Customize Credentials"} - /> - - {isRestrictedByPolicy && ( - - { - setPolicyDefinition(value); - }} - /> - - )} - {addCredentials && ( - { - setAccessKey(e.target.value); - }} - /> - { - setSecretKey(e.target.value); + ) => { + setAddCredentials(event.target.checked); }} + label={"Customize Credentials"} /> + {addCredentials && ( + +
+ { + setAccessKey(e.target.value); + }} + /> + { + setSecretKey(e.target.value); + }} + /> +
+
+ )}
- )} + + ) => { + setIsRestrictedByPolicy(event.target.checked); + }} + label={"Restrict with policy"} + /> + {isRestrictedByPolicy && ( + + { + setPolicyDefinition(value); + }} + /> + + )} + + - + - if (consoleCreds) { - if (!Array.isArray(consoleCreds)) { - consoleExtras = { - console: [ - { - access_key: consoleCreds.accessKey, - secret_key: consoleCreds.secretKey, - }, - ], - }; - } else { - const cCreds = consoleCreds.map((itemMap) => { - return { - access_key: itemMap.accessKey, - secret_key: itemMap.secretKey, - }; - }); - - consoleExtras = { - console: [...cCreds], - }; - } - } - - download( - "credentials.json", - JSON.stringify({ - ...consoleExtras, - }) - ); - }} - color="primary" - > - Download - - )} + {!idp && ( - + )} - + ); }; diff --git a/portal-ui/src/screens/Console/Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper.tsx b/portal-ui/src/screens/Console/Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper.tsx index 4129afc00..092139cb5 100644 --- a/portal-ui/src/screens/Console/Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper.tsx +++ b/portal-ui/src/screens/Console/Common/FormComponents/FormSwitchWrapper/FormSwitchWrapper.tsx @@ -253,7 +253,13 @@ const FormSwitchWrapper = ({ - + {switchComponent} diff --git a/portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts b/portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts index 16828eaba..19ff04b02 100644 --- a/portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts +++ b/portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts @@ -1011,3 +1011,51 @@ export const linkStyles = (color: string) => ({ cursor: "pointer", }, }); + +export const serviceAccountStyles: any = { + jsonPolicyEditor: { + minHeight: 400, + width: "100%", + }, + buttonContainer: { + textAlign: "right", + }, + infoDetails: { + color: "#393939", + fontSize: 12, + fontStyle: "italic", + marginBottom: "8px", + }, + containerScrollable: { + maxHeight: "calc(100vh - 200px)" as const, + overflowY: "auto" as const, + }, + codeMirrorContainer: { + marginBottom: 20, + paddingLeft: 15, + "&:nth-child(2) .MuiGrid-root:nth-child(3)": { + border: "1px solid #EAEAEA", + }, + "& label": { + marginBottom: ".5rem", + }, + "& label + div": { + display: "none", + }, + }, + stackedInputs: { + display: "flex", + gap: 15, + paddingBottom: "1rem", + paddingLeft: "1rem", + flexFlow: "column", + }, + buttonSpacer: { + marginRight: "1rem", + }, + switchContainer: { + display: "flex", + alignItems: "center", + justifyContent: "flex-end", + }, +}; diff --git a/portal-ui/src/screens/Console/Common/ModalWrapper/ModalWrapper.tsx b/portal-ui/src/screens/Console/Common/ModalWrapper/ModalWrapper.tsx index 82a6c9fa8..ad5c7d78e 100644 --- a/portal-ui/src/screens/Console/Common/ModalWrapper/ModalWrapper.tsx +++ b/portal-ui/src/screens/Console/Common/ModalWrapper/ModalWrapper.tsx @@ -31,7 +31,7 @@ interface IModalProps { classes: any; onClose: () => void; modalOpen: boolean; - title: string; + title: string | React.ReactNode; children: any; wideLimit?: boolean; modalSnackMessage?: snackBarMessage; @@ -56,8 +56,8 @@ const styles = (theme: Theme) => textAlign: "right", }, closeButton: { - width: 45, - height: 45, + height: 16, + width: 16, padding: 0, backgroundColor: "initial", "&:hover": { @@ -79,30 +79,28 @@ const styles = (theme: Theme) => "&::before": { ...baseCloseLine, transform: "rotate(45deg)", + height: 12, }, "&::after": { ...baseCloseLine, transform: "rotate(-45deg)", + height: 12, }, "&:hover::before, &:hover::after": { borderColor: "#9C9C9C", }, - width: 24, - height: 24, display: "block", position: "relative", + height: 12, + width: 12, }, titleClass: { padding: "0px 50px 12px", - "& h2": { - fontWeight: 600, - color: "#000", - fontSize: 22, - width: "100%", - overflow: "hidden", - whiteSpace: "nowrap", - textOverflow: "ellipsis", - }, + fontSize: "1.2rem", + fontWeight: 600, + overflow: "hidden", + whiteSpace: "nowrap", + textOverflow: "ellipsis", }, modalContent: { padding: "0 50px", diff --git a/portal-ui/src/screens/Console/Users/AddUserServiceAccount.tsx b/portal-ui/src/screens/Console/Users/AddUserServiceAccount.tsx index a339ec78b..ab871bfc3 100644 --- a/portal-ui/src/screens/Console/Users/AddUserServiceAccount.tsx +++ b/portal-ui/src/screens/Console/Users/AddUserServiceAccount.tsx @@ -21,7 +21,10 @@ import { Button, LinearProgress } from "@mui/material"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; -import { modalBasic } from "../Common/FormComponents/common/styleLibrary"; +import { + modalBasic, + serviceAccountStyles, +} from "../Common/FormComponents/common/styleLibrary"; import { NewServiceAccount } from "../Common/CredentialsPrompt/types"; import { setModalErrorSnackMessage } from "../../../actions"; import { ErrorResponseHandler } from "../../../common/types"; @@ -33,23 +36,7 @@ import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWr const styles = (theme: Theme) => createStyles({ - jsonPolicyEditor: { - minHeight: 400, - width: "100%", - }, - buttonContainer: { - textAlign: "right", - }, - infoDetails: { - color: "#393939", - fontSize: 12, - fontStyle: "italic", - marginBottom: "8px", - }, - containerScrollable: { - maxHeight: "calc(100vh - 300px)" as const, - overflowY: "auto" as const, - }, + ...serviceAccountStyles, ...modalBasic, }); @@ -157,72 +144,84 @@ const AddUserServiceAccount = ({ - ) => { - setIsRestrictedByPolicy(event.target.checked); - }} - label={"Restrict with policy"} - /> - ) => { - setAddCredentials(event.target.checked); - }} - label={"Customize Credentials"} - /> + + ) => { + setAddCredentials(event.target.checked); + }} + label={"Customize Credentials"} + /> + + {addCredentials && ( + +
+ { + setAccessKey(e.target.value); + }} + /> + { + setSecretKey(e.target.value); + }} + /> +
+
+ )} +
+ + ) => { + setIsRestrictedByPolicy(event.target.checked); + }} + label={"Restrict with policy"} + /> + + {isRestrictedByPolicy && ( + + { + setPolicyDefinition(value); + }} + /> + + )} +
- {isRestrictedByPolicy && ( - - { - setPolicyDefinition(value); - }} - /> - - )} - {addCredentials && ( - - { - setAccessKey(e.target.value); - }} - /> - { - setSecretKey(e.target.value); - }} - /> - - )} - +