mirror of
https://github.com/home-assistant/frontend.git
synced 2025-12-24 04:39:01 +00:00
Automation add TCA: fix narrow subtitles & icons (#28291)
This commit is contained in:
@@ -726,15 +726,26 @@ class DialogAddAutomationElement
|
|||||||
);
|
);
|
||||||
|
|
||||||
if (targetId) {
|
if (targetId) {
|
||||||
if (targetType === "area" && this.hass.areas[targetId]?.floor_id) {
|
if (targetType === "area") {
|
||||||
const floorId = this.hass.areas[targetId].floor_id;
|
const floorId = this.hass.areas[targetId]?.floor_id;
|
||||||
|
if (floorId) {
|
||||||
subtitle = computeFloorName(this.hass.floors[floorId]) || floorId;
|
subtitle = computeFloorName(this.hass.floors[floorId]) || floorId;
|
||||||
|
} else {
|
||||||
|
subtitle = this.hass.localize(
|
||||||
|
"ui.panel.config.automation.editor.other_areas"
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (targetType === "device" && this.hass.devices[targetId]?.area_id) {
|
} else if (targetType === "device") {
|
||||||
const areaId = this.hass.devices[targetId].area_id;
|
const areaId = this.hass.devices[targetId]?.area_id;
|
||||||
|
if (areaId) {
|
||||||
subtitle = computeAreaName(this.hass.areas[areaId]) || areaId;
|
subtitle = computeAreaName(this.hass.areas[areaId]) || areaId;
|
||||||
|
} else {
|
||||||
|
const device = this.hass.devices[targetId];
|
||||||
|
subtitle = this.hass.localize(
|
||||||
|
`ui.panel.config.automation.editor.${device?.entry_type === "service" ? "services" : "unassigned_devices"}`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
if (targetType === "entity" && this.hass.states[targetId]) {
|
} else if (targetType === "entity" && this.hass.states[targetId]) {
|
||||||
const entity = this.hass.entities[targetId];
|
const entity = this.hass.entities[targetId];
|
||||||
if (entity && !entity.device_id && !entity.area_id) {
|
if (entity && !entity.device_id && !entity.area_id) {
|
||||||
const domain = targetId.split(".", 2)[0];
|
const domain = targetId.split(".", 2)[0];
|
||||||
@@ -759,12 +770,12 @@ class DialogAddAutomationElement
|
|||||||
.join(computeRTL(this.hass) ? " ◂ " : " ▸ ");
|
.join(computeRTL(this.hass) ? " ◂ " : " ▸ ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (subtitle) {
|
if (subtitle) {
|
||||||
return html`<span slot="subtitle">${subtitle}</span>`;
|
return html`<span slot="subtitle">${subtitle}</span>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return nothing;
|
return nothing;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -372,7 +372,7 @@ export class HaAutomationAddItems extends LitElement {
|
|||||||
.selected-target ha-floor-icon {
|
.selected-target ha-floor-icon {
|
||||||
display: flex;
|
display: flex;
|
||||||
height: 32px;
|
height: 32px;
|
||||||
width: 24px;
|
width: 32px;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
}
|
}
|
||||||
.selected-target ha-domain-icon {
|
.selected-target ha-domain-icon {
|
||||||
|
|||||||
Reference in New Issue
Block a user