mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fixes empty hardware page when no config entries (#15267)
This commit is contained in:
parent
30e6a1a57e
commit
6226a7f28d
@ -103,17 +103,21 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
|
|||||||
fullUpdate = true;
|
fullUpdate = true;
|
||||||
}
|
}
|
||||||
} else if (message.type === "removed") {
|
} else if (message.type === "removed") {
|
||||||
delete this._configEntries![message.entry.entry_id];
|
if (this._configEntries) {
|
||||||
|
delete this._configEntries[message.entry.entry_id];
|
||||||
|
}
|
||||||
} else if (message.type === "updated") {
|
} else if (message.type === "updated") {
|
||||||
const newEntry = message.entry;
|
if (this._configEntries) {
|
||||||
this._configEntries![message.entry.entry_id] = newEntry;
|
const newEntry = message.entry;
|
||||||
|
this._configEntries[message.entry.entry_id] = newEntry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (!newEntries.length && !fullUpdate) {
|
if (!newEntries.length && !fullUpdate) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const entries = [
|
const entries = [
|
||||||
...(fullUpdate ? [] : Object.values(this._configEntries!)),
|
...(fullUpdate ? [] : Object.values(this._configEntries || {})),
|
||||||
...newEntries,
|
...newEntries,
|
||||||
];
|
];
|
||||||
const configEntries: { [id: string]: ConfigEntry } = {};
|
const configEntries: { [id: string]: ConfigEntry } = {};
|
||||||
@ -220,10 +224,6 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this._configEntries) {
|
|
||||||
return html``;
|
|
||||||
}
|
|
||||||
|
|
||||||
let boardId: string | undefined;
|
let boardId: string | undefined;
|
||||||
let boardName: string | undefined;
|
let boardName: string | undefined;
|
||||||
let imageURL: string | undefined;
|
let imageURL: string | undefined;
|
||||||
@ -240,14 +240,14 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
|
|||||||
(!hw.config_entries.length ||
|
(!hw.config_entries.length ||
|
||||||
hw.config_entries.some(
|
hw.config_entries.some(
|
||||||
(entryId) =>
|
(entryId) =>
|
||||||
this._configEntries![entryId] &&
|
this._configEntries?.[entryId] &&
|
||||||
!this._configEntries![entryId].disabled_by
|
!this._configEntries[entryId].disabled_by
|
||||||
))
|
))
|
||||||
);
|
);
|
||||||
|
|
||||||
if (boardData) {
|
if (boardData) {
|
||||||
boardConfigEntries = boardData.config_entries
|
boardConfigEntries = boardData.config_entries
|
||||||
.map((id) => this._configEntries![id])
|
.map((id) => this._configEntries?.[id])
|
||||||
.filter(
|
.filter(
|
||||||
(entry) => entry?.supports_options && !entry.disabled_by
|
(entry) => entry?.supports_options && !entry.disabled_by
|
||||||
) as ConfigEntry[];
|
) as ConfigEntry[];
|
||||||
@ -376,7 +376,7 @@ class HaConfigHardware extends SubscribeMixin(LitElement) {
|
|||||||
? html`<ha-card>
|
? html`<ha-card>
|
||||||
${dongles.map((dongle) => {
|
${dongles.map((dongle) => {
|
||||||
const configEntry = dongle.config_entries
|
const configEntry = dongle.config_entries
|
||||||
.map((id) => this._configEntries![id])
|
.map((id) => this._configEntries?.[id])
|
||||||
.filter(
|
.filter(
|
||||||
(entry) => entry?.supports_options && !entry.disabled_by
|
(entry) => entry?.supports_options && !entry.disabled_by
|
||||||
)[0];
|
)[0];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user