mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-23 17:26:42 +00:00
Move order of restore around (#23391)
This commit is contained in:
parent
6afcd4d770
commit
56f9165323
@ -88,11 +88,7 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
|
||||
this._error = undefined;
|
||||
this._stage = undefined;
|
||||
this._step = undefined;
|
||||
if (this._unsub) {
|
||||
this._unsub.then((unsub) => unsub());
|
||||
this._unsub = undefined;
|
||||
}
|
||||
window.removeEventListener("connection-status", this._connectionStatus);
|
||||
this._unsubscribe();
|
||||
fireEvent(this, "dialog-closed", { dialog: this.localName });
|
||||
}
|
||||
|
||||
@ -189,15 +185,16 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
|
||||
}
|
||||
|
||||
private async _restoreBackup() {
|
||||
this._unsubscribe();
|
||||
try {
|
||||
this._step = "progress";
|
||||
window.addEventListener("connection-status", this._connectionStatus);
|
||||
this._subscribeBackupEvents();
|
||||
await this._doRestoreBackup(
|
||||
this._userPassword || this._backupEncryptionKey
|
||||
);
|
||||
this._subscribeBackupEvents();
|
||||
} catch (e: any) {
|
||||
window.removeEventListener("connection-status", this._connectionStatus);
|
||||
this._unsubscribe();
|
||||
if (e.code === "password_incorrect") {
|
||||
this._step = "encryption";
|
||||
} else {
|
||||
@ -229,6 +226,14 @@ class DialogRestoreBackup extends LitElement implements HassDialog {
|
||||
});
|
||||
}
|
||||
|
||||
private _unsubscribe() {
|
||||
window.removeEventListener("connection-status", this._connectionStatus);
|
||||
if (this._unsub) {
|
||||
this._unsub.then((unsub) => unsub());
|
||||
this._unsub = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
private _restoreState() {
|
||||
switch (this._stage) {
|
||||
case "addon_repositories":
|
||||
|
Loading…
x
Reference in New Issue
Block a user