Skip to content

Commit 6d5d11d

Browse files
authored
Updated common bars (#3118)
- Updated common Loading Bars - Updated Restart MinIO notification bar Signed-off-by: Benjamin Perez <benjamin@bexsoft.net>
1 parent 9e3b93d commit 6d5d11d

File tree

2 files changed

+52
-109
lines changed

2 files changed

+52
-109
lines changed

portal-ui/src/screens/Console/Common/FormComponents/common/styleLibrary.ts

Lines changed: 0 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -263,58 +263,6 @@ export const tooltipCommon = {
263263
},
264264
};
265265

266-
export const snackBarCommon = {
267-
snackBar: {
268-
backgroundColor: "#081F44",
269-
fontWeight: 400,
270-
fontFamily: "Inter, sans-serif",
271-
fontSize: 14,
272-
boxShadow: "none" as const,
273-
"&.MuiPaper-root.MuiSnackbarContent-root": {
274-
borderRadius: "0px 0px 5px 5px",
275-
},
276-
"& div": {
277-
textAlign: "center" as const,
278-
padding: "6px 30px",
279-
width: "100%",
280-
overflowX: "hidden",
281-
textOverflow: "ellipsis",
282-
},
283-
"&.MuiPaper-root": {
284-
padding: "0px 20px 0px 20px",
285-
},
286-
},
287-
errorSnackBar: {
288-
backgroundColor: "#C72C48",
289-
color: "#fff",
290-
},
291-
snackBarExternal: {
292-
top: -1,
293-
height: 33,
294-
position: "fixed" as const,
295-
minWidth: 348,
296-
whiteSpace: "nowrap" as const,
297-
left: 0,
298-
width: "100%",
299-
justifyContent: "center" as const,
300-
},
301-
snackDiv: {
302-
top: "17px",
303-
left: "50%",
304-
position: "absolute" as const,
305-
},
306-
snackBarModal: {
307-
top: 0,
308-
position: "absolute" as const,
309-
minWidth: "348px",
310-
whiteSpace: "nowrap" as const,
311-
height: "33px",
312-
width: "100%",
313-
justifyContent: "center",
314-
left: 0,
315-
},
316-
};
317-
318266
export const formFieldStyles: any = {
319267
formFieldRow: {
320268
marginBottom: ".8rem",

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

Lines changed: 52 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,13 @@ import React, {
2121
useLayoutEffect,
2222
useState,
2323
} from "react";
24-
import { Theme } from "@mui/material/styles";
25-
import { Button, MainContainer, Snackbar } from "mds";
24+
import { Box, Button, MainContainer, ProgressBar, Snackbar } from "mds";
2625
import debounce from "lodash/debounce";
27-
import createStyles from "@mui/styles/createStyles";
28-
import withStyles from "@mui/styles/withStyles";
2926
import { Navigate, Route, Routes, useLocation } from "react-router-dom";
3027
import { useSelector } from "react-redux";
3128
import { selFeatures, selSession } from "./consoleSlice";
3229
import { api } from "api";
3330
import { AppState, useAppDispatch } from "../../store";
34-
import { snackBarCommon } from "./Common/FormComponents/common/styleLibrary";
3531
import MainError from "./Common/MainError/MainError";
3632
import {
3733
CONSOLE_UI_RESOURCE,
@@ -50,7 +46,6 @@ import {
5046
setSnackBarMessage,
5147
} from "../../systemSlice";
5248
import MenuWrapper from "./Menu/MenuWrapper";
53-
import { LinearProgress } from "@mui/material";
5449
import LoadingComponent from "../../common/LoadingComponent";
5550
import ComponentsScreen from "./Common/ComponentsScreen";
5651

@@ -146,33 +141,7 @@ const AddReplicationSites = React.lazy(
146141

147142
const KMSRoutes = React.lazy(() => import("./KMS/KMSRoutes"));
148143

149-
const styles = (theme: Theme) =>
150-
createStyles({
151-
warningBar: {
152-
background: theme.palette.primary.main,
153-
color: "white",
154-
heigh: "60px",
155-
widht: "100%",
156-
lineHeight: "60px",
157-
display: "flex",
158-
justifyContent: "center",
159-
alignItems: "center",
160-
"& button": {
161-
marginLeft: 8,
162-
},
163-
},
164-
progress: {
165-
height: "3px",
166-
backgroundColor: "#eaeaea",
167-
},
168-
...snackBarCommon,
169-
});
170-
171-
interface IConsoleProps {
172-
classes: any;
173-
}
174-
175-
const Console = ({ classes }: IConsoleProps) => {
144+
const Console = () => {
176145
const dispatch = useAppDispatch();
177146
const { pathname = "" } = useLocation();
178147
const open = useSelector((state: AppState) => state.system.sidebarOpen);
@@ -489,33 +458,59 @@ const Console = ({ classes }: IConsoleProps) => {
489458
>
490459
<Fragment>
491460
{needsRestart && (
492-
<div className={classes.warningBar}>
493-
{isServerLoading ? (
494-
<Fragment>
495-
The server is restarting.
496-
<LinearProgress className={classes.progress} />
497-
</Fragment>
498-
) : (
499-
<Fragment>
500-
The instance needs to be restarted for configuration changes
501-
to take effect.{" "}
502-
<Button
503-
id={"restart-server"}
504-
variant="secondary"
505-
onClick={() => {
506-
restartServer();
507-
}}
508-
label={"Restart"}
509-
/>
510-
</Fragment>
511-
)}
512-
</div>
461+
<Snackbar
462+
onClose={() => {}}
463+
open={needsRestart}
464+
variant={"warning"}
465+
message={
466+
<Box
467+
sx={{
468+
display: "flex",
469+
gap: 8,
470+
justifyContent: "center",
471+
alignItems: "center",
472+
width: "100%",
473+
}}
474+
>
475+
{isServerLoading ? (
476+
<Fragment>
477+
<ProgressBar
478+
barHeight={3}
479+
transparentBG
480+
sx={{
481+
width: "100%",
482+
position: "absolute",
483+
top: 0,
484+
left: 0,
485+
}}
486+
/>
487+
<span>The server is restarting.</span>
488+
</Fragment>
489+
) : (
490+
<Fragment>
491+
The instance needs to be restarted for configuration
492+
changes to take effect.{" "}
493+
<Button
494+
id={"restart-server"}
495+
variant="secondary"
496+
onClick={() => {
497+
restartServer();
498+
}}
499+
label={"Restart"}
500+
/>
501+
</Fragment>
502+
)}
503+
</Box>
504+
}
505+
autoHideDuration={0}
506+
/>
513507
)}
514508
{loadingProgress < 100 && (
515-
<LinearProgress
516-
className={classes.progress}
509+
<ProgressBar
510+
barHeight={3}
517511
variant="determinate"
518512
value={loadingProgress}
513+
sx={{ width: "100%", position: "absolute", top: 0, left: 0 }}
519514
/>
520515
)}
521516
<MainError />
@@ -580,4 +575,4 @@ const Console = ({ classes }: IConsoleProps) => {
580575
);
581576
};
582577

583-
export default withStyles(styles)(Console);
578+
export default Console;

0 commit comments

Comments
 (0)