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