Sort listening entity and domain in template dev tools (#6953)

This commit is contained in:
Bram Kragten 2020-09-12 17:48:40 +02:00 committed by GitHub
parent c979cfb912
commit 266f2e763d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -14,8 +14,8 @@ import { debounce } from "../../../common/util/debounce";
import "../../../components/ha-circular-progress"; import "../../../components/ha-circular-progress";
import "../../../components/ha-code-editor"; import "../../../components/ha-code-editor";
import { import {
subscribeRenderTemplate,
RenderTemplateResult, RenderTemplateResult,
subscribeRenderTemplate,
} from "../../../data/ws-templates"; } from "../../../data/ws-templates";
import { haStyle } from "../../../resources/styles"; import { haStyle } from "../../../resources/styles";
import { HomeAssistant } from "../../../types"; import { HomeAssistant } from "../../../types";
@ -151,38 +151,46 @@ class HaPanelDevTemplate extends LitElement {
? "" ? ""
: this._templateResult.listeners.all : this._templateResult.listeners.all
? html` ? html`
<span class="all_listeners"> <h3 class="all_listeners">
${this.hass.localize( ${this.hass.localize(
"ui.panel.developer-tools.tabs.templates.all_listeners" "ui.panel.developer-tools.tabs.templates.all_listeners"
)} )}
</span> </h3>
` `
: this._templateResult.listeners.domains.length || : this._templateResult.listeners.domains.length ||
this._templateResult.listeners.entities.length this._templateResult.listeners.entities.length
? html` ? html`
<h3>
${this.hass.localize( ${this.hass.localize(
"ui.panel.developer-tools.tabs.templates.listeners" "ui.panel.developer-tools.tabs.templates.listeners"
)} )}
</h3>
<ul> <ul>
${this._templateResult.listeners.domains.map( ${this._templateResult.listeners.domains
.sort()
.map(
(domain) => (domain) =>
html` html`
<li> <li>
${this.hass.localize( <b
>${this.hass.localize(
"ui.panel.developer-tools.tabs.templates.domain" "ui.panel.developer-tools.tabs.templates.domain"
)}: )}</b
${domain} >: ${domain}
</li> </li>
` `
)} )}
${this._templateResult.listeners.entities.map( ${this._templateResult.listeners.entities
.sort()
.map(
(entity_id) => (entity_id) =>
html` html`
<li> <li>
${this.hass.localize( <b
>${this.hass.localize(
"ui.panel.developer-tools.tabs.templates.entity" "ui.panel.developer-tools.tabs.templates.entity"
)}: )}</b
${entity_id} >: ${entity_id}
</li> </li>
` `
)} )}