1
1
import React , { ReactElement , useEffect , useState } from 'react' ;
2
- import logo from '../logo.svg ' ;
2
+ import logo from '../assets/images/logos/ logo.png ' ;
3
3
import './App.css' ;
4
4
import { callBackendHealth } from "../api" ;
5
- import { Button } from 'react-bootstrap' ;
5
+ import { Button , Table , Container } from 'react-bootstrap' ;
6
6
7
7
function App ( ) :ReactElement {
8
- const [ backendLiveTime , setBackendLiveTime ] = useState < number | string > ( "Init" ) ;
8
+ const [ backendLiveTime , setBackendLiveTime ] = useState < number | string > ( "not reachable" ) ;
9
+ const [ backendUserCount , setBackendUserCount ] = useState < number | string > ( "not reachable" ) ;
9
10
10
11
useEffect ( ( ) => {
11
12
updateVariables ( )
@@ -14,34 +15,46 @@ function App():ReactElement {
14
15
function updateVariables ( ) : void {
15
16
Promise . all ( [ callBackendHealth ( ) ] )
16
17
. then ( ( [ backendHealthData ] ) => {
17
- setBackendLiveTime ( backendHealthData . uptimeInSeconds )
18
+ setBackendLiveTime ( backendHealthData . uptimeInSeconds ) ;
19
+ setBackendUserCount ( backendHealthData . userCount )
18
20
} )
19
21
}
20
22
21
23
return (
22
24
< div className = "App" >
23
- < header className = "App-header" >
24
- < p >
25
- Hello World
26
- </ p >
27
-
28
-
29
- < img src = { logo } className = "App-logo" alt = "logo" />
30
- < p >
31
- Edit < code > src/App.tsx</ code > and save to reload.
32
- </ p >
33
- < a
34
- className = "App-link"
35
- href = "https://reactjs.org"
36
- target = "_blank"
37
- rel = "noopener noreferrer"
38
- >
39
- Learn React
40
- </ a >
41
- < button style = { { marginTop : "20px" } } onClick = { ( ) => updateVariables ( ) } > Test</ button >
42
- < Button > Dieser Bootstrap-Button funktioniert</ Button >
43
- < p > { backendLiveTime } </ p >
44
- </ header >
25
+ < header className = "" > </ header >
26
+ < Container >
27
+ < h1 >
28
+ FileFighter
29
+ </ h1 >
30
+
31
+
32
+ < img src = { logo } alt = "logo" />
33
+
34
+
35
+
36
+ < div >
37
+ < Button className = { "mt-3 mb-2 float-right" } onClick = { ( ) => updateVariables ( ) } > Refresh</ Button >
38
+ < Table striped bordered hover variant = "dark" >
39
+ < thead >
40
+ < tr >
41
+ < th > Backend information</ th >
42
+
43
+ </ tr >
44
+ </ thead >
45
+ < tbody >
46
+ < tr >
47
+ < td > Uptime</ td >
48
+ < td > { backendLiveTime } </ td >
49
+ </ tr >
50
+ < tr >
51
+ < td > Usercount</ td >
52
+ < td > { backendUserCount } </ td >
53
+ </ tr >
54
+ </ tbody >
55
+ </ Table >
56
+ </ div >
57
+ </ Container >
45
58
</ div >
46
59
) ;
47
60
}
0 commit comments