diff --git a/src/common/translations/localize.ts b/src/common/translations/localize.ts index 5a38952c9a..33d871e023 100644 --- a/src/common/translations/localize.ts +++ b/src/common/translations/localize.ts @@ -29,11 +29,9 @@ export type LocalizeKeys = | `ui.panel.config.devices.${string}` | `ui.panel.config.energy.${string}` | `ui.panel.config.info.${string}` - | `ui.panel.config.logs.${string}` | `ui.panel.config.lovelace.${string}` | `ui.panel.config.network.${string}` | `ui.panel.config.scene.${string}` - | `ui.panel.config.url.${string}` | `ui.panel.config.zha.${string}` | `ui.panel.config.zwave_js.${string}` | `ui.panel.lovelace.card.${string}` diff --git a/src/data/system_log.ts b/src/data/system_log.ts index ced7085658..61b02df458 100644 --- a/src/data/system_log.ts +++ b/src/data/system_log.ts @@ -1,9 +1,9 @@ -import { HomeAssistant } from "../types"; +import { HomeAssistant, TranslationDict } from "../types"; export interface LoggedError { name: string; message: [string]; - level: string; + level: keyof TranslationDict["ui"]["panel"]["config"]["logs"]["level"]; source: [string, number]; // unix timestamp in seconds timestamp: number; @@ -13,8 +13,13 @@ export interface LoggedError { first_occurred: number; } -export const fetchSystemLog = (hass: HomeAssistant) => - hass.callWS({ type: "system_log/list" }); +export const fetchSystemLog = async (hass: HomeAssistant) => { + const log = await hass.callWS({ type: "system_log/list" }); + for (const error of log) { + error.level = error.level.toLowerCase() as LoggedError["level"]; + } + return log; +}; export const getLoggedErrorIntegration = (item: LoggedError) => { // Try to derive from logger name diff --git a/src/panels/config/logs/dialog-system-log-detail.ts b/src/panels/config/logs/dialog-system-log-detail.ts index 42113c9772..86920b3877 100644 --- a/src/panels/config/logs/dialog-system-log-detail.ts +++ b/src/panels/config/logs/dialog-system-log-detail.ts @@ -72,10 +72,8 @@ class DialogSystemLogDetail extends LitElement { const title = this.hass.localize( "ui.panel.config.logs.details", "level", - html`${this.hass.localize( - `ui.panel.config.logs.level.${item.level.toLowerCase()}` - )}${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}` ); diff --git a/src/panels/config/logs/system-log-card.ts b/src/panels/config/logs/system-log-card.ts index e2b2b8a10c..eaf448c1f8 100644 --- a/src/panels/config/logs/system-log-card.ts +++ b/src/panels/config/logs/system-log-card.ts @@ -104,9 +104,9 @@ export class SystemLogCard extends LitElement {
${item.message[0]}
${this._timestamp(item)} – - ${html`(${this.hass.localize( - `ui.panel.config.logs.level.${item.level.toLowerCase()}` + `ui.panel.config.logs.level.${item.level}` )}) `} ${integrations[idx] diff --git a/src/panels/config/network/ha-config-url-form.ts b/src/panels/config/network/ha-config-url-form.ts index b4938cc764..bfeeefaf20 100644 --- a/src/panels/config/network/ha-config-url-form.ts +++ b/src/panels/config/network/ha-config-url-form.ts @@ -229,7 +229,7 @@ class ConfigUrlForm extends LitElement { ? "info" : "warning"} .title=${this.hass.localize( - "ui.panel.config.url.intenral_url_https_error_title" + "ui.panel.config.url.internal_url_https_error_title" )} > ${this.hass.localize(