Skip to content

Commit a5f4d45

Browse files
Adding Mailhog Service for SMTP, Adding Spring Mail, Sending an Email on Application Start, Improving UI
1 parent b25c2b3 commit a5f4d45

File tree

1 file changed

+80
-29
lines changed

1 file changed

+80
-29
lines changed

ui/src/App.js

Lines changed: 80 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,64 @@
1-
import React, { useState, useEffect } from 'react';
2-
import logo from './logo.svg';
3-
import './App.css';
4-
5-
6-
const WebMapping = ({handler,predicate,details:{requestMappingConditions:{methods,patterns}}})=>{
7-
return <div>
8-
<div>{handler}</div>
9-
<div>{predicate}</div>
10-
<div>{methods}</div>
11-
<div>{patterns}</div>
12-
13-
1+
import React, { useState, useEffect } from "react";
2+
import logo from "./logo.svg";
3+
import "./App.css";
144

5+
const WebMapping = ({
6+
handler,
7+
predicate,
8+
details: {
9+
requestMappingConditions: { methods, patterns }
10+
}
11+
}) => {
12+
return (
13+
<div style={{ display: "flex", justifyContent: "center" }}>
14+
{methods.map(method => {
15+
return (
16+
<div
17+
style={{
18+
margin: 10,
19+
padding: 5,
20+
borderRadius: 5,
21+
backgroundColor:
22+
method == "GET"
23+
? "green"
24+
: method == "POST"
25+
? "orange"
26+
: method == "DELETE"
27+
? "red"
28+
: "grey",
29+
maxWidth: 100
30+
}}
31+
>
32+
{method}
33+
</div>
34+
);
35+
})}
36+
<div style={{ margin: 10, maxWidth: 300, minWidth: 300 }}>{patterns}</div>
1537
</div>
16-
}
38+
);
39+
};
1740

1841
function App() {
19-
let [mappings,setMappings] = useState([]);
20-
let [appHealth,setAppHealth] = useState([]);
21-
useEffect(()=>{
22-
fetch("/actuator/mappings").then(r=>r.json()).then(r=>setMappings(r['contexts']['ExampleApp']['mappings']['dispatcherServlets']['dispatcherServlet']))
23-
fetch("/actuator/health").then(r=>r.json()).then(r=>setAppHealth(r))
24-
25-
},[])
42+
let [mappings, setMappings] = useState([]);
43+
let [appHealth, setAppHealth] = useState([]);
44+
useEffect(() => {
45+
fetch("/actuator/mappings")
46+
.then(r => r.json())
47+
.then(r =>
48+
setMappings(
49+
r["contexts"]["ExampleApp"]["mappings"]["dispatcherServlets"][
50+
"dispatcherServlet"
51+
]
52+
)
53+
);
54+
fetch("/actuator/health")
55+
.then(r => r.json())
56+
.then(r => setAppHealth(r));
57+
}, []);
2658
return (
2759
<div className="App">
2860
<header className="App-header">
29-
<p>
30-
A Example Application With RabbitMQ Kafka MariaDb and Spring Boot
31-
</p>
61+
<p>A Example Application With RabbitMQ Kafka MariaDb and Spring Boot</p>
3262
<a
3363
className="App-link"
3464
href="http://localhost:9999"
@@ -37,7 +67,7 @@ function App() {
3767
>
3868
Adminer DB Management
3969
</a>
40-
<br/>
70+
<br />
4171
<a
4272
className="App-link"
4373
href="http://localhost:15672"
@@ -46,15 +76,36 @@ function App() {
4676
>
4777
RabbitMQ Management
4878
</a>
79+
<br />
80+
<a
81+
className="App-link"
82+
href="http://localhost:9998"
83+
target="_blank"
84+
rel="noopener noreferrer"
85+
>
86+
MailHog Management
87+
</a>
4988
</header>
5089
<div className="App-health-view">
5190
<div className="App-Actuator-Health">
52-
<h2>App Health</h2>
53-
{JSON.stringify(appHealth)}
91+
<br></br>
92+
<h2>App Health</h2>
93+
{JSON.stringify(appHealth)}
94+
<br></br>
95+
<br></br>
5496
</div>
5597
<div className="App-Actuator-Mappings">
56-
<h2>App Mappings</h2>
57-
{mappings.filter(m=>m.details != null).map(mapping=><><WebMapping {...mapping}/><br/></>)}
98+
<br></br>
99+
<h2>App Mappings</h2>
100+
<br></br>
101+
{mappings
102+
.filter(m => m.details != null)
103+
.map(mapping => (
104+
<>
105+
<WebMapping {...mapping} />
106+
<br />
107+
</>
108+
))}
58109
</div>
59110
</div>
60111
</div>

0 commit comments

Comments
 (0)