mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 11:46:42 +00:00
Add area to automation/script save dialog (#23416)
Add area chip to automation/script save dialog
This commit is contained in:
parent
85bd6432a9
commit
94f679e387
@ -14,6 +14,7 @@ import "../../category/ha-category-picker";
|
||||
import "../../../../components/ha-expansion-panel";
|
||||
import "../../../../components/chips/ha-chip-set";
|
||||
import "../../../../components/chips/ha-assist-chip";
|
||||
import "../../../../components/ha-area-picker";
|
||||
|
||||
import type { HassDialog } from "../../../../dialogs/make-dialog-manager";
|
||||
import { haStyle, haStyleDialog } from "../../../../resources/styles";
|
||||
@ -57,6 +58,7 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
||||
);
|
||||
this._newDescription = params.config.description || "";
|
||||
this._entryUpdates = params.entityRegistryUpdate || {
|
||||
area: params.entityRegistryEntry?.area_id || "",
|
||||
labels: params.entityRegistryEntry?.labels || [],
|
||||
category: params.entityRegistryEntry?.categories[params.domain] || "",
|
||||
};
|
||||
@ -66,6 +68,7 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
||||
this._newIcon ? "icon" : "",
|
||||
this._entryUpdates.category ? "category" : "",
|
||||
this._entryUpdates.labels.length > 0 ? "labels" : "",
|
||||
this._entryUpdates.area ? "area" : "",
|
||||
];
|
||||
}
|
||||
|
||||
@ -193,6 +196,14 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
||||
@value-changed=${this._registryEntryChanged}
|
||||
></ha-labels-picker>`
|
||||
: nothing}
|
||||
${this._visibleOptionals.includes("area")
|
||||
? html` <ha-area-picker
|
||||
id="area"
|
||||
.hass=${this.hass}
|
||||
.value=${this._entryUpdates.area}
|
||||
@value-changed=${this._registryEntryChanged}
|
||||
></ha-area-picker>`
|
||||
: nothing}
|
||||
|
||||
<ha-chip-set>
|
||||
${this._renderOptionalChip(
|
||||
@ -209,6 +220,12 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
||||
)
|
||||
)
|
||||
: nothing}
|
||||
${this._renderOptionalChip(
|
||||
"area",
|
||||
this.hass.localize(
|
||||
"ui.panel.config.automation.editor.dialog.add_area"
|
||||
)
|
||||
)}
|
||||
${this._renderOptionalChip(
|
||||
"category",
|
||||
this.hass.localize(
|
||||
@ -311,12 +328,14 @@ class DialogAutomationRename extends LitElement implements HassDialog {
|
||||
ha-icon-picker,
|
||||
ha-category-picker,
|
||||
ha-labels-picker,
|
||||
ha-area-picker,
|
||||
ha-chip-set {
|
||||
display: block;
|
||||
}
|
||||
ha-icon-picker,
|
||||
ha-category-picker,
|
||||
ha-labels-picker,
|
||||
ha-area-picker,
|
||||
ha-chip-set {
|
||||
margin-top: 16px;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ interface BaseRenameDialogParams {
|
||||
}
|
||||
|
||||
export interface EntityRegistryUpdate {
|
||||
area: string;
|
||||
labels: string[];
|
||||
category: string;
|
||||
}
|
||||
|
@ -950,6 +950,7 @@ export class HaAutomationEditor extends PreventUnsavedMixin(
|
||||
automation: this._entityRegistryUpdate.category || null,
|
||||
},
|
||||
labels: this._entityRegistryUpdate.labels || [],
|
||||
area_id: this._entityRegistryUpdate.area || null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -919,6 +919,7 @@ export class HaScriptEditor extends SubscribeMixin(
|
||||
script: this._entityRegistryUpdate.category || null,
|
||||
},
|
||||
labels: this._entityRegistryUpdate.labels || [],
|
||||
area_id: this._entityRegistryUpdate.area || null,
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -3718,7 +3718,8 @@
|
||||
"add_description": "Add description",
|
||||
"add_icon": "Add icon",
|
||||
"add_category": "Add category",
|
||||
"add_labels": "Add labels"
|
||||
"add_labels": "Add labels",
|
||||
"add_area": "Add area"
|
||||
}
|
||||
},
|
||||
"trace": {
|
||||
|
Loading…
x
Reference in New Issue
Block a user