only show cpu and mem when available (#13589)

This commit is contained in:
Bram Kragten 2022-09-05 14:12:04 +02:00 committed by GitHub
parent 310df387e7
commit 02d608b704
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -284,14 +284,16 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
</ha-card>
`
: ""}
<ha-card outlined>
${this._systemStatusData
? html` <ha-card outlined>
<div class="header">
<div class="title">
${this.hass.localize("ui.panel.config.hardware.processor")}
${this.hass.localize(
"ui.panel.config.hardware.processor"
)}
</div>
<div class="value">
${this._systemStatusData?.cpu_percent || "-"}%
${this._systemStatusData.cpu_percent || "-"}%
</div>
</div>
<div class="card-content">
@ -314,8 +316,6 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
${this.hass.localize("ui.panel.config.hardware.memory")}
</div>
<div class="value">
${this._systemStatusData
? html`
${round(this._systemStatusData.memory_used_mb / 1024, 1)}
GB /
${round(
@ -325,8 +325,6 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
0
)}
GB
`
: "- GB / - GB"}
</div>
</div>
<div class="card-content">
@ -342,7 +340,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
.options=${this._chartOptions}
></ha-chart-base>
</div>
</ha-card>
</ha-card>`
: ""}
</div>
</hass-subpage>
`;