Skip to content

Commit cc0164a

Browse files
authored
Initial Tools Pages Migrations (#2978)
Tools Pages Migrations - Call Home - Inspect - Profile - Health Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent b968cc2 commit cc0164a

File tree

7 files changed

+338
-727
lines changed

7 files changed

+338
-727
lines changed

portal-ui/src/screens/Console/Common/TestWrapper/TestWrapper.tsx

Lines changed: 44 additions & 143 deletions
Original file line numberDiff line numberDiff line change
@@ -15,120 +15,20 @@
1515
// along with this program. If not, see <http://www.gnu.org/licenses/>.
1616

1717
import React, { Fragment, useEffect, useState } from "react";
18-
import { Theme } from "@mui/material/styles";
19-
import createStyles from "@mui/styles/createStyles";
20-
import withStyles from "@mui/styles/withStyles";
21-
import { Grid } from "@mui/material";
22-
import ArrowForwardIosIcon from "@mui/icons-material/ArrowForwardIos";
23-
import { DrivesIcon, Loader, VersionIcon } from "mds";
18+
import { DrivesIcon, Loader, SectionTitle, VersionIcon, Grid } from "mds";
2419
import { api } from "api";
2520
import { ServerProperties } from "api/consoleApi";
2621

2722
interface ITestWrapper {
2823
title: any;
2924
children: any;
30-
classes: any;
31-
advancedVisible: boolean;
32-
advancedContent?: any;
3325
}
3426

35-
const styles = (theme: Theme) =>
36-
createStyles({
37-
titleBar: {
38-
borderBottom: "#E5E5E5 1px solid",
39-
padding: "30px 25px",
40-
fontSize: 20,
41-
color: "#07193E",
42-
fontWeight: "bold",
43-
borderRadius: "10px 10px 0px 0px",
44-
paddingTop: 0,
45-
},
46-
divisorContainer: {
47-
padding: 25,
48-
},
49-
serversData: {
50-
color: "#07193E",
51-
fontSize: 18,
52-
display: "flex",
53-
alignItems: "center",
54-
"& svg": {
55-
marginRight: 10,
56-
},
57-
},
58-
minioVersionContainer: {
59-
fontSize: 12,
60-
color: "#07193E",
61-
justifyContent: "center",
62-
alignSelf: "center",
63-
alignItems: "center",
64-
display: "flex",
65-
},
66-
versionIcon: {
67-
color: "#07193E",
68-
marginRight: 20,
69-
},
70-
loaderAlign: {
71-
textAlign: "center",
72-
},
73-
advancedContainer: {
74-
justifyContent: "flex-end",
75-
display: "flex",
76-
},
77-
optionsContainer: {
78-
padding: 0,
79-
marginBottom: 25,
80-
},
81-
advancedConfiguration: {
82-
color: "#2781B0",
83-
fontSize: 10,
84-
textDecoration: "underline",
85-
border: "none",
86-
backgroundColor: "transparent",
87-
cursor: "pointer",
88-
alignItems: "center",
89-
display: "flex",
90-
91-
"&:hover": {
92-
color: "#07193E",
93-
},
94-
95-
"& svg": {
96-
width: 10,
97-
alignSelf: "center",
98-
marginLeft: 5,
99-
},
100-
},
101-
advancedOpen: {
102-
transform: "rotateZ(-90deg) translateX(-4px) translateY(2px)",
103-
},
104-
advancedClosed: {
105-
transform: "rotateZ(90deg)",
106-
},
107-
advancedContent: {
108-
backgroundColor: "#F5F7F9",
109-
maxHeight: 0,
110-
transitionDuration: "0.3s",
111-
overflow: "hidden",
112-
padding: "0 15px",
113-
"&.open": {
114-
maxHeight: 400,
115-
padding: 15,
116-
},
117-
},
118-
});
119-
120-
const TestWrapper = ({
121-
title,
122-
children,
123-
classes,
124-
advancedVisible,
125-
advancedContent,
126-
}: ITestWrapper) => {
27+
const TestWrapper = ({ title, children }: ITestWrapper) => {
12728
const [version, setVersion] = useState<string>("N/A");
12829
const [totalNodes, setTotalNodes] = useState<number>(0);
12930
const [totalDrives, setTotalDrives] = useState<number>(0);
13031
const [loading, setLoading] = useState<boolean>(true);
131-
const [advancedOpen, setAdvancedOpen] = useState<boolean>(false);
13232

13333
useEffect(() => {
13434
if (loading) {
@@ -165,15 +65,37 @@ const TestWrapper = ({
16565

16666
return (
16767
<Grid item xs={12}>
168-
<Grid item xs={12} className={classes.titleBar}>
169-
{title}
170-
</Grid>
68+
<SectionTitle separator>{title}</SectionTitle>
17169
<Grid item xs={12}>
172-
<Grid item xs={12} className={classes.optionsContainer}>
173-
<Grid container className={classes.divisorContainer}>
70+
<Grid
71+
item
72+
xs={12}
73+
sx={{
74+
padding: 0,
75+
marginBottom: 25,
76+
}}
77+
>
78+
<Grid
79+
container
80+
sx={{
81+
padding: 25,
82+
}}
83+
>
17484
{!loading ? (
17585
<Fragment>
176-
<Grid item xs={12} md={4} className={classes.serversData}>
86+
<Grid
87+
item
88+
xs={12}
89+
md={4}
90+
sx={{
91+
fontSize: 18,
92+
display: "flex",
93+
alignItems: "center",
94+
"& svg": {
95+
marginRight: 10,
96+
},
97+
}}
98+
>
17799
<DrivesIcon /> <strong>{totalNodes}</strong>
178100
&nbsp;nodes,&nbsp;
179101
<strong>{totalDrives}</strong>&nbsp; drives
@@ -182,58 +104,37 @@ const TestWrapper = ({
182104
item
183105
xs={12}
184106
md={4}
185-
className={classes.minioVersionContainer}
107+
sx={{
108+
fontSize: 12,
109+
justifyContent: "center",
110+
alignSelf: "center",
111+
alignItems: "center",
112+
display: "flex",
113+
}}
186114
>
187-
<span className={classes.versionIcon}>
115+
<span
116+
style={{
117+
marginRight: 20,
118+
}}
119+
>
188120
<VersionIcon />
189121
</span>{" "}
190122
MinIO VERSION&nbsp;<strong>{version}</strong>
191123
</Grid>
192-
<Grid item xs={12} md={4} className={classes.advancedContainer}>
193-
{advancedVisible && (
194-
<button
195-
onClick={() => {
196-
setAdvancedOpen(!advancedOpen);
197-
}}
198-
className={classes.advancedConfiguration}
199-
>
200-
Advanced configurations{" "}
201-
<span
202-
className={
203-
advancedOpen
204-
? classes.advancedOpen
205-
: classes.advancedClosed
206-
}
207-
>
208-
<ArrowForwardIosIcon />
209-
</span>
210-
</button>
211-
)}
212-
</Grid>
213124
</Fragment>
214125
) : (
215126
<Fragment>
216-
<Grid item xs={12} className={classes.loaderAlign}>
127+
<Grid item xs={12} sx={{ textAlign: "center" }}>
217128
<Loader style={{ width: 25, height: 25 }} />
218129
</Grid>
219130
</Fragment>
220131
)}
221132
</Grid>
222-
{advancedContent && (
223-
<Grid
224-
xs={12}
225-
className={`${classes.advancedContent} ${
226-
advancedOpen ? "open" : ""
227-
}`}
228-
>
229-
{advancedContent}
230-
</Grid>
231-
)}
232133
</Grid>
233134
{children}
234135
</Grid>
235136
</Grid>
236137
);
237138
};
238139

239-
export default withStyles(styles)(TestWrapper);
140+
export default TestWrapper;

0 commit comments

Comments
 (0)