webapp: added data age to live view

This commit is contained in:
Thomas Basler 2022-06-16 15:32:32 +02:00
parent 9265bc0add
commit d5e8f75ab0

View File

@ -38,8 +38,16 @@
tabindex="0" tabindex="0"
> >
<div class="card"> <div class="card">
<div class="card-header text-white bg-primary"> <div
{{ inverter.name }} ({{ inverter.serial }}) class="card-header text-white bg-primary"
:class="{
'bg-danger': inverter.age_critical,
'bg-primary': !inverter.age_critical,
}"
>
{{ inverter.name }} (Inverter Serial Number:
{{ inverter.serial }}) (Data Age:
{{ inverter.data_age }} seconds)
</div> </div>
<div class="card-body"> <div class="card-body">
<div class="row row-cols-1 row-cols-md-3 g-4"> <div class="row row-cols-1 row-cols-md-3 g-4">
@ -80,8 +88,8 @@ export default {
const socketProtocol = const socketProtocol =
window.location.protocol === "https:" ? "wss:" : "ws:"; window.location.protocol === "https:" ? "wss:" : "ws:";
const port = window.location.port; const port = 80; // window.location.port;
const host = window.location.hostname; const host = "192.168.20.110"; //window.location.hostname;
const webSocketUrl = socketProtocol + "//" + host + ":" + port + "/ws"; const webSocketUrl = socketProtocol + "//" + host + ":" + port + "/ws";
this.connection = new WebSocket(webSocketUrl); this.connection = new WebSocket(webSocketUrl);