Replace confirm with confirmation dialogs in snapshots (#6690)

This commit is contained in:
Bram Kragten 2020-08-24 18:36:47 +02:00 committed by GitHub
parent 47e9531972
commit 6599351d45
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,9 +7,9 @@ import {
CSSResult,
customElement,
html,
internalProperty,
LitElement,
property,
internalProperty,
TemplateResult,
} from "lit-element";
import { createCloseHeading } from "../../../../src/components/ha-dialog";
@ -19,6 +19,7 @@ import {
fetchHassioSnapshotInfo,
HassioSnapshotDetail,
} from "../../../../src/data/hassio/snapshot";
import { showConfirmationDialog } from "../../../../src/dialogs/generic/show-dialog-box";
import { PolymerChangedEvent } from "../../../../src/polymer-types";
import { haStyleDialog } from "../../../../src/resources/styles";
import { HomeAssistant } from "../../../../src/types";
@ -266,8 +267,12 @@ class HassioSnapshotDialog extends LitElement {
this._snapshotPassword = ev.detail.value;
}
private _partialRestoreClicked() {
if (!confirm("Are you sure you want to restore this snapshot?")) {
private async _partialRestoreClicked() {
if (
!(await showConfirmationDialog(this, {
title: "Are you sure you want partially to restore this snapshot?",
}))
) {
return;
}
@ -312,8 +317,13 @@ class HassioSnapshotDialog extends LitElement {
);
}
private _fullRestoreClicked() {
if (!confirm("Are you sure you want to restore this snapshot?")) {
private async _fullRestoreClicked() {
if (
!(await showConfirmationDialog(this, {
title:
"Are you sure you want to wipe your system and restore this snapshot?",
}))
) {
return;
}
@ -338,8 +348,12 @@ class HassioSnapshotDialog extends LitElement {
);
}
private _deleteClicked() {
if (!confirm("Are you sure you want to delete this snapshot?")) {
private async _deleteClicked() {
if (
!(await showConfirmationDialog(this, {
title: "Are you sure you want to delete this snapshot?",
}))
) {
return;
}