From 960e0dd9e06cd85e0ef2c11da3d24f713333bfb2 Mon Sep 17 00:00:00 2001 From: Paul Bottein Date: Thu, 28 Mar 2024 13:33:18 +0100 Subject: [PATCH] Add suggested name --- .../config/category/dialog-category-registry-detail.ts | 9 +++++++-- src/panels/config/category/ha-category-picker.ts | 1 + 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/panels/config/category/dialog-category-registry-detail.ts b/src/panels/config/category/dialog-category-registry-detail.ts index 84881e3809..74f89f0bd7 100644 --- a/src/panels/config/category/dialog-category-registry-detail.ts +++ b/src/panels/config/category/dialog-category-registry-detail.ts @@ -34,8 +34,13 @@ class DialogCategoryDetail extends LitElement { ): Promise { this._params = params; this._error = undefined; - this._name = this._params.entry ? this._params.entry.name : ""; - this._icon = this._params.entry?.icon || null; + if (this._params.entry) { + this._name = this._params.entry.name || ""; + this._icon = this._params.entry.icon || null; + } else { + this._name = this._params.suggestedName || ""; + this._icon = null; + } await this.updateComplete; } diff --git a/src/panels/config/category/ha-category-picker.ts b/src/panels/config/category/ha-category-picker.ts index 090b3f89b2..529db65b2c 100644 --- a/src/panels/config/category/ha-category-picker.ts +++ b/src/panels/config/category/ha-category-picker.ts @@ -237,6 +237,7 @@ export class HaCategoryPicker extends SubscribeMixin(LitElement) { showCategoryRegistryDetailDialog(this, { scope: this.scope!, + suggestedName: newValue === ADD_NEW_SUGGESTION_ID ? this._suggestion : "", createEntry: async (values) => { const category = await createCategoryRegistryEntry( this.hass,