mirror of
https://github.com/pcvolkmer/etl-processor.git
synced 2025-04-19 17:26:51 +00:00
Merge pull request #26 from CCC-MF/issue_23
feat #23: add reload button to display on new request
This commit is contained in:
commit
4bc69a353c
@ -132,6 +132,7 @@ class StatisticsRestController(
|
|||||||
@GetMapping(path = ["events"], produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
|
@GetMapping(path = ["events"], produces = [MediaType.TEXT_EVENT_STREAM_VALUE])
|
||||||
fun updater(): Flux<ServerSentEvent<Any>> {
|
fun updater(): Flux<ServerSentEvent<Any>> {
|
||||||
return statisticsUpdateProducer.asFlux().flatMap {
|
return statisticsUpdateProducer.asFlux().flatMap {
|
||||||
|
println(it)
|
||||||
Flux.fromIterable(
|
Flux.fromIterable(
|
||||||
listOf(
|
listOf(
|
||||||
ServerSentEvent.builder<Any>()
|
ServerSentEvent.builder<Any>()
|
||||||
@ -152,6 +153,10 @@ class StatisticsRestController(
|
|||||||
.build(),
|
.build(),
|
||||||
ServerSentEvent.builder<Any>()
|
ServerSentEvent.builder<Any>()
|
||||||
.event("deleterequestpatientstates").id("none").data(this.requestPatientStates(true))
|
.event("deleterequestpatientstates").id("none").data(this.requestPatientStates(true))
|
||||||
|
.build(),
|
||||||
|
|
||||||
|
ServerSentEvent.builder<Any>()
|
||||||
|
.event("newrequest").id("none").data("newrequest")
|
||||||
.build()
|
.build()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
@ -520,4 +520,19 @@ input.inline:focus-visible {
|
|||||||
|
|
||||||
.notification.error {
|
.notification.error {
|
||||||
color: var(--bg-red);
|
color: var(--bg-red);
|
||||||
|
}
|
||||||
|
|
||||||
|
a.reload {
|
||||||
|
display: none;
|
||||||
|
position: absolute;
|
||||||
|
height: 1.2em;
|
||||||
|
width: 1.2em;
|
||||||
|
background: var(--bg-red);
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
color: white;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: .6em;
|
||||||
|
align-content: center;
|
||||||
|
justify-content: center;
|
||||||
}
|
}
|
@ -9,7 +9,7 @@
|
|||||||
<div th:replace="~{fragments.html :: nav}"></div>
|
<div th:replace="~{fragments.html :: nav}"></div>
|
||||||
<main>
|
<main>
|
||||||
|
|
||||||
<h1>Letzte Anfragen</h1>
|
<h1>Letzte Anfragen<a id="reload-notify" class="reload" title="Neue Anfragen" th:href="@{/}">⟳</a></h1>
|
||||||
|
|
||||||
<div class="border">
|
<div class="border">
|
||||||
<div class="page-control">
|
<div class="page-control">
|
||||||
@ -68,6 +68,12 @@
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const eventSource = new EventSource('statistics/events');
|
||||||
|
eventSource.addEventListener('newrequest', event => {
|
||||||
|
console.log(event);
|
||||||
|
document.getElementById('reload-notify').style.display = 'inline-flex';
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
x
Reference in New Issue
Block a user