add create snapshot now button

pull/357/head
simon 2 years ago
parent 01a8c65df9
commit 476d4d4909
No known key found for this signature in database
GPG Key ID: 2C15AA5E89985DD4

@ -162,10 +162,10 @@
</div>
<div>
{% if snapshots %}
<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>
<p>Create next snapshot: <span class="settings-current">{{ snapshots.next_exec_str }}</span>, snapshots expire after <span class="settings-current">{{ snapshots.expire_after }}</span>. <button onclick="createSnapshot()" id="createButton">Create snapshot now</button></p>
<br>
{% for snapshot in snapshots.snapshots %}
<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>
<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. State: <i>{{ snapshot.state }}</i></p>
{% endfor %}
{% endif %}
</div>

@ -297,6 +297,15 @@ function restoreSnapshot(snapshotId) {
document.getElementById(snapshotId).parentElement.replaceWith(message);
}
function createSnapshot() {
console.log('create snapshot now');
let apiEndpoint = '/api/snapshot/';
apiRequest(apiEndpoint, 'POST');
let message = document.createElement('span');
message.innerText = 'Snapshot in progress';
document.getElementById('createButton').replaceWith(message);
}
// delete from file system
function deleteConfirm() {
let to_show = document.getElementById('delete-button');

Loading…
Cancel
Save