diff --git a/hassio/snapshots/hassio-snapshot.html b/hassio/snapshots/hassio-snapshot.html index fbb0f3ba67..13917b7ef8 100644 --- a/hassio/snapshots/hassio-snapshot.html +++ b/hassio/snapshots/hassio-snapshot.html @@ -2,6 +2,7 @@ + + @@ -99,6 +103,7 @@ class HassioSnapshot extends Polymer.Element { type: Boolean, value: true, }, + snapshotPassword: String, error: String, }; } @@ -142,11 +147,14 @@ class HassioSnapshot extends Polymer.Element { const folders = this.snapshot.folders.filter(folder => folder.checked).map(folder => folder.slug); - this.hass.callApi('post', `hassio/snapshots/${this.snapshotSlug}/restore/partial`, { + const data = { homeassistant: this.restoreHass, addons: addons, folders: folders - }).then(() => { + }; + if (this.snapshot.protected) data.password = this.snapshotPassword; + + this.hass.callApi('post', `hassio/snapshots/${this.snapshotSlug}/restore/partial`, data).then(() => { alert('Snapshot restored!'); this.$.dialog.close(); }, (error) => { @@ -158,7 +166,8 @@ class HassioSnapshot extends Polymer.Element { if (!confirm('Are you sure you want to restore this snapshot?')) { return; } - this.hass.callApi('post', `hassio/snapshots/${this.snapshotSlug}/restore/full`) + const data = this.snapshot.protected ? { password: this.snapshotPassword } : null; + this.hass.callApi('post', `hassio/snapshots/${this.snapshotSlug}/restore/full`, data) .then(() => { alert('Snapshot restored!'); this.$.dialog.close(); diff --git a/hassio/snapshots/hassio-snapshots.html b/hassio/snapshots/hassio-snapshots.html index 373ba35a7a..7888e51600 100644 --- a/hassio/snapshots/hassio-snapshots.html +++ b/hassio/snapshots/hassio-snapshots.html @@ -14,7 +14,8 @@