Guard more of the hardware panel (#13650)

This commit is contained in:
Joakim Sørensen 2022-09-08 02:59:08 +02:00 committed by GitHub
parent fd431f36f7
commit bf5589b88d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -80,7 +80,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
private _cpuEntries: { x: number; y: number | null }[] = []; private _cpuEntries: { x: number; y: number | null }[] = [];
public hassSubscribe() { public hassSubscribe() {
return [ return isComponentLoaded(this.hass, "hardware")
? [
this.hass.connection.subscribeMessage<SystemStatusStreamMessage>( this.hass.connection.subscribeMessage<SystemStatusStreamMessage>(
(message) => { (message) => {
// Only store the last 60 entries // Only store the last 60 entries
@ -102,7 +103,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
type: "hardware/subscribe_system_status", type: "hardware/subscribe_system_status",
} }
), ),
]; ]
: [];
} }
protected willUpdate(): void { protected willUpdate(): void {
@ -198,7 +200,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
.narrow=${this.narrow} .narrow=${this.narrow}
.header=${this.hass.localize("ui.panel.config.hardware.caption")} .header=${this.hass.localize("ui.panel.config.hardware.caption")}
> >
<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon"> ${isComponentLoaded(this.hass, "hassio")
? html`<ha-button-menu corner="BOTTOM_START" slot="toolbar-icon">
<ha-icon-button <ha-icon-button
.label=${this.hass.localize("ui.common.menu")} .label=${this.hass.localize("ui.common.menu")}
.path=${mdiDotsVertical} .path=${mdiDotsVertical}
@ -223,7 +226,8 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
> >
` `
: ""} : ""}
</ha-button-menu> </ha-button-menu>`
: ""}
${this._error ${this._error
? html` ? html`
<ha-alert alert-type="error" <ha-alert alert-type="error"