mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Merge more info "info" and "history" like before (#13425)
This commit is contained in:
parent
9ed0cb3011
commit
dfface6904
@ -20,7 +20,9 @@ import { HomeAssistant } from "../../types";
|
|||||||
import {
|
import {
|
||||||
EDITABLE_DOMAINS_WITH_ID,
|
EDITABLE_DOMAINS_WITH_ID,
|
||||||
EDITABLE_DOMAINS,
|
EDITABLE_DOMAINS,
|
||||||
DOMAINS_MORE_INFO_NO_HISTORY,
|
DOMAINS_WITH_MORE_INFO,
|
||||||
|
computeShowHistoryComponent,
|
||||||
|
computeShowLogBookComponent,
|
||||||
} from "./const";
|
} from "./const";
|
||||||
import "./controls/more-info-default";
|
import "./controls/more-info-default";
|
||||||
import "./ha-more-info-info";
|
import "./ha-more-info-info";
|
||||||
@ -47,13 +49,11 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
|
|
||||||
public showDialog(params: MoreInfoDialogParams) {
|
public showDialog(params: MoreInfoDialogParams) {
|
||||||
this._entityId = params.entityId;
|
this._entityId = params.entityId;
|
||||||
if (params.tab) {
|
|
||||||
this._currTab = params.tab;
|
|
||||||
}
|
|
||||||
if (!this._entityId) {
|
if (!this._entityId) {
|
||||||
this.closeDialog();
|
this.closeDialog();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
this._currTab = params.tab || "info";
|
||||||
this.large = false;
|
this.large = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -216,7 +216,13 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
const domain = computeDomain(entityId);
|
const domain = computeDomain(entityId);
|
||||||
const tabs: Tab[] = ["info"];
|
const tabs: Tab[] = ["info"];
|
||||||
|
|
||||||
if (!DOMAINS_MORE_INFO_NO_HISTORY.includes(domain)) {
|
// Info and history are combined in info when there are no
|
||||||
|
// dedicated more-info controls. If not combined, add a history tab.
|
||||||
|
if (
|
||||||
|
DOMAINS_WITH_MORE_INFO.includes(domain) &&
|
||||||
|
(computeShowHistoryComponent(this.hass, entityId) ||
|
||||||
|
computeShowLogBookComponent(this.hass, entityId))
|
||||||
|
) {
|
||||||
tabs.push("history");
|
tabs.push("history");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -299,10 +305,6 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
--mdc-dialog-max-height: calc(100% - 72px);
|
--mdc-dialog-max-height: calc(100% - 72px);
|
||||||
}
|
}
|
||||||
|
|
||||||
ha-icon-button[slot="navigationIcon"] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.main-title {
|
.main-title {
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
@ -319,13 +321,6 @@ export class MoreInfoDialog extends LitElement {
|
|||||||
ha-dialog[data-domain="camera"] {
|
ha-dialog[data-domain="camera"] {
|
||||||
--dialog-content-padding: 0;
|
--dialog-content-padding: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
state-card-content,
|
|
||||||
ha-more-info-history,
|
|
||||||
ha-more-info-logbook:not(:last-child) {
|
|
||||||
display: block;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
}
|
|
||||||
`,
|
`,
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -1,10 +1,15 @@
|
|||||||
import { LitElement, html } from "lit";
|
import { LitElement, html, css } from "lit";
|
||||||
import { customElement, property } from "lit/decorators";
|
import { customElement, property } from "lit/decorators";
|
||||||
import { computeDomain } from "../../common/entity/compute_domain";
|
import { computeDomain } from "../../common/entity/compute_domain";
|
||||||
import { removeEntityRegistryEntry } from "../../data/entity_registry";
|
import { removeEntityRegistryEntry } from "../../data/entity_registry";
|
||||||
import type { HomeAssistant } from "../../types";
|
import type { HomeAssistant } from "../../types";
|
||||||
import { showConfirmationDialog } from "../generic/show-dialog-box";
|
import { showConfirmationDialog } from "../generic/show-dialog-box";
|
||||||
import { DOMAINS_NO_INFO } from "./const";
|
import {
|
||||||
|
computeShowHistoryComponent,
|
||||||
|
computeShowLogBookComponent,
|
||||||
|
DOMAINS_NO_INFO,
|
||||||
|
DOMAINS_WITH_MORE_INFO,
|
||||||
|
} from "./const";
|
||||||
import "./ha-more-info-history";
|
import "./ha-more-info-history";
|
||||||
import "./ha-more-info-logbook";
|
import "./ha-more-info-logbook";
|
||||||
|
|
||||||
@ -29,6 +34,20 @@ export class MoreInfoInfo extends LitElement {
|
|||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
></state-card-content>
|
></state-card-content>
|
||||||
`}
|
`}
|
||||||
|
${DOMAINS_WITH_MORE_INFO.includes(domain) ||
|
||||||
|
!computeShowHistoryComponent(this.hass, entityId)
|
||||||
|
? ""
|
||||||
|
: html`<ha-more-info-history
|
||||||
|
.hass=${this.hass}
|
||||||
|
.entityId=${this.entityId}
|
||||||
|
></ha-more-info-history>`}
|
||||||
|
${DOMAINS_WITH_MORE_INFO.includes(domain) ||
|
||||||
|
!computeShowLogBookComponent(this.hass, entityId)
|
||||||
|
? ""
|
||||||
|
: html`<ha-more-info-logbook
|
||||||
|
.hass=${this.hass}
|
||||||
|
.entityId=${this.entityId}
|
||||||
|
></ha-more-info-logbook>`}
|
||||||
<more-info-content
|
<more-info-content
|
||||||
.stateObj=${stateObj}
|
.stateObj=${stateObj}
|
||||||
.hass=${this.hass}
|
.hass=${this.hass}
|
||||||
@ -71,6 +90,17 @@ export class MoreInfoInfo extends LitElement {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static get styles() {
|
||||||
|
return css`
|
||||||
|
state-card-content,
|
||||||
|
ha-more-info-history,
|
||||||
|
ha-more-info-logbook:not(:last-child) {
|
||||||
|
display: block;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
}
|
||||||
|
`;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
declare global {
|
declare global {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user