mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
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;
|
: undefined;
|
||||||
const batteryIsBinary =
|
const batteryIsBinary =
|
||||||
battery && computeStateDomain(battery) === "binary_sensor";
|
battery && computeStateDomain(battery) === "binary_sensor";
|
||||||
|
|
||||||
return battery && (batteryIsBinary || !isNaN(battery.state as any))
|
return battery && (batteryIsBinary || !isNaN(battery.state as any))
|
||||||
? html`
|
? html`
|
||||||
${batteryIsBinary
|
${batteryIsBinary
|
||||||
? ""
|
? ""
|
||||||
: battery.state + blankBeforePercent(this.hass.locale) + "%"}
|
: Number(battery.state).toFixed() +
|
||||||
|
blankBeforePercent(this.hass.locale) +
|
||||||
|
"%"}
|
||||||
<ha-battery-icon
|
<ha-battery-icon
|
||||||
.hass=${this.hass!}
|
.hass=${this.hass!}
|
||||||
.batteryStateObj=${battery}
|
.batteryStateObj=${battery}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user