frontend API button to restore snapshot
This commit is contained in:
parent
fb25b76950
commit
b425e7d75c
|
@ -165,7 +165,7 @@
|
|||
<p>Create next snapshot: <span class="settings-current">{{ snapshots.next_exec_str }}</span>, snapshots expire after <span class="settings-current">{{ snapshots.expire_after }}</span></p>
|
||||
<br>
|
||||
{% for snapshot in snapshots.snapshots %}
|
||||
<p><button data-id="{{ snapshot.id }}">Restore</button> Snapshot created on: <span class="settings-current">{{ snapshot.start_date }}</span>, took <span class="settings-current">{{ snapshot.duration_s }}s</span> to create</p>
|
||||
<p><button id="{{ snapshot.id }}" onclick="restoreSnapshot(id)">Restore</button> Snapshot created on: <span class="settings-current">{{ snapshot.start_date }}</span>, took <span class="settings-current">{{ snapshot.duration_s }}s</span> to create.</p>
|
||||
{% endfor %}
|
||||
{% endif %}
|
||||
</div>
|
||||
|
|
|
@ -287,6 +287,16 @@ function resetToken() {
|
|||
document.getElementById('text-reveal').replaceWith(message);
|
||||
}
|
||||
|
||||
// restore from snapshot
|
||||
function restoreSnapshot(snapshotId) {
|
||||
console.log('restore ' + snapshotId);
|
||||
let apiEndpoint = '/api/snapshot/' + snapshotId + '/';
|
||||
apiRequest(apiEndpoint, 'POST');
|
||||
let message = document.createElement('p');
|
||||
message.innerText = 'Snapshot restore started';
|
||||
document.getElementById(snapshotId).parentElement.replaceWith(message);
|
||||
}
|
||||
|
||||
// delete from file system
|
||||
function deleteConfirm() {
|
||||
let to_show = document.getElementById('delete-button');
|
||||
|
|
Loading…
Reference in New Issue