Skip to content

Commit 2544d69

Browse files
committed
Added "Lost connection" popup
1 parent 53a6338 commit 2544d69

File tree

3 files changed

+21
-2
lines changed

3 files changed

+21
-2
lines changed

assets/js/actions.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,14 +42,14 @@ async function updateServers() {
4242
}
4343
}).then((response) => {
4444
response.data.forEach(server => {
45+
showLostConnectionPopup(false);
4546

4647
$(`[data-server-guid="${server.Guid}"]`).data("server", server)
4748
$(`.serverName-${server.Guid}`).html(`${server.Name}`)
4849
$(`.serverStatus-${server.Guid}`).html(`${GetFriendlyStatusName(server.Status)}`)
4950
$(`.serverStatusColor-${server.Guid}`).removeClass(["color-0", "color-1", "color-2", "color-3","color-4"]).addClass(`color-${server.Status}`)
5051
})
5152
}).catch(err => {
52-
console.error(err);
53-
showPopup("Failed to fetch server status.")
53+
showLostConnectionPopup(true);
5454
});
5555
}

assets/js/panel.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,11 @@ function showPopup(content) {
127127
message: content
128128
});
129129
}
130+
131+
function showLostConnectionPopup(visible) {
132+
let parameter = visible ? "show": "hide";
133+
134+
$(".ui.basic.modal").modal({
135+
closable: false,
136+
}).modal(parameter);
137+
}

panel.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@
5858
</div>
5959
</div>
6060

61+
<div class="ui basic modal">
62+
<div class="ui icon header">
63+
<i class="satellite dish icon"></i>
64+
Lost connection to the MC Server Soft API.
65+
</div>
66+
<div class="center aligned content">
67+
<p>Trying to restore the connection.</p>
68+
<i class="sync loading icon"></i>
69+
</div>
70+
</div>
71+
6172
<script src="assets/core/jquery.min.js"></script>
6273
<script src="assets/core/fomantic/semantic.min.js"></script>
6374
<script src="assets/core/axios.min.js"></script>

0 commit comments

Comments
 (0)