Round battery values in device table to whole numbers (to fit in the column width) (#14927)
* Increase battery column width to fit 100.0% * drop trailing 0s from battery decimals * round values to whole numbers
This commit is contained in:
parent
78857357f3
commit
711286f7c0
|
@ -338,11 +338,14 @@ export class HaConfigDeviceDashboard extends LitElement {
|
|||
: undefined;
|
||||
const batteryIsBinary =
|
||||
battery && computeStateDomain(battery) === "binary_sensor";
|
||||
|
||||
return battery && (batteryIsBinary || !isNaN(battery.state as any))
|
||||
? html`
|
||||
${batteryIsBinary
|
||||
? ""
|
||||
: battery.state + blankBeforePercent(this.hass.locale) + "%"}
|
||||
: Number(battery.state).toFixed() +
|
||||
blankBeforePercent(this.hass.locale) +
|
||||
"%"}
|
||||
<ha-battery-icon
|
||||
.hass=${this.hass!}
|
||||
.batteryStateObj=${battery}
|
||||
|
|
Loading…
Reference in New Issue