diff --git a/portal-ui/src/screens/Console/Console.tsx b/portal-ui/src/screens/Console/Console.tsx index 01935b087..468be2530 100644 --- a/portal-ui/src/screens/Console/Console.tsx +++ b/portal-ui/src/screens/Console/Console.tsx @@ -108,7 +108,9 @@ const Dashboard = React.lazy(() => import("./Dashboard/Dashboard")); const Account = React.lazy(() => import("./Account/Account")); -const AccountCreate = React.lazy(() => import("./Account/AddServiceAccountScreen")); +const AccountCreate = React.lazy( + () => import("./Account/AddServiceAccountScreen") +); const Users = React.lazy(() => import("./Users/Users")); const Groups = React.lazy(() => import("./Groups/Groups")); @@ -122,9 +124,7 @@ const ConfigurationOptions = React.lazy( const AddPool = React.lazy( () => import("./Tenants/TenantDetails/Pools/AddPool/AddPool") ); -const AddGroupScreen = React.lazy( - () => import("./Groups/AddGroupScreen") -); +const AddGroupScreen = React.lazy(() => import("./Groups/AddGroupScreen")); const SiteReplication = React.lazy( () => import("./Configurations/SiteReplication/SiteReplication") ); @@ -411,7 +411,8 @@ const Console = ({ { component: Account, path: IAM_PAGES.ACCOUNT, - // user has implicit access to service-accounts + forceDisplay: true, + // user has implicit access to service-accounts }, { component: AccountCreate, diff --git a/portal-ui/src/screens/Console/Groups/AddGroupScreen.tsx b/portal-ui/src/screens/Console/Groups/AddGroupScreen.tsx index f119dc3be..329ab9687 100644 --- a/portal-ui/src/screens/Console/Groups/AddGroupScreen.tsx +++ b/portal-ui/src/screens/Console/Groups/AddGroupScreen.tsx @@ -14,7 +14,7 @@ // You should have received a copy of the GNU Affero General Public License // along with this program. If not, see . -import React, { Fragment, useState, useEffect } from "react"; +import React, { Fragment, useEffect, useState } from "react"; import { Theme } from "@mui/material/styles"; import createStyles from "@mui/styles/createStyles"; import withStyles from "@mui/styles/withStyles"; @@ -23,7 +23,7 @@ import { modalStyleUtils, } from "../Common/FormComponents/common/styleLibrary"; import Grid from "@mui/material/Grid"; -import { Button, Box, LinearProgress } from "@mui/material"; +import { Box, Button, LinearProgress } from "@mui/material"; import PageHeader from "../Common/PageHeader/PageHeader"; import PageLayout from "../Common/Layout/PageLayout"; import history from "../../../../src/history"; @@ -37,6 +37,7 @@ import { IAM_PAGES } from "../../../common/SecureComponent/permissions"; import { ErrorResponseHandler } from "../../../../src/common/types"; import api from "../../../../src/common/api"; import { setErrorSnackMessage } from "../../../../src/actions"; +import SectionTitle from "../Common/SectionTitle"; interface IAddGroupProps { classes: any; @@ -100,16 +101,12 @@ const styles = (theme: Theme) => ...modalStyleUtils, }); -const AddGroupScreen = ({ - classes, - setErrorSnackMessage, -}: IAddGroupProps) => { +const AddGroupScreen = ({ classes, setErrorSnackMessage }: IAddGroupProps) => { const [groupName, setGroupName] = useState(""); const [saving, isSaving] = useState(false); const [selectedUsers, setSelectedUsers] = useState([]); const [validGroup, setValidGroup] = useState(false); - useEffect(() => { setValidGroup(groupName.trim() !== ""); }, [groupName, selectedUsers]); @@ -117,31 +114,24 @@ const AddGroupScreen = ({ useEffect(() => { if (saving) { const saveRecord = () => { - - api - .invoke("POST", "/api/v1/groups", { - group: groupName, - members: selectedUsers, - }) - .then((res) => { - isSaving(false); - history.push(`${IAM_PAGES.GROUPS}`); - }) - .catch((err: ErrorResponseHandler) => { - isSaving(false); - setErrorSnackMessage(err); - }); - } - + api + .invoke("POST", "/api/v1/groups", { + group: groupName, + members: selectedUsers, + }) + .then((res) => { + isSaving(false); + history.push(`${IAM_PAGES.GROUPS}`); + }) + .catch((err: ErrorResponseHandler) => { + isSaving(false); + setErrorSnackMessage(err); + }); + }; + saveRecord(); } - - }, [ - saving, - groupName, - selectedUsers, - setErrorSnackMessage, - ]); + }, [saving, groupName, selectedUsers, setErrorSnackMessage]); //Fetch Actions const setSaving = (event: React.FormEvent) => { @@ -150,13 +140,11 @@ const AddGroupScreen = ({ isSaving(true); }; - const resetForm = () => { - setGroupName(""); - setSelectedUsers([]); + const resetForm = () => { + setGroupName(""); + setSelectedUsers([]); }; - - return ( @@ -164,85 +152,81 @@ const AddGroupScreen = ({ label={} /> - - - - - - Create Group - - + +
+ + + }> + Create Group + + + + + + + ) => { + setGroupName(e.target.value); + }} + /> + + + + + + + - - - - - - - - - - ) => { - setGroupName(e.target.value); - }} - /> - - - - - - - - - - - - {saving && ( - - - - )} - - - - - - - - - - + + + + {saving && ( + + + + )} +
+ +
+ +
diff --git a/portal-ui/src/screens/Console/Users/AddUserScreen.tsx b/portal-ui/src/screens/Console/Users/AddUserScreen.tsx index 956d317c8..d2085d490 100644 --- a/portal-ui/src/screens/Console/Users/AddUserScreen.tsx +++ b/portal-ui/src/screens/Console/Users/AddUserScreen.tsx @@ -23,7 +23,7 @@ import { modalStyleUtils, } from "../Common/FormComponents/common/styleLibrary"; import Grid from "@mui/material/Grid"; -import { Button, LinearProgress, Box } from "@mui/material"; +import { Box, Button, LinearProgress } from "@mui/material"; import { CreateUserIcon } from "../../../icons"; import PageHeader from "../Common/PageHeader/PageHeader"; @@ -31,7 +31,6 @@ import PageLayout from "../Common/Layout/PageLayout"; import history from "../../../../src/history"; import InputBoxWrapper from "../Common/FormComponents/InputBoxWrapper/InputBoxWrapper"; -import AddUserHelpBox from "./AddUserHelpBox"; import PolicySelectors from "../Policies/PolicySelectors"; import BackLink from "../../../common/BackLink"; import GroupsSelectors from "./GroupsSelectors"; @@ -45,6 +44,8 @@ import { ErrorResponseHandler } from "../../../../src/common/types"; import api from "../../../../src/common/api"; import { setErrorSnackMessage } from "../../../../src/actions"; +import SectionTitle from "../Common/SectionTitle"; +import AddUserHelpBox from "../Account/AddServiceAccountHelpBox"; interface IAddUserProps { classes: any; @@ -102,10 +103,7 @@ const styles = (theme: Theme) => ...modalStyleUtils, }); -const AddUser = ({ - classes, - setErrorSnackMessage, -}: IAddUserProps) => { +const AddUser = ({ classes, setErrorSnackMessage }: IAddUserProps) => { const [addLoading, setAddLoading] = useState(false); const [accessKey, setAccessKey] = useState(""); const [secretKey, setSecretKey] = useState(""); @@ -161,134 +159,120 @@ const AddUser = ({ } /> - - - - - - Create User - - - - - - -
) => { - saveRecord(e); - }} - > - - -
- - ) => { - setAccessKey(e.target.value); - }} - /> -
-
- - ) => { - setSecretKey(e.target.value); - }} - autoComplete="current-password" - overlayIcon={ - showPassword ? ( - - ) : ( - - ) - } - overlayAction={() => setShowPassword(!showPassword)} - /> -
- - - - - - { - setSelectedGroups(elements); - }} - /> - - - {addLoading && ( - - - - )} -
- - - - - + + ) => { + saveRecord(e); + }} + > + + + }> + Create User + - - -
- - - - - -
+ +
+ ) => { + setAccessKey(e.target.value); + }} + /> +
+
+ ) => { + setSecretKey(e.target.value); + }} + autoComplete="current-password" + overlayIcon={ + showPassword ? ( + + ) : ( + + ) + } + overlayAction={() => setShowPassword(!showPassword)} + /> +
+ + + + + + { + setSelectedGroups(elements); + }} + /> + + + {addLoading && ( + + + + )} +
+ + + + + +
+ + + +