mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Merge pull request #6426 from yosilevy/Logbook-link-fix
Logbook link fix
This commit is contained in:
commit
11827aa4c0
@ -9,5 +9,9 @@ export function computeRTL(hass: HomeAssistant) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function computeRTLDirection(hass: HomeAssistant) {
|
export function computeRTLDirection(hass: HomeAssistant) {
|
||||||
return computeRTL(hass) ? "rtl" : "ltr";
|
return emitRTLDirection(computeRTL(hass));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function emitRTLDirection(rtl: boolean) {
|
||||||
|
return rtl ? "rtl" : "ltr";
|
||||||
}
|
}
|
||||||
|
@ -14,7 +14,7 @@ import { formatTimeWithSeconds } from "../../common/datetime/format_time";
|
|||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
import { domainIcon } from "../../common/entity/domain_icon";
|
import { domainIcon } from "../../common/entity/domain_icon";
|
||||||
import { stateIcon } from "../../common/entity/state_icon";
|
import { stateIcon } from "../../common/entity/state_icon";
|
||||||
import { computeRTL } from "../../common/util/compute_rtl";
|
import { computeRTL, emitRTLDirection } from "../../common/util/compute_rtl";
|
||||||
import "../../components/ha-icon";
|
import "../../components/ha-icon";
|
||||||
import { LogbookEntry } from "../../data/logbook";
|
import { LogbookEntry } from "../../data/logbook";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
@ -28,7 +28,6 @@ class HaLogbook extends LitElement {
|
|||||||
@property() public entries: LogbookEntry[] = [];
|
@property() public entries: LogbookEntry[] = [];
|
||||||
|
|
||||||
@property({ attribute: "rtl", type: Boolean, reflect: true })
|
@property({ attribute: "rtl", type: Boolean, reflect: true })
|
||||||
// @ts-ignore
|
|
||||||
private _rtl = false;
|
private _rtl = false;
|
||||||
|
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
@ -38,17 +37,22 @@ class HaLogbook extends LitElement {
|
|||||||
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
const oldHass = changedProps.get("hass") as HomeAssistant | undefined;
|
||||||
const languageChanged =
|
const languageChanged =
|
||||||
oldHass === undefined || oldHass.language !== this.hass.language;
|
oldHass === undefined || oldHass.language !== this.hass.language;
|
||||||
|
|
||||||
return changedProps.has("entries") || languageChanged;
|
return changedProps.has("entries") || languageChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected updated(_changedProps: PropertyValues) {
|
protected updated(_changedProps: PropertyValues) {
|
||||||
|
const oldHass = _changedProps.get("hass") as HomeAssistant | undefined;
|
||||||
|
|
||||||
|
if (oldHass === undefined || oldHass.language !== this.hass.language) {
|
||||||
this._rtl = computeRTL(this.hass);
|
this._rtl = computeRTL(this.hass);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
protected render(): TemplateResult {
|
protected render(): TemplateResult {
|
||||||
if (!this.entries?.length) {
|
if (!this.entries?.length) {
|
||||||
return html`
|
return html`
|
||||||
<div class="container">
|
<div class="container" .dir=${emitRTLDirection(this._rtl)}>
|
||||||
${this.hass.localize("ui.panel.logbook.entries_not_found")}
|
${this.hass.localize("ui.panel.logbook.entries_not_found")}
|
||||||
</div>
|
</div>
|
||||||
`;
|
`;
|
||||||
@ -106,9 +110,8 @@ class HaLogbook extends LitElement {
|
|||||||
@click=${this._entityClicked}
|
@click=${this._entityClicked}
|
||||||
.entityId=${item.entity_id}
|
.entityId=${item.entity_id}
|
||||||
class="name"
|
class="name"
|
||||||
|
>${item.name}</a
|
||||||
>
|
>
|
||||||
${item.name}
|
|
||||||
</a>
|
|
||||||
`}
|
`}
|
||||||
<span
|
<span
|
||||||
>${item.message}${item_username
|
>${item.message}${item_username
|
||||||
|
Loading…
x
Reference in New Issue
Block a user