diff --git a/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt b/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt index 6f0e820..546909e 100644 --- a/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt +++ b/src/main/kotlin/dev/dnpm/etl/processor/web/StatisticsRestController.kt @@ -132,6 +132,7 @@ class StatisticsRestController( @GetMapping(path = ["events"], produces = [MediaType.TEXT_EVENT_STREAM_VALUE]) fun updater(): Flux> { return statisticsUpdateProducer.asFlux().flatMap { + println(it) Flux.fromIterable( listOf( ServerSentEvent.builder() @@ -152,6 +153,10 @@ class StatisticsRestController( .build(), ServerSentEvent.builder() .event("deleterequestpatientstates").id("none").data(this.requestPatientStates(true)) + .build(), + + ServerSentEvent.builder() + .event("newrequest").id("none").data("newrequest") .build() ) ) diff --git a/src/main/resources/static/style.css b/src/main/resources/static/style.css index fee5d4c..e2bf65a 100644 --- a/src/main/resources/static/style.css +++ b/src/main/resources/static/style.css @@ -520,4 +520,19 @@ input.inline:focus-visible { .notification.error { 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; } \ No newline at end of file diff --git a/src/main/resources/templates/index.html b/src/main/resources/templates/index.html index b1c3142..c039b33 100644 --- a/src/main/resources/templates/index.html +++ b/src/main/resources/templates/index.html @@ -9,7 +9,7 @@
-

Letzte Anfragen

+

Letzte Anfragen

@@ -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'; + }); \ No newline at end of file