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 {
|
||||
EDITABLE_DOMAINS_WITH_ID,
|
||||
EDITABLE_DOMAINS,
|
||||
DOMAINS_MORE_INFO_NO_HISTORY,
|
||||
DOMAINS_WITH_MORE_INFO,
|
||||
computeShowHistoryComponent,
|
||||
computeShowLogBookComponent,
|
||||
} from "./const";
|
||||
import "./controls/more-info-default";
|
||||
import "./ha-more-info-info";
|
||||
@ -47,13 +49,11 @@ export class MoreInfoDialog extends LitElement {
|
||||
|
||||
public showDialog(params: MoreInfoDialogParams) {
|
||||
this._entityId = params.entityId;
|
||||
if (params.tab) {
|
||||
this._currTab = params.tab;
|
||||
}
|
||||
if (!this._entityId) {
|
||||
this.closeDialog();
|
||||
return;
|
||||
}
|
||||
this._currTab = params.tab || "info";
|
||||
this.large = false;
|
||||
}
|
||||
|
||||
@ -216,7 +216,13 @@ export class MoreInfoDialog extends LitElement {
|
||||
const domain = computeDomain(entityId);
|
||||
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");
|
||||
}
|
||||
|
||||
@ -299,10 +305,6 @@ export class MoreInfoDialog extends LitElement {
|
||||
--mdc-dialog-max-height: calc(100% - 72px);
|
||||
}
|
||||
|
||||
ha-icon-button[slot="navigationIcon"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.main-title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
@ -319,13 +321,6 @@ export class MoreInfoDialog extends LitElement {
|
||||
ha-dialog[data-domain="camera"] {
|
||||
--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 { computeDomain } from "../../common/entity/compute_domain";
|
||||
import { removeEntityRegistryEntry } from "../../data/entity_registry";
|
||||
import type { HomeAssistant } from "../../types";
|
||||
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-logbook";
|
||||
|
||||
@ -29,6 +34,20 @@ export class MoreInfoInfo extends LitElement {
|
||||
.hass=${this.hass}
|
||||
></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
|
||||
.stateObj=${stateObj}
|
||||
.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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user