mirror of
https://github.com/home-assistant/frontend.git
synced 2025-04-28 07:17:21 +00:00
parent
cce0a02ebb
commit
792a736e48
@ -102,7 +102,7 @@ class PanelDeveloperTools extends LitElement {
|
|||||||
}
|
}
|
||||||
developer-tools-router {
|
developer-tools-router {
|
||||||
display: block;
|
display: block;
|
||||||
height: calc(100vh - 112px);
|
height: calc(100vh - 104px);
|
||||||
}
|
}
|
||||||
ha-tabs {
|
ha-tabs {
|
||||||
margin-left: max(env(safe-area-inset-left), 24px);
|
margin-left: max(env(safe-area-inset-left), 24px);
|
||||||
|
@ -2,6 +2,7 @@ import "@material/mwc-button/mwc-button";
|
|||||||
import { HassEntity } from "home-assistant-js-websocket";
|
import { HassEntity } from "home-assistant-js-websocket";
|
||||||
import { css, CSSResultGroup, html, LitElement } from "lit";
|
import { css, CSSResultGroup, html, LitElement } from "lit";
|
||||||
import { customElement, property, state } from "lit/decorators";
|
import { customElement, property, state } from "lit/decorators";
|
||||||
|
import memoizeOne from "memoize-one";
|
||||||
import { fireEvent } from "../../../common/dom/fire_event";
|
import { fireEvent } from "../../../common/dom/fire_event";
|
||||||
import { computeStateName } from "../../../common/entity/compute_state_name";
|
import { computeStateName } from "../../../common/entity/compute_state_name";
|
||||||
import "../../../components/data-table/ha-data-table";
|
import "../../../components/data-table/ha-data-table";
|
||||||
@ -32,63 +33,70 @@ class HaPanelDevStatistics extends LitElement {
|
|||||||
this._validateStatistics();
|
this._validateStatistics();
|
||||||
}
|
}
|
||||||
|
|
||||||
private _columns: DataTableColumnContainer = {
|
/* eslint-disable lit/no-template-arrow */
|
||||||
state: {
|
private _columns = memoizeOne(
|
||||||
title: "Entity",
|
(localize): DataTableColumnContainer => ({
|
||||||
sortable: true,
|
state: {
|
||||||
filterable: true,
|
title: "Entity",
|
||||||
grows: true,
|
sortable: true,
|
||||||
template: (entityState, data: any) =>
|
filterable: true,
|
||||||
html`${entityState
|
grows: true,
|
||||||
? computeStateName(entityState)
|
template: (entityState, data: any) =>
|
||||||
: data.statistic_id}`,
|
html`${entityState
|
||||||
},
|
? computeStateName(entityState)
|
||||||
statistic_id: {
|
: data.statistic_id}`,
|
||||||
title: "Statistic id",
|
},
|
||||||
sortable: true,
|
statistic_id: {
|
||||||
filterable: true,
|
title: "Statistic id",
|
||||||
hidden: this.narrow,
|
sortable: true,
|
||||||
width: "30%",
|
filterable: true,
|
||||||
},
|
hidden: this.narrow,
|
||||||
unit_of_measurement: {
|
width: "30%",
|
||||||
title: "Unit",
|
},
|
||||||
sortable: true,
|
unit_of_measurement: {
|
||||||
filterable: true,
|
title: "Unit",
|
||||||
width: "10%",
|
sortable: true,
|
||||||
},
|
filterable: true,
|
||||||
issues: {
|
width: "10%",
|
||||||
title: "Issue",
|
},
|
||||||
sortable: true,
|
issues: {
|
||||||
filterable: true,
|
title: "Issue",
|
||||||
direction: "asc",
|
sortable: true,
|
||||||
width: "30%",
|
filterable: true,
|
||||||
template: (issues) =>
|
direction: "asc",
|
||||||
html`${issues
|
width: "30%",
|
||||||
? issues.map(
|
template: (issues) =>
|
||||||
(issue) =>
|
html`${issues
|
||||||
this.hass.localize(
|
? issues.map(
|
||||||
`ui.panel.developer-tools.tabs.statistics.issues.${issue.type}`,
|
(issue) =>
|
||||||
issue.data
|
localize(
|
||||||
) || issue.type
|
`ui.panel.developer-tools.tabs.statistics.issues.${issue.type}`,
|
||||||
)
|
issue.data
|
||||||
: ""}`,
|
) || issue.type
|
||||||
},
|
)
|
||||||
fix: {
|
: ""}`,
|
||||||
title: "",
|
},
|
||||||
template: (_, data: any) =>
|
fix: {
|
||||||
html`${data.issues
|
title: "",
|
||||||
? html`<mwc-button @click=${this._fixIssue} .data=${data.issues}
|
template: (_, data: any) =>
|
||||||
>Fix issue</mwc-button
|
html`${data.issues
|
||||||
>`
|
? html`<mwc-button
|
||||||
: ""}`,
|
@click=${(ev) => this._fixIssue(ev)}
|
||||||
width: "113px",
|
.data=${data.issues}
|
||||||
},
|
>
|
||||||
};
|
Fix issue
|
||||||
|
</mwc-button>`
|
||||||
|
: ""}`,
|
||||||
|
width: "113px",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
);
|
||||||
|
/* eslint-enable lit/no-template-arrow */
|
||||||
|
|
||||||
protected render() {
|
protected render() {
|
||||||
return html`
|
return html`
|
||||||
<ha-data-table
|
<ha-data-table
|
||||||
.columns=${this._columns}
|
.columns=${this._columns(this.hass.localize)}
|
||||||
.data=${this._data}
|
.data=${this._data}
|
||||||
noDataText="No issues found!"
|
noDataText="No issues found!"
|
||||||
id="statistic_id"
|
id="statistic_id"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user