Skip to content

Commit 0285702

Browse files
authored
Migrated Access Keys page components to mds (#2834)
Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent bda1cd1 commit 0285702

File tree

9 files changed

+231
-449
lines changed

9 files changed

+231
-449
lines changed

portal-ui/src/screens/Console/Account/Account.tsx

Lines changed: 19 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,21 @@ import React, { Fragment, useEffect, useState } from "react";
1818
import {
1919
AccountIcon,
2020
AddIcon,
21+
Box,
2122
Button,
23+
DataTable,
2224
DeleteIcon,
25+
Grid,
2326
HelpBox,
2427
PageLayout,
2528
PasswordKeyIcon,
2629
} from "mds";
2730
import { useSelector } from "react-redux";
2831
import { useNavigate } from "react-router-dom";
29-
import { Theme } from "@mui/material/styles";
30-
import createStyles from "@mui/styles/createStyles";
31-
import Grid from "@mui/material/Grid";
3232
import api from "../../../common/api";
33-
import { Box } from "@mui/material";
34-
import TableWrapper from "../Common/TableWrapper/TableWrapper";
3533
import { stringSort } from "../../../utils/sortFunctions";
3634
import {
3735
actionsTray,
38-
searchField,
3936
tableStyles,
4037
} from "../Common/FormComponents/common/styleLibrary";
4138

@@ -54,7 +51,6 @@ import { selectSAs } from "../Configurations/utils";
5451
import DeleteMultipleServiceAccounts from "../Users/DeleteMultipleServiceAccounts";
5552
import ServiceAccountPolicy from "./ServiceAccountPolicy";
5653
import { setErrorSnackMessage, setSnackBarMessage } from "../../../systemSlice";
57-
import makeStyles from "@mui/styles/makeStyles";
5854
import { selFeatures } from "../consoleSlice";
5955
import { useAppDispatch } from "../../../store";
6056
import TooltipWrapper from "../Common/TooltipWrapper/TooltipWrapper";
@@ -64,24 +60,10 @@ const DeleteServiceAccount = withSuspense(
6460
React.lazy(() => import("./DeleteServiceAccount"))
6561
);
6662

67-
const useStyles = makeStyles((theme: Theme) =>
68-
createStyles({
69-
...actionsTray,
70-
...searchField,
71-
searchField: {
72-
...searchField.searchField,
73-
marginRight: "auto",
74-
maxWidth: 380,
75-
},
76-
...tableStyles,
77-
})
78-
);
79-
8063
const Account = () => {
8164
const dispatch = useAppDispatch();
8265
const navigate = useNavigate();
8366

84-
const classes = useStyles();
8567
const features = useSelector(selFeatures);
8668

8769
const [records, setRecords] = useState<string[]>([]);
@@ -199,27 +181,29 @@ const Account = () => {
199181
closeModalAndRefresh={closePolicyModal}
200182
/>
201183
)}
202-
<ChangePasswordModal
203-
open={changePasswordModalOpen}
204-
closeModal={() => setChangePasswordModalOpen(false)}
205-
/>
184+
{changePasswordModalOpen && (
185+
<ChangePasswordModal
186+
open={changePasswordModalOpen}
187+
closeModal={() => setChangePasswordModalOpen(false)}
188+
/>
189+
)}
206190
<PageHeaderWrapper label="Access Keys" />
207191
<PageLayout>
208-
<Grid container spacing={1}>
209-
<Grid item={true} xs={12} className={classes.actionsTray}>
192+
<Grid container>
193+
<Grid item xs={12} sx={{ ...actionsTray.actionsTray }}>
210194
<SearchBox
211195
placeholder={"Search Access Keys"}
212196
onChange={setFilter}
213-
overrideClass={classes.searchField}
197+
sx={{ marginRight: "auto", maxWidth: 380 }}
214198
value={filter}
215199
/>
216-
217200
<Box
218201
sx={{
219202
display: "flex",
203+
flexWrap: "nowrap",
204+
gap: 5,
220205
}}
221206
>
222-
{" "}
223207
<TooltipWrapper tooltip={"Delete Selected"}>
224208
<Button
225209
id={"delete-selected-accounts"}
@@ -266,20 +250,19 @@ const Account = () => {
266250
</Box>
267251
</Grid>
268252

269-
<Grid item xs={12} className={classes.tableBlock}>
270-
<TableWrapper
253+
<Grid item xs={12} sx={{ ...tableStyles.tableBlock }}>
254+
<DataTable
271255
isLoading={loading}
272256
records={filteredRecords}
273257
entityName={"Access Keys"}
274-
idField={""}
275-
columns={[{ label: "Access Key", elementKey: "" }]}
258+
columns={[{ label: "Access Key" }]}
276259
itemActions={tableActions}
277260
selectedItems={selectedSAs}
278261
onSelect={(e) => selectSAs(e, setSelectedSAs, selectedSAs)}
279262
onSelectAll={selectAllItems}
280263
/>
281264
</Grid>
282-
<Grid item xs={12} marginTop={"15px"}>
265+
<Grid item xs={12} sx={{ marginTop: 15 }}>
283266
<HelpBox
284267
title={"Learn more about ACCESS KEYS"}
285268
iconComponent={<AccountIcon />}
@@ -295,11 +278,8 @@ const Account = () => {
295278
<br />
296279
<br />
297280
You can learn more at our{" "}
298-
{
299-
// TODO: Change this link once it is called access keys
300-
}
301281
<a
302-
href="https://min.io/docs/minio/linux/administration/identity-access-management/minio-user-management.html?ref=con#service-accounts"
282+
href="https://min.io/docs/minio/linux/administration/identity-access-management/minio-user-management.html?ref=con#id3"
303283
target="_blank"
304284
rel="noopener"
305285
>

0 commit comments

Comments
 (0)