Skip to content

Commit

Permalink
Display a warning icon and N/A instead of "undefinedW" when sensor da…
Browse files Browse the repository at this point in the history
…ta is missing
  • Loading branch information
Jalle19 committed May 22, 2024
1 parent 8032aa7 commit 55a0277
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions webif/src/lib/assets/warning.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 8 additions & 1 deletion webif/src/routes/Circuits.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<script lang="ts">
import { formatPf } from '$lib/format'
import type { PowerSensorData } from '$lib/types'
import warning from '$lib/assets/warning.svg'
export let sensorData: PowerSensorData[]
</script>
Expand Down Expand Up @@ -30,7 +31,13 @@
<td>{data.circuit.phase ?? ''}</td>
<td>{data.circuit.type}</td>
<td>{data.circuit.sensor.type}</td>
<td class="cell-right-align">{data.power}W</td>
<td class="cell-right-align">
{#if data.power !== undefined}
{data.power}W
{:else}
<img src={warning} alt="Warning" /> N/A
{/if}
</td>
<td class="cell-right-align">
{#if data.apparentPower }
{data.apparentPower}VA
Expand Down
5 changes: 5 additions & 0 deletions webif/src/routes/styles.css
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
--color: #aaa;
--component-background: #3b3b3b;
--highlight-color: #ff3d00;
--warning-color: #bb962f;
}

nav {
Expand All @@ -32,6 +33,10 @@
border: 0;
}

.pure-table td img {
vertical-align: bottom;
}

.pure-table-striped tr:nth-child(2n-1) td {
background-color: #2e2e2e;
}
Expand Down

0 comments on commit 55a0277

Please sign in to comment.