Skip to content

Commit 30fd3bd

Browse files
committed
492: Add Loading to Admin page
1 parent b888b14 commit 30fd3bd

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/client/src/pages/Admin/Admin.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
import React from 'react';
22
import {
3+
Box,
34
Grid,
45
Paper,
5-
Backdrop,
6-
CircularProgress,
76
Container,
87
Typography,
98
} from "@material-ui/core";
109

1110
import _ from 'lodash';
1211
import {Alert} from "@material-ui/lab";
13-
import Box from "@material-ui/core/Box";
1412
import {makeStyles} from "@material-ui/styles";
1513
import UploadBox from './Components/UploadBox';
1614
import AnalysisBox from './Components/AnalysisBox';
15+
import Loading from './Components/Loading';
1716

1817
const useStyles = makeStyles({});
1918

@@ -23,6 +22,7 @@ export default function Admin(props) {
2322
const [filesInput, setFilesInput] = React.useState(undefined);
2423
const [lastExecution, setLastExecution] = React.useState(undefined);
2524
const [lastUploads, setLastUploads] = React.useState(undefined);
25+
const [loadingText, setLoadingText] = React.useState("");
2626

2727
React.useEffect(() => {
2828
(async () => {
@@ -53,6 +53,7 @@ export default function Admin(props) {
5353
const lastUploadsResponse = await lastUploads.json();
5454
setLastUploads(lastUploadsResponse);
5555

56+
setLoadingText("");
5657
setIsLoading(false);
5758
};
5859

@@ -84,7 +85,7 @@ export default function Admin(props) {
8485

8586
const handleExecute = async (event) => {
8687
event.preventDefault();
87-
88+
setLoadingText("This may take a few minutes")
8889
setIsLoading(true);
8990

9091
await fetch('/api/execute',
@@ -114,9 +115,7 @@ export default function Admin(props) {
114115
<Typography variant={"h2"}>Admin Portal</Typography>
115116
</Box>
116117
{isLoading === true
117-
? <Backdrop open={true}>
118-
<CircularProgress size={60}/>
119-
</Backdrop>
118+
? <Loading text={loadingText} />
120119
: <Paper elevation={1} style={{"padding": "2em"}}>
121120
{statistics === 'Running' && <Alert severity="info">Execution is in Progress...</Alert>}
122121
<Grid container spacing={5} direction="row" style={{ padding: 16 }}>

0 commit comments

Comments
 (0)