mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +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.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}`
|
||||
|
@ -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<LoggedError[]>({ type: "system_log/list" });
|
||||
export const fetchSystemLog = async (hass: HomeAssistant) => {
|
||||
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) => {
|
||||
// Try to derive from logger name
|
||||
|
@ -72,10 +72,8 @@ class DialogSystemLogDetail extends LitElement {
|
||||
const title = this.hass.localize(
|
||||
"ui.panel.config.logs.details",
|
||||
"level",
|
||||
html`<span class=${item.level.toLowerCase()}
|
||||
>${this.hass.localize(
|
||||
`ui.panel.config.logs.level.${item.level.toLowerCase()}`
|
||||
)}</span
|
||||
html`<span class=${item.level}
|
||||
>${this.hass.localize(`ui.panel.config.logs.level.${item.level}`)}</span
|
||||
>`
|
||||
);
|
||||
|
||||
|
@ -104,9 +104,9 @@ export class SystemLogCard extends LitElement {
|
||||
<div class="row">${item.message[0]}</div>
|
||||
<div class="row-secondary" secondary>
|
||||
${this._timestamp(item)} –
|
||||
${html`(<span class=${item.level.toLowerCase()}
|
||||
${html`(<span class=${item.level}
|
||||
>${this.hass.localize(
|
||||
`ui.panel.config.logs.level.${item.level.toLowerCase()}`
|
||||
`ui.panel.config.logs.level.${item.level}`
|
||||
)}</span
|
||||
>) `}
|
||||
${integrations[idx]
|
||||
|
@ -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(
|
||||
|
Loading…
x
Reference in New Issue
Block a user