Skip to content

Commit

Permalink
Add WebSocket verification and inform on GUI in case of failure.
Browse files Browse the repository at this point in the history
  • Loading branch information
emersonfelipesp committed Oct 16, 2024
1 parent 1894f81 commit 3d26e58
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion netbox_proxbox/templates/netbox_proxbox/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@

};

ws.onerror = function(error) {
console.log("WebSocket error observed: ", error);

fullUpdateButton = document.getElementById('full-update-button')
fullUpdateButton.className = "btn btn-red"

fullUpdateMessage = document.getElementById('full-update-error-message')
fullUpdateMessage.className = "text-red"
fullUpdateMessage.innerHTML = `
<p>
<strong>WebSocket</strong> communication failed with <strong><a class="text-red" href="${error.currentTarget.url}" target="_blank">${error.currentTarget.url}</a></strong>
<br>The most probably cause is <strong>Proxbox Backend not running</strong> properly.
</p>`
}

function sendMessage(event) {
// Send Websocket Message
Expand Down Expand Up @@ -151,11 +165,12 @@

<div class="row mb-3">

<div align=center id="full-update-error-message"></div>
{# Full Update Button#}
<div style="margin-bottom: 15px;" class="d-flex justify-content-center noprint">
<form action="" onsubmit="sendMessage(event)">
{% if perms.netbox_proxbox.add_proxmoxvm %}
<button class="btn btn-primary">Proxmox Full Update (probably not working on v4.0)</button>
<button id="full-update-button" class="btn btn-primary">Proxmox Full Update (probably not working on v4.0)</button>


{% endif %}
Expand Down

0 comments on commit 3d26e58

Please sign in to comment.