From 6599351d45a80da9310095654d530d85e7bd1f1e Mon Sep 17 00:00:00 2001 From: Bram Kragten Date: Mon, 24 Aug 2020 18:36:47 +0200 Subject: [PATCH] Replace confirm with confirmation dialogs in snapshots (#6690) --- .../snapshot/dialog-hassio-snapshot.ts | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/hassio/src/dialogs/snapshot/dialog-hassio-snapshot.ts b/hassio/src/dialogs/snapshot/dialog-hassio-snapshot.ts index ff427aca5b..b54e18edd4 100755 --- a/hassio/src/dialogs/snapshot/dialog-hassio-snapshot.ts +++ b/hassio/src/dialogs/snapshot/dialog-hassio-snapshot.ts @@ -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; }