Fix app restart API; Add missing loading spinners and confirm dialogs on some pages

This commit is contained in:
Taylor Helsper 2022-09-03 21:17:21 -05:00
parent 917eb62ed5
commit d188139cdb
4 changed files with 35 additions and 12 deletions

View File

@ -42,5 +42,14 @@
</ol>
</div>
<div id="confirm-dialog"></div>
<div id="loading_spinner_overlay" class="loading_spinner_overlay" style="display:none;">
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
<br/>
<span id="loading_spinner_message">Loading...</span>
</div>
</body>
</html>

View File

@ -42,5 +42,14 @@
</ol>
</div>
<div id="confirm-dialog"></div>
<div id="loading_spinner_overlay" class="loading_spinner_overlay" style="display:none;">
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
<br/>
<span id="loading_spinner_message">Loading...</span>
</div>
</body>
</html>

View File

@ -13,6 +13,21 @@ function restart(name, short_name) {
}
}
function restart_app_via_api(name, short_name) {
if ( confirm("Are you sure you want to restart "+name+"?") ) {
$('#loading_spinner_message').html("Restarting...");
$('#loading_spinner_overlay').fadeIn();
$.get('/api/restart_app?app='+short_name)
.done(function( data ) {
if (data != "OK") {
alert("Error restarting app: "+data)
}
$('#loading_spinner_overlay').fadeOut();
}
);
}
}
// ==========================================
// Manage app installations
// ==========================================

View File

@ -31,18 +31,6 @@
<script src="{{ url_for('static', filename='js/hes-gallery.min.js')}}"></script>
<script>
function restart_app_via_api(name, short_name) {
if ( confirm("Are you sure you want to restart "+name+"?") ) {
$('#loading_spinner_message').html("Restarting...");
$('#loading_spinner_overlay').fadeIn();
$.getJSON('/api/restart_app?app='+short_name, function( data ) {
alert(data)
if (data != "OK") {
alert("Error restarting app: "+data)
}
});
}
}
$(document).ready(function() {
HesGallery.init({
disableScrolling: false,
@ -176,6 +164,8 @@
</div>
</div>
<div id="confirm-dialog"></div>
<div id="loading_spinner_overlay" class="loading_spinner_overlay" style="display:none;">
<img id="loading_spinner" class="loading_image" src="{{ url_for('static', filename="images/loading.gif")}}"/>
<br/>