diff --git a/src/panels/config/devices/ha-config-device-page.ts b/src/panels/config/devices/ha-config-device-page.ts index 7b3849ec665a..1a9809b9b68a 100644 --- a/src/panels/config/devices/ha-config-device-page.ts +++ b/src/panels/config/devices/ha-config-device-page.ts @@ -1,6 +1,5 @@ import { consume } from "@lit-labs/context"; import "@lrnwebcomponents/simple-tooltip/simple-tooltip"; -import "@material/mwc-list/mwc-list-item"; import { mdiCog, mdiDelete, @@ -10,8 +9,6 @@ import { mdiPencil, mdiPlusCircle, } from "@mdi/js"; -import "@polymer/paper-item/paper-item"; -import "@polymer/paper-item/paper-item-body"; import { CSSResultGroup, LitElement, @@ -24,7 +21,7 @@ import { customElement, property, state } from "lit/decorators"; import { ifDefined } from "lit/directives/if-defined"; import memoizeOne from "memoize-one"; import { isComponentLoaded } from "../../../common/config/is_component_loaded"; -import { SENSOR_ENTITIES, ASSIST_ENTITIES } from "../../../common/const"; +import { ASSIST_ENTITIES, SENSOR_ENTITIES } from "../../../common/const"; import { computeDomain } from "../../../common/entity/compute_domain"; import { computeStateDomain } from "../../../common/entity/compute_state_domain"; import { computeStateName } from "../../../common/entity/compute_state_name"; @@ -77,7 +74,6 @@ import type { HomeAssistant } from "../../../types"; import { brandsUrl } from "../../../util/brands-url"; import { fileDownload } from "../../../util/file_download"; import "../../logbook/ha-logbook"; -import "../ha-config-section"; import "./device-detail/ha-device-entities-card"; import "./device-detail/ha-device-info-card"; import "./device-detail/ha-device-via-devices-card"; @@ -665,269 +661,235 @@ export class HaConfigDevicePage extends LitElement { ` : ""; - return html` - - - + +
+
+ ${area + ? html`` + : ""} +
+ ${battery && + (batteryDomain === "binary_sensor" || !isNaN(battery.state as any)) + ? html` +
+ ${batteryDomain === "sensor" + ? this.hass.formatEntityState(battery) + : nothing} + +
+ ` + : ""} + ${integrations.length + ? html` + ${domainToName( + ` + : ""} +
+
+
+ ${this._deviceAlerts?.length + ? html` +
+ ${this._deviceAlerts.map( + (alert) => html` + + ${alert.text} + + ` )} - > -
-
- ${ - area - ? html`` - : "" - } -
- ${ - battery && - (batteryDomain === "binary_sensor" || - !isNaN(battery.state as any)) - ? html` -
- ${batteryDomain === "sensor" - ? this.hass.formatEntityState(battery) - : nothing} - -
- ` - : "" - } - ${ - integrations.length - ? html` - ${domainToName( - ` - : "" - } -
-
-
- ${ - this._deviceAlerts?.length - ? html` -
- ${this._deviceAlerts.map( - (alert) => html` - - ${alert.text} - - ` + ` + : ""} + + ${deviceInfo} + ${firstDeviceAction || actions.length + ? html` +
+
+ - ` - : "" - } - - ${deviceInfo} - ${ - firstDeviceAction || actions.length - ? html` -
- + + ${actions.length + ? html` + + + ${actions.map((deviceAction) => { + const listItem = html` - ${firstDeviceAction!.label} - ${firstDeviceAction!.icon + ${deviceAction.label} + ${deviceAction.icon ? html` ` : ""} - ${firstDeviceAction!.trailingIcon + ${deviceAction.trailingIcon ? html` ` : ""} - - -
- - ${actions.length - ? html` - - `; + return deviceAction.href + ? html` - ${actions.map((deviceAction) => { - const listItem = html` - ${deviceAction.label} - ${deviceAction.icon - ? html` - - ` - : ""} - ${deviceAction.trailingIcon - ? html` - - ` - : ""} - `; - return deviceAction.href - ? html`${listItem} - ` - : listItem; - })} - - ` - : ""} -
- ` - : "" - } - - ${!this.narrow ? [automationCard, sceneCard, scriptCard] : ""} -
-
- ${( - [ - "control", - "sensor", - "notify", - "event", - "assist", - "config", - "diagnostic", - ] as const - ).map((category) => - // Make sure we render controls if no other cards will be rendered - entitiesByCategory[category].length > 0 || - (entities.length === 0 && category === "control") - ? html` - - - ` - : "" - )} - -
-
- ${this.narrow ? [automationCard, sceneCard, scriptCard] : ""} - ${ - isComponentLoaded(this.hass, "logbook") - ? html` - -

- ${this.hass.localize("panel.logbook")} -

- -
- ` - : "" - } -
-
- - `; + >${listItem} + ` + : listItem; + })} + + ` + : ""} +
+ ` + : ""} + + ${!this.narrow ? [automationCard, sceneCard, scriptCard] : ""} +
+
+ ${( + [ + "control", + "sensor", + "notify", + "event", + "assist", + "config", + "diagnostic", + ] as const + ).map((category) => + // Make sure we render controls if no other cards will be rendered + entitiesByCategory[category].length > 0 || + (entities.length === 0 && category === "control") + ? html` + + + ` + : "" + )} + +
+
+ ${this.narrow ? [automationCard, sceneCard, scriptCard] : ""} + ${isComponentLoaded(this.hass, "logbook") + ? html` + +

+ ${this.hass.localize("panel.logbook")} +

+ +
+ ` + : ""} +
+
+ `; } private async _getDiagnosticButtons(requestId: number): Promise {