mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-14 12:56:37 +00:00
add floor column to datatable in config devices page (#26103)
* add floor column to datatable in config devices page * refactor conditions related to floor column in config devices page
This commit is contained in:
parent
e7e062a222
commit
fc104a7992
@ -19,6 +19,7 @@ import { formatShortDateTime } from "../../../common/datetime/format_date_time";
|
|||||||
import { storage } from "../../../common/decorators/storage";
|
import { storage } from "../../../common/decorators/storage";
|
||||||
import type { HASSDomEvent } from "../../../common/dom/fire_event";
|
import type { HASSDomEvent } from "../../../common/dom/fire_event";
|
||||||
import { computeDeviceNameDisplay } from "../../../common/entity/compute_device_name";
|
import { computeDeviceNameDisplay } from "../../../common/entity/compute_device_name";
|
||||||
|
import { computeFloorName } from "../../../common/entity/compute_floor_name";
|
||||||
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
import { computeStateDomain } from "../../../common/entity/compute_state_domain";
|
||||||
import {
|
import {
|
||||||
PROTOCOL_INTEGRATIONS,
|
PROTOCOL_INTEGRATIONS,
|
||||||
@ -424,6 +425,18 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
|
|||||||
(lbl) => labelReg!.find((label) => label.label_id === lbl)!
|
(lbl) => labelReg!.find((label) => label.label_id === lbl)!
|
||||||
);
|
);
|
||||||
|
|
||||||
|
let floorName = "—";
|
||||||
|
if (
|
||||||
|
device.area_id &&
|
||||||
|
areas[device.area_id]?.floor_id &&
|
||||||
|
this.hass.floors
|
||||||
|
) {
|
||||||
|
const floorId = areas[device.area_id].floor_id;
|
||||||
|
if (this.hass.floors[floorId!]) {
|
||||||
|
floorName = computeFloorName(this.hass.floors[floorId!]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...device,
|
...device,
|
||||||
name: computeDeviceNameDisplay(
|
name: computeDeviceNameDisplay(
|
||||||
@ -441,6 +454,7 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
|
|||||||
device.area_id && areas[device.area_id]
|
device.area_id && areas[device.area_id]
|
||||||
? areas[device.area_id].name
|
? areas[device.area_id].name
|
||||||
: "—",
|
: "—",
|
||||||
|
floor: floorName,
|
||||||
integration: deviceEntries.length
|
integration: deviceEntries.length
|
||||||
? deviceEntries
|
? deviceEntries
|
||||||
.map(
|
.map(
|
||||||
@ -524,6 +538,14 @@ export class HaConfigDeviceDashboard extends SubscribeMixin(LitElement) {
|
|||||||
groupable: true,
|
groupable: true,
|
||||||
minWidth: "120px",
|
minWidth: "120px",
|
||||||
},
|
},
|
||||||
|
floor: {
|
||||||
|
title: localize("ui.panel.config.devices.data_table.floor"),
|
||||||
|
sortable: true,
|
||||||
|
filterable: true,
|
||||||
|
groupable: true,
|
||||||
|
minWidth: "120px",
|
||||||
|
defaultHidden: true,
|
||||||
|
},
|
||||||
integration: {
|
integration: {
|
||||||
title: localize("ui.panel.config.devices.data_table.integration"),
|
title: localize("ui.panel.config.devices.data_table.integration"),
|
||||||
sortable: true,
|
sortable: true,
|
||||||
|
@ -5138,6 +5138,7 @@
|
|||||||
"manufacturer": "Manufacturer",
|
"manufacturer": "Manufacturer",
|
||||||
"model": "Model",
|
"model": "Model",
|
||||||
"area": "Area",
|
"area": "Area",
|
||||||
|
"floor": "Floor",
|
||||||
"integration": "Integration",
|
"integration": "Integration",
|
||||||
"battery": "Battery",
|
"battery": "Battery",
|
||||||
"disabled_by": "Disabled",
|
"disabled_by": "Disabled",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user