Skip to content

Commit

Permalink
signalling connection
Browse files Browse the repository at this point in the history
  • Loading branch information
d-led committed Jun 5, 2024
1 parent 98a2e6a commit 31cf1bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
3 changes: 3 additions & 0 deletions ui-src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ <h4>Server-side updates & info</h4>
<div class="alert alert-warning" role="alert" id="offline-alert" style="display: none;">
Offline, hold on ...
</div>
<div class="alert alert-success fade" id="connected-alert" style="display: none;">
Connected
</div>

<div class="table-responsive-sm d-flex flex-row mt-2 mb-2">
<table class="table table-fit">
Expand Down
8 changes: 8 additions & 0 deletions ui-src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ async function subscribe(
await subscribe(streamUrl, processingFunc);
} else {
hideDisconnectedAlert();
flashConnectedAlert();
// Get and show the message
const reader = response?.body?.getReader();
if (!reader) {
Expand Down Expand Up @@ -247,3 +248,10 @@ function hideDisconnectedAlert() {
function showDisconnectedAlert() {
$("#offline-alert").show();
}

function flashConnectedAlert() {
$("#connected-alert").show();
$("#connected-alert").fadeTo(500, 50, function () {
$("#connected-alert").slideUp(500);
});
}

0 comments on commit 31cf1bc

Please sign in to comment.