Replace prompt with showPromptDialog (#7460)

Co-authored-by: Bram Kragten <mail@bramkragten.nl>
This commit is contained in:
Florian Gareis 2020-10-27 14:04:01 +01:00 committed by GitHub
parent b56e9ef028
commit ba4c2fc1bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 2 deletions

View File

@ -3,6 +3,7 @@ import { html } from "@polymer/polymer/lib/utils/html-tag";
import { PolymerElement } from "@polymer/polymer/polymer-element";
import { getAppKey } from "../data/notify_html5";
import { EventsMixin } from "../mixins/events-mixin";
import { showPromptDialog } from "../dialogs/generic/show-dialog-box";
import "./ha-switch";
export const pushSupported =
@ -88,7 +89,10 @@ class HaPushNotificationsToggle extends EventsMixin(PolymerElement) {
browserName = "chrome";
}
const name = prompt("What should this device be called ?");
const name = await showPromptDialog(this, {
title: this.hass.localize("ui.panel.profile.push_notifications.add_device_prompt.title"),
inputLabel: this.hass.localize("ui.panel.profile.push_notifications.add_device_prompt.input_label"),
});
if (name == null) {
this.pushChecked = false;
return;

View File

@ -2676,7 +2676,11 @@
"error_load_platform": "Configure notify.html5.",
"error_use_https": "Requires SSL enabled for frontend.",
"push_notifications": "Push notifications",
"link_promo": "Learn more"
"link_promo": "Learn more",
"add_device_prompt": {
"title": "What should this device be called?",
"input_label": "Device name"
}
},
"language": {
"header": "Language",