Allow to remove config entry name (#5607)

* Allow to remove config entry name

* Add enter handling to prompt
This commit is contained in:
Bram Kragten 2020-04-24 10:35:43 +02:00 committed by GitHub
parent 49f2fd2af7
commit 301a964a65
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 1 deletions

View File

@ -72,6 +72,7 @@ class DialogBox extends LitElement {
autofocus
.value=${this._value}
@value-changed=${this._valueChanged}
@keyup=${this._handleKeyUp}
.label=${this._params.inputLabel
? this._params.inputLabel
: ""}
@ -112,6 +113,12 @@ class DialogBox extends LitElement {
this._params = undefined;
}
private _handleKeyUp(ev: KeyboardEvent) {
if (ev.keyCode === 13) {
this._confirm();
}
}
private async _confirm(): Promise<void> {
if (this._params!.confirm) {
this._params!.confirm(this._value);

View File

@ -521,7 +521,7 @@ class HaConfigIntegrations extends SubscribeMixin(LitElement) {
"ui.panel.config.integrations.rename_input_label"
),
});
if (!newName) {
if (newName === null) {
return;
}
const newEntry = await updateConfigEntry(this.hass, configEntry.entry_id, {