mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 19:26:36 +00:00
Fix select options for add-on config (#10330)
This commit is contained in:
parent
df53364d16
commit
b1e6935df9
@ -78,6 +78,18 @@ class HassioAddonConfig extends LitElement {
|
|||||||
this.addon.translations.en?.configuration?.[entry.name].name ||
|
this.addon.translations.en?.configuration?.[entry.name].name ||
|
||||||
entry.name;
|
entry.name;
|
||||||
|
|
||||||
|
private _schema = memoizeOne((schema: HaFormSchema[]): HaFormSchema[] =>
|
||||||
|
// @ts-expect-error supervisor does not implement [string, string] for select.options[]
|
||||||
|
schema.map((entry) =>
|
||||||
|
entry.type === "select"
|
||||||
|
? {
|
||||||
|
...entry,
|
||||||
|
options: entry.options.map((option) => [option, option]),
|
||||||
|
}
|
||||||
|
: entry
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
private _filteredShchema = memoizeOne(
|
private _filteredShchema = memoizeOne(
|
||||||
(options: Record<string, unknown>, schema: HaFormSchema[]) =>
|
(options: Record<string, unknown>, schema: HaFormSchema[]) =>
|
||||||
schema.filter((entry) => entry.name in options || entry.required)
|
schema.filter((entry) => entry.name in options || entry.required)
|
||||||
@ -128,12 +140,14 @@ class HassioAddonConfig extends LitElement {
|
|||||||
.data=${this._options!}
|
.data=${this._options!}
|
||||||
@value-changed=${this._configChanged}
|
@value-changed=${this._configChanged}
|
||||||
.computeLabel=${this.computeLabel}
|
.computeLabel=${this.computeLabel}
|
||||||
.schema=${this._showOptional
|
.schema=${this._schema(
|
||||||
? this.addon.schema!
|
this._showOptional
|
||||||
: this._filteredShchema(
|
? this.addon.schema!
|
||||||
this.addon.options,
|
: this._filteredShchema(
|
||||||
this.addon.schema!
|
this.addon.options,
|
||||||
)}
|
this.addon.schema!
|
||||||
|
)
|
||||||
|
)}
|
||||||
></ha-form>`
|
></ha-form>`
|
||||||
: html` <ha-yaml-editor
|
: html` <ha-yaml-editor
|
||||||
@value-changed=${this._configChanged}
|
@value-changed=${this._configChanged}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user