Skip to content
This repository was archived by the owner on Apr 5, 2024. It is now read-only.

Commit 928e585

Browse files
committed
table for BE infos + fixed Bootstrap CSS
1 parent 4d6ddeb commit 928e585

File tree

4 files changed

+42
-31
lines changed

4 files changed

+42
-31
lines changed

webapp_frontend/public/index.html

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,10 +25,7 @@
2525
Learn how to configure a non-root public URL by running `npm run build`.
2626
-->
2727
<title>React App</title>
28-
<link rel="stylesheet"
29-
href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css"
30-
integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u"
31-
crossorigin="anonymous">
28+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" integrity="sha384-JcKb8q3iqJ61gNV9KGb8thSsNjpSL0n8PARn9HuZOnIxN0hoP+VmmDGMN5t9UJ0Z" crossorigin="anonymous">
3229
</head>
3330
<body>
3431
<noscript>You need to enable JavaScript to run this app.</noscript>

webapp_frontend/src/api.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import Axios from "axios";
33
const uri = "http://localhost:8080";
44

55
interface BackendHealthData {
6-
uptimeInSeconds: number
6+
uptimeInSeconds: number;
7+
userCount: number
78
}
89

910
function callBackendHealth():Promise<BackendHealthData>{
8.02 KB
Loading

webapp_frontend/src/components/App.tsx

Lines changed: 39 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
import React, {ReactElement, useEffect, useState} from 'react';
2-
import logo from '../logo.svg';
2+
import logo from '../assets/images/logos/logo.png';
33
import './App.css';
44
import {callBackendHealth} from "../api";
5-
import {Button} from 'react-bootstrap';
5+
import {Button, Table, Container} from 'react-bootstrap';
66

77
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");
910

1011
useEffect(() => {
1112
updateVariables()
@@ -14,34 +15,46 @@ function App():ReactElement {
1415
function updateVariables(): void {
1516
Promise.all([callBackendHealth()])
1617
.then(([backendHealthData]) => {
17-
setBackendLiveTime(backendHealthData.uptimeInSeconds)
18+
setBackendLiveTime(backendHealthData.uptimeInSeconds);
19+
setBackendUserCount(backendHealthData.userCount)
1820
})
1921
}
2022

2123
return (
2224
<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>
4558
</div>
4659
);
4760
}

0 commit comments

Comments
 (0)