mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
Fix localize key errors for URL error and system log (#14909)
* Use literal type for system log level * Fix typo in URL error title key * Remove localize key exceptions
This commit is contained in:
parent
3e14d825e3
commit
f101bd1a54
@ -29,11 +29,9 @@ export type LocalizeKeys =
|
|||||||
| `ui.panel.config.devices.${string}`
|
| `ui.panel.config.devices.${string}`
|
||||||
| `ui.panel.config.energy.${string}`
|
| `ui.panel.config.energy.${string}`
|
||||||
| `ui.panel.config.info.${string}`
|
| `ui.panel.config.info.${string}`
|
||||||
| `ui.panel.config.logs.${string}`
|
|
||||||
| `ui.panel.config.lovelace.${string}`
|
| `ui.panel.config.lovelace.${string}`
|
||||||
| `ui.panel.config.network.${string}`
|
| `ui.panel.config.network.${string}`
|
||||||
| `ui.panel.config.scene.${string}`
|
| `ui.panel.config.scene.${string}`
|
||||||
| `ui.panel.config.url.${string}`
|
|
||||||
| `ui.panel.config.zha.${string}`
|
| `ui.panel.config.zha.${string}`
|
||||||
| `ui.panel.config.zwave_js.${string}`
|
| `ui.panel.config.zwave_js.${string}`
|
||||||
| `ui.panel.lovelace.card.${string}`
|
| `ui.panel.lovelace.card.${string}`
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import { HomeAssistant } from "../types";
|
import { HomeAssistant, TranslationDict } from "../types";
|
||||||
|
|
||||||
export interface LoggedError {
|
export interface LoggedError {
|
||||||
name: string;
|
name: string;
|
||||||
message: [string];
|
message: [string];
|
||||||
level: string;
|
level: keyof TranslationDict["ui"]["panel"]["config"]["logs"]["level"];
|
||||||
source: [string, number];
|
source: [string, number];
|
||||||
// unix timestamp in seconds
|
// unix timestamp in seconds
|
||||||
timestamp: number;
|
timestamp: number;
|
||||||
@ -13,8 +13,13 @@ export interface LoggedError {
|
|||||||
first_occurred: number;
|
first_occurred: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const fetchSystemLog = (hass: HomeAssistant) =>
|
export const fetchSystemLog = async (hass: HomeAssistant) => {
|
||||||
hass.callWS<LoggedError[]>({ type: "system_log/list" });
|
const log = await hass.callWS<LoggedError[]>({ type: "system_log/list" });
|
||||||
|
for (const error of log) {
|
||||||
|
error.level = error.level.toLowerCase() as LoggedError["level"];
|
||||||
|
}
|
||||||
|
return log;
|
||||||
|
};
|
||||||
|
|
||||||
export const getLoggedErrorIntegration = (item: LoggedError) => {
|
export const getLoggedErrorIntegration = (item: LoggedError) => {
|
||||||
// Try to derive from logger name
|
// Try to derive from logger name
|
||||||
|
@ -72,10 +72,8 @@ class DialogSystemLogDetail extends LitElement {
|
|||||||
const title = this.hass.localize(
|
const title = this.hass.localize(
|
||||||
"ui.panel.config.logs.details",
|
"ui.panel.config.logs.details",
|
||||||
"level",
|
"level",
|
||||||
html`<span class=${item.level.toLowerCase()}
|
html`<span class=${item.level}
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}</span
|
||||||
`ui.panel.config.logs.level.${item.level.toLowerCase()}`
|
|
||||||
)}</span
|
|
||||||
>`
|
>`
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -104,9 +104,9 @@ export class SystemLogCard extends LitElement {
|
|||||||
<div class="row">${item.message[0]}</div>
|
<div class="row">${item.message[0]}</div>
|
||||||
<div class="row-secondary" secondary>
|
<div class="row-secondary" secondary>
|
||||||
${this._timestamp(item)} –
|
${this._timestamp(item)} –
|
||||||
${html`(<span class=${item.level.toLowerCase()}
|
${html`(<span class=${item.level}
|
||||||
>${this.hass.localize(
|
>${this.hass.localize(
|
||||||
`ui.panel.config.logs.level.${item.level.toLowerCase()}`
|
`ui.panel.config.logs.level.${item.level}`
|
||||||
)}</span
|
)}</span
|
||||||
>) `}
|
>) `}
|
||||||
${integrations[idx]
|
${integrations[idx]
|
||||||
|
@ -229,7 +229,7 @@ class ConfigUrlForm extends LitElement {
|
|||||||
? "info"
|
? "info"
|
||||||
: "warning"}
|
: "warning"}
|
||||||
.title=${this.hass.localize(
|
.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(
|
${this.hass.localize(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user