${this.hass.localize("ui.panel.config.labels.introduction2")}
+ `, + }); + } + + private async _fetchLabels() { + this._labels = await fetchLabelRegistry(this.hass.connection); + } + + private _addLabel() { + this._openDialog(); + } + + private _openDialog(entry?: LabelRegistryEntry) { + showLabelDetailDialog(this, { + entry, + createEntry: (values) => this._createLabel(values), + updateEntry: entry + ? (values) => this._updateLabel(entry, values) + : undefined, + removeEntry: entry ? () => this._removeLabel(entry) : undefined, + }); + } + + private async _createLabel( + values: LabelRegistryEntryMutableParams + ): Promise