1
1
import React from 'react' ;
2
2
import {
3
+ Box ,
3
4
Grid ,
4
5
Paper ,
5
- Backdrop ,
6
- CircularProgress ,
7
6
Container ,
8
7
Typography ,
9
8
} from "@material-ui/core" ;
10
9
11
10
import _ from 'lodash' ;
12
11
import { Alert } from "@material-ui/lab" ;
13
- import Box from "@material-ui/core/Box" ;
14
12
import { makeStyles } from "@material-ui/styles" ;
15
13
import UploadBox from './Components/UploadBox' ;
16
14
import AnalysisBox from './Components/AnalysisBox' ;
15
+ import Loading from './Components/Loading' ;
17
16
18
17
const useStyles = makeStyles ( { } ) ;
19
18
@@ -23,6 +22,7 @@ export default function Admin(props) {
23
22
const [ filesInput , setFilesInput ] = React . useState ( undefined ) ;
24
23
const [ lastExecution , setLastExecution ] = React . useState ( undefined ) ;
25
24
const [ lastUploads , setLastUploads ] = React . useState ( undefined ) ;
25
+ const [ loadingText , setLoadingText ] = React . useState ( "" ) ;
26
26
27
27
React . useEffect ( ( ) => {
28
28
( async ( ) => {
@@ -53,6 +53,7 @@ export default function Admin(props) {
53
53
const lastUploadsResponse = await lastUploads . json ( ) ;
54
54
setLastUploads ( lastUploadsResponse ) ;
55
55
56
+ setLoadingText ( "" ) ;
56
57
setIsLoading ( false ) ;
57
58
} ;
58
59
@@ -84,7 +85,7 @@ export default function Admin(props) {
84
85
85
86
const handleExecute = async ( event ) => {
86
87
event . preventDefault ( ) ;
87
-
88
+ setLoadingText ( "This may take a few minutes" )
88
89
setIsLoading ( true ) ;
89
90
90
91
await fetch ( '/api/execute' ,
@@ -114,9 +115,7 @@ export default function Admin(props) {
114
115
< Typography variant = { "h2" } > Admin Portal</ Typography >
115
116
</ Box >
116
117
{ isLoading === true
117
- ? < Backdrop open = { true } >
118
- < CircularProgress size = { 60 } />
119
- </ Backdrop >
118
+ ? < Loading text = { loadingText } />
120
119
: < Paper elevation = { 1 } style = { { "padding" : "2em" } } >
121
120
{ statistics === 'Running' && < Alert severity = "info" > Execution is in Progress...</ Alert > }
122
121
< Grid container spacing = { 5 } direction = "row" style = { { padding : 16 } } >
0 commit comments