refactor: update portal (unit system)

This commit is contained in:
Yurii
2024-04-06 18:25:30 +03:00
parent 0a8dd2a076
commit 86734ab622
3 changed files with 22 additions and 14 deletions

View File

@@ -168,11 +168,11 @@
</tr>
<tr>
<th scope="row">Pressure:</th>
<td><b class="ot-pressure"></b> bar</td>
<td><b class="ot-pressure"></b> <span class="pressure-unit"></span></td>
</tr>
<tr>
<th scope="row">DHW flow rate:</th>
<td><b class="ot-dhw-flow-rate"></b> l/min</td>
<td><b class="ot-dhw-flow-rate"></b> <span class="volume-unit"></span>/min</td>
</tr>
<tr>
<th scope="row">Fault code:</th>
@@ -180,31 +180,31 @@
</tr>
<tr>
<th scope="row">Indoor temp:</th>
<td><b class="indoor-temp"></b> <span class="unit-system"></span></td>
<td><b class="indoor-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">Outdoor temp:</th>
<td><b class="outdoor-temp"></b> <span class="unit-system"></span></td>
<td><b class="outdoor-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">Heating temp:</th>
<td><b class="heating-temp"></b> <span class="unit-system"></span></td>
<td><b class="heating-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">Heating setpoint temp:</th>
<td><b class="heating-setpoint-temp"></b> <span class="unit-system"></span></td>
<td><b class="heating-setpoint-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">Heating return temp:</th>
<td><b class="heating-return-temp"></b> <span class="unit-system"></span></td>
<td><b class="heating-return-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">DHW temp:</th>
<td><b class="dhw-temp"></b> <span class="unit-system"></span></td>
<td><b class="dhw-temp"></b> <span class="temp-unit"></span></td>
</tr>
<tr>
<th scope="row">Exhaust temp:</th>
<td><b class="exhaust-temp"></b> <span class="unit-system"></span></td>
<td><b class="exhaust-temp"></b> <span class="temp-unit"></span></td>
</tr>
</tbody>
</table>

Binary file not shown.

View File

@@ -537,18 +537,24 @@ async function loadVars() {
let response = await fetch('/api/vars');
let result = await response.json();
let unitSystemStr;
let tempUnitStr, pressureUnitStr, volumeUnitStr;
switch (result.system.unitSystem) {
case 0:
unitSystemStr = 'C';
tempUnitStr = 'C';
pressureUnitStr = 'bar';
volumeUnitStr = 'L';
break;
case 1:
unitSystemStr = 'F';
tempUnitStr = 'F';
pressureUnitStr = 'psi';
volumeUnitStr = 'gal';
break;
default:
unitSystemStr = '?';
tempUnitStr = '?';
pressureUnitStr = '?';
volumeUnitStr = '?';
break;
}
@@ -576,7 +582,9 @@ async function loadVars() {
setBusy('.ot-busy', '.ot-table', false);
setValue('.unit-system', unitSystemStr);
setValue('.temp-unit', tempUnitStr);
setValue('.pressure-unit', pressureUnitStr);
setValue('.volume-unit', volumeUnitStr);
setValue('.version', result.system.version);
setValue('.build-date', result.system.buildDate);
setValue('.uptime', result.system.uptime);