Hide devices without subentry box when not needed

This commit is contained in:
Paulus Schoutsen 2025-06-25 21:20:10 +00:00
parent df2523a6a2
commit a6452bbf35

View File

@ -405,47 +405,54 @@ class HaConfigEntryRow extends LitElement {
</ha-md-list-item> </ha-md-list-item>
${this._expanded ${this._expanded
? subEntries.length ? subEntries.length
? html`<ha-md-list class="devices"> ? html` ${ownDevices.length
<ha-md-list-item @click=${this._toggleOwnDevices} type="button"> ? html`
<ha-icon-button <ha-md-list class="devices">
class="expand-button" <ha-md-list-item
.path=${this._devicesExpanded @click=${this._toggleOwnDevices}
? mdiChevronDown type="button"
: mdiChevronUp} >
slot="start" <ha-icon-button
> class="expand-button"
</ha-icon-button> .path=${this._devicesExpanded
${this.hass.localize( ? mdiChevronDown
"ui.panel.config.integrations.config_entry.devices_without_subentry" : mdiChevronUp}
)} slot="start"
</ha-md-list-item> >
${this._devicesExpanded </ha-icon-button>
? ownDevices.map( ${this.hass.localize(
(device) => "ui.panel.config.integrations.config_entry.devices_without_subentry"
html`<ha-config-entry-device-row )}
.hass=${this.hass} </ha-md-list-item>
.narrow=${this.narrow} ${this._devicesExpanded
.entry=${item} ? ownDevices.map(
.device=${device} (device) =>
.entities=${entities} html`<ha-config-entry-device-row
></ha-config-entry-device-row>` .hass=${this.hass}
) .narrow=${this.narrow}
: nothing} .entry=${item}
</ha-md-list> .device=${device}
${subEntries.map( .entities=${entities}
(subEntry) => html` ></ha-config-entry-device-row>`
<ha-config-sub-entry-row )
.hass=${this.hass} : nothing}
.narrow=${this.narrow} </ha-md-list>
.manifest=${this.manifest}
.diagnosticHandler=${this.diagnosticHandler}
.entities=${this.entities}
.entry=${item}
.subEntry=${subEntry}
data-entry-id=${item.entry_id}
></ha-config-sub-entry-row>
` `
)}` : nothing}
${subEntries.map(
(subEntry) => html`
<ha-config-sub-entry-row
.hass=${this.hass}
.narrow=${this.narrow}
.manifest=${this.manifest}
.diagnosticHandler=${this.diagnosticHandler}
.entities=${this.entities}
.entry=${item}
.subEntry=${subEntry}
data-entry-id=${item.entry_id}
></ha-config-sub-entry-row>
`
)}`
: html` : html`
${ownDevices.map( ${ownDevices.map(
(device) => (device) =>