Remove time from assist dev tools (#17079)

This commit is contained in:
Bram Kragten 2023-06-28 17:19:47 +02:00 committed by GitHub
parent de7f055419
commit f6d06f5e26
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -5,7 +5,6 @@ import "../../../components/ha-button";
import "../../../components/ha-code-editor"; import "../../../components/ha-code-editor";
import "../../../components/ha-language-picker"; import "../../../components/ha-language-picker";
import "../../../components/ha-textarea"; import "../../../components/ha-textarea";
import "../../../components/ha-absolute-time";
import type { HaTextArea } from "../../../components/ha-textarea"; import type { HaTextArea } from "../../../components/ha-textarea";
import { import {
AssitDebugResult, AssitDebugResult,
@ -22,7 +21,6 @@ type SentenceParsingResult = {
sentence: string; sentence: string;
language: string; language: string;
result: AssitDebugResult | null; result: AssitDebugResult | null;
time: Date;
}; };
@customElement("developer-tools-assist") @customElement("developer-tools-assist")
@ -75,8 +73,6 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
this._sentencesInput.value = ""; this._sentencesInput.value = "";
const now = new Date();
const newResults: SentenceParsingResult[] = []; const newResults: SentenceParsingResult[] = [];
sentences.forEach((sentence, index) => { sentences.forEach((sentence, index) => {
const result = results[index]; const result = results[index];
@ -85,7 +81,6 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
sentence, sentence,
language: this._language!, language: this._language!,
result, result,
time: now,
}); });
}); });
this._results = [...newResults, ...this._results]; this._results = [...newResults, ...this._results];
@ -152,7 +147,7 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
</ha-card> </ha-card>
${this._results.map((r) => { ${this._results.map((r) => {
const { sentence, result, language, time } = r; const { sentence, result, language } = r;
const matched = result != null; const matched = result != null;
return html` return html`
@ -163,34 +158,22 @@ class HaPanelDevAssist extends SubscribeMixin(LitElement) {
<p>${matched ? "✅" : "❌"}</p> <p>${matched ? "✅" : "❌"}</p>
</div> </div>
<div class="info"> <div class="info">
<p> Language: ${formatLanguageCode(language, this.hass.locale)}
Language: ${formatLanguageCode( (${language})
language,
this.hass.locale
)} (${language})
</p>
<p>Execution time:
<ha-absolute-time .hass=${this.hass} .datetime=${time}>
</ha-absolute-time>
</p>
</p>
</div> </div>
${ ${result
result ? html`
? html` <ha-code-editor
<ha-code-editor mode="yaml"
mode="yaml" .hass=${this.hass}
.hass=${this.hass} .value=${dump(result).trimRight()}
.value=${dump(result).trimRight()} read-only
read-only dir="ltr"
dir="ltr" ></ha-code-editor>
></ha-code-editor> `
` : html`<ha-alert alert-type="error">
: html`<ha-alert alert-type="error" No intent matched
>No intent matched</ha-alert </ha-alert>`}
>`
}
</div> </div>
</ha-card> </ha-card>
`; `;