Update thread-config-panel.ts

This commit is contained in:
Bram Kragten 2023-08-16 10:01:50 +02:00
parent 05e08cdcc0
commit b19fe68686

View File

@ -164,14 +164,15 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
})}
</h4>
</div>
${network.routers.map(
(router) =>
html`<ha-list-item
${network.routers.map((router) => {
const showOverflow =
("dataset" in network && router.border_agent_id) ||
router.extended_address === this._otbrInfo?.extended_address;
return html`<ha-list-item
class="router"
twoline
graphic="avatar"
.hasMeta=${("dataset" in network && router.border_agent_id) ||
router.extended_address === this._otbrInfo?.extended_address}
.hasMeta=${showOverflow}
>
<img
slot="graphic"
@ -190,8 +191,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
router.server?.replace(".local.", "") ||
""}
<span slot="secondary">${router.server}</span>
${(network.dataset && router.border_agent_id) ||
router.extended_address === this._otbrInfo?.extended_address
${showOverflow
? html`${network.dataset &&
router.border_agent_id ===
network.dataset.preferred_border_agent_id
@ -231,14 +231,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
: ""}
${router.extended_address ===
this._otbrInfo?.extended_address
? html`<ha-icon-button
.label=${this.hass.localize(
"ui.common.overflow_menu"
)}
.path=${mdiDotsVertical}
slot="trigger"
></ha-icon-button>
<ha-list-item>
? html`<ha-list-item>
${this.hass.localize(
"ui.panel.config.thread.reset_border_router"
)}</ha-list-item
@ -258,8 +251,8 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
: ""}
</ha-button-menu>`
: ""}
</ha-list-item>`
)}`
</ha-list-item>`;
})}`
: html`<div class="card-content no-routers">
<ha-svg-icon .path=${mdiDevices}></ha-svg-icon>
${network.dataset?.extended_pan_id &&
@ -509,7 +502,7 @@ export class ThreadConfigPanel extends SubscribeMixin(LitElement) {
) {
const datasetId = dataset.dataset_id;
const borderAgentId = router.border_agent_id;
if (!router.border_agent_id) {
if (!borderAgentId) {
return;
}
await setPreferredBorderAgent(this.hass, datasetId, borderAgentId);