Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/dialogs/more-info/controls/more-info-automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class MoreInfoAutomation extends LitElement {
justify-content: space-between;
}
.actions {
margin: 36px 0 8px 0;
margin: 8px 0;
text-align: right;
}
`;
Expand Down
30 changes: 22 additions & 8 deletions src/dialogs/more-info/ha-more-info-dialog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,19 @@ import { haStyleDialog } from "../../resources/styles";
import "../../state-summary/state-card-content";
import { HomeAssistant } from "../../types";
import { showConfirmationDialog } from "../generic/show-dialog-box";
import "./ha-more-info-history";
import "./more-info-content";

const DOMAINS_NO_INFO = ["camera", "configurator"];
const CONTROL_DOMAINS = [
"light",
"media_player",
"vacuum",
"alarm_control_panel",
"climate",
"humidifier",
"weather",
];
const EDITABLE_DOMAINS_WITH_ID = ["scene", "automation"];
const EDITABLE_DOMAINS = ["script"];

Expand Down Expand Up @@ -127,15 +137,16 @@ export class MoreInfoDialog extends LitElement {
`
: ""}
</ha-header-bar>
${this._computeShowHistoryComponent(entityId)
${CONTROL_DOMAINS.includes(domain) &&
this._computeShowHistoryComponent(entityId)
? html`
<mwc-tab-bar
.activeIndex=${this._currTabIndex}
@MDCTabBar:activated=${this._handleTabChanged}
>
<mwc-tab
.label=${this.hass.localize(
"ui.dialogs.more_info_control.controls"
"ui.dialogs.more_info_control.details"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its not just details though... But I guess this works :)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fine until we change the names of entities 😉 then I think we should change it to match what they are.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or we could make it Entity for now until we change the naming

)}
></mwc-tab>
<mwc-tab
Expand Down Expand Up @@ -164,6 +175,13 @@ export class MoreInfoDialog extends LitElement {
.stateObj=${stateObj}
.hass=${this.hass}
></more-info-content>
${!CONTROL_DOMAINS.includes(domain) ||
!this._computeShowHistoryComponent(entityId)
? ""
: html`<ha-more-info-history
.hass=${this.hass}
.entityId=${this._entityId}
></ha-more-info-history>`}
${stateObj.attributes.restored
? html`
<p>
Expand All @@ -188,21 +206,17 @@ export class MoreInfoDialog extends LitElement {
: ""}
`
: html`
<ha-more-info-tab-history
<ha-more-info-history
.hass=${this.hass}
.entityId=${this._entityId}
></ha-more-info-tab-history>
></ha-more-info-history>
`
)}
</div>
</ha-dialog>
`;
}

protected firstUpdated(): void {
import("./ha-more-info-tab-history");
}

private _enlarge() {
this.large = !this.large;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ import { getRecentWithCache } from "../../data/cached-history";
import { HistoryResult } from "../../data/history";
import { getLogbookData, LogbookEntry } from "../../data/logbook";
import "../../panels/logbook/ha-logbook";
import { haStyleDialog } from "../../resources/styles";
import { haStyle } from "../../resources/styles";
import { HomeAssistant } from "../../types";

@customElement("ha-more-info-tab-history")
export class MoreInfoTabHistoryDialog extends LitElement {
@customElement("ha-more-info-history")
export class MoreInfoHistory extends LitElement {
@property({ attribute: false }) public hass!: HomeAssistant;

@property() public entityId!: string;
Expand All @@ -43,8 +43,7 @@ export class MoreInfoTabHistoryDialog extends LitElement {
return html``;
}

return html`
<state-history-charts
return html`<state-history-charts
up-to-now
.hass=${this.hass}
.historyData=${this._stateHistory}
Expand All @@ -71,8 +70,9 @@ export class MoreInfoTabHistoryDialog extends LitElement {
.userIdToName=${this._persons}
></ha-logbook>
`
: ""}
`;
: html`<div class="no-entries">
${this.hass.localize("ui.components.logbook.entries_not_found")}
</div>`}`;
}

protected firstUpdated(): void {
Expand Down Expand Up @@ -139,13 +139,16 @@ export class MoreInfoTabHistoryDialog extends LitElement {

static get styles() {
return [
haStyleDialog,
haStyle,
css`
state-history-charts {
display: block;
margin-bottom: 16px;
}

.no-entries {
text-align: center;
padding: 16px;
}
ha-logbook {
max-height: 360px;
}
Expand All @@ -161,6 +164,6 @@ export class MoreInfoTabHistoryDialog extends LitElement {

declare global {
interface HTMLElementTagNameMap {
"ha-more-info-tab-history": MoreInfoTabHistoryDialog;
"ha-more-info-history": MoreInfoHistory;
}
}
2 changes: 1 addition & 1 deletion src/panels/logbook/ha-logbook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ class HaLogbook extends LitElement {
if (!this.entries?.length) {
return html`
<div class="container no-entries" .dir=${emitRTLDirection(this._rtl)}>
${this.hass.localize("ui.panel.logbook.entries_not_found")}
${this.hass.localize("ui.components.logbook.entries_not_found")}
</div>
`;
}
Expand Down
6 changes: 4 additions & 2 deletions src/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@
"error_required": "Required"
},
"components": {
"logbook": {
"entries_not_found": "No logbook entries found."
},
"entity": {
"entity-picker": {
"entity": "Entity",
Expand Down Expand Up @@ -401,7 +404,7 @@
"dismiss": "Dismiss dialog",
"settings": "Entity settings",
"edit": "Edit entity",
"controls": "Controls",
"details": "Details",
"history": "History",
"script": {
"last_action": "Last Action",
Expand Down Expand Up @@ -2045,7 +2048,6 @@
}
},
"logbook": {
"entries_not_found": "No logbook entries found.",
"ranges": {
"today": "Today",
"yesterday": "Yesterday",
Expand Down