mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Fixes for problems caused by not rebuilding (#5850)
This commit is contained in:
parent
4c0810f530
commit
b2af91c83e
@ -15,9 +15,14 @@ import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||
import "../components/hui-generic-entity-row";
|
||||
import "../components/hui-timestamp-display";
|
||||
import "../components/hui-warning";
|
||||
import { EntityConfig, LovelaceRow } from "./types";
|
||||
import { LovelaceRow } from "./types";
|
||||
import { EntitiesCardEntityConfig } from "../cards/types";
|
||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||
import { hasAction } from "../common/has-action";
|
||||
import { ActionHandlerEvent } from "../../../data/lovelace";
|
||||
import { handleAction } from "../common/handle-action";
|
||||
|
||||
interface SensorEntityConfig extends EntityConfig {
|
||||
interface SensorEntityConfig extends EntitiesCardEntityConfig {
|
||||
format?: "relative" | "date" | "time" | "datetime";
|
||||
}
|
||||
|
||||
@ -59,7 +64,14 @@ class HuiSensorEntityRow extends LitElement implements LovelaceRow {
|
||||
|
||||
return html`
|
||||
<hui-generic-entity-row .hass=${this.hass} .config=${this._config}>
|
||||
<div class="text-content">
|
||||
<div
|
||||
class="text-content"
|
||||
@action=${this._handleAction}
|
||||
.actionHandler=${actionHandler({
|
||||
hasHold: hasAction(this._config.hold_action),
|
||||
hasDoubleClick: hasAction(this._config.double_tap_action),
|
||||
})}
|
||||
>
|
||||
${stateObj.attributes.device_class ===
|
||||
SENSOR_DEVICE_CLASS_TIMESTAMP &&
|
||||
stateObj.state !== "unavailable" &&
|
||||
@ -81,6 +93,10 @@ class HuiSensorEntityRow extends LitElement implements LovelaceRow {
|
||||
`;
|
||||
}
|
||||
|
||||
private _handleAction(ev: ActionHandlerEvent) {
|
||||
handleAction(this, this.hass!, this._config!, ev.detail.action);
|
||||
}
|
||||
|
||||
static get styles(): CSSResult {
|
||||
return css`
|
||||
div {
|
||||
|
@ -424,18 +424,24 @@ class HUIRoot extends LitElement {
|
||||
}
|
||||
|
||||
if (!oldLovelace || oldLovelace.editMode !== this.lovelace!.editMode) {
|
||||
const views = this.config && this.config.views;
|
||||
|
||||
// Adjust for higher header
|
||||
if (!views || views.length < 2) {
|
||||
fireEvent(this, "iron-resize");
|
||||
}
|
||||
|
||||
// Leave unused entities when leaving edit mode
|
||||
if (
|
||||
this.lovelace!.mode === "storage" &&
|
||||
viewPath === "hass-unused-entities"
|
||||
) {
|
||||
const views = this.config && this.config.views;
|
||||
navigate(this, `${this.route?.prefix}/${views[0]?.path || 0}`);
|
||||
newSelectView = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (!force) {
|
||||
if (!force && huiView) {
|
||||
huiView.lovelace = this.lovelace;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user