3
0
Fork 0
mirror of https://github.com/lubosz/overte.git synced 2025-04-26 21:35:45 +02:00

add a restart modal to settings page

This commit is contained in:
Stephen Birarda 2014-09-26 14:12:30 -07:00
parent 0f41ca65a9
commit 80f1594a17
2 changed files with 39 additions and 3 deletions
domain-server/resources/web

View file

@ -143,12 +143,11 @@ $('body').on('click', '.save-button', function(e){
type: 'POST'
}).done(function(data){
if (data.status == "success") {
showAlertMessage("Domain settings saved.", true);
showRestartModal();
} else {
showAlertMessage(SETTINGS_ERROR_MESSAGE, false);
reloadSettings();
}
reloadSettings();
}).fail(function(){
showAlertMessage(SETTINGS_ERROR_MESSAGE, false);
reloadSettings();
@ -181,6 +180,30 @@ function badgeSidebarForDifferences(changedInput) {
$("a[href='#" + panelParentID + "'] .badge").html(badgeValue);
}
function showRestartModal() {
$('#restart-modal').modal({
backdrop: 'static',
keyboard: false
});
var secondsElapsed = 0;
var numberOfSecondsToWait = 3;
var refreshSpan = $('span#refresh-time')
refreshSpan.html(numberOfSecondsToWait + " seconds");
// call ourselves every 1 second to countdown
window.setInterval(function(){
secondsElapsed++;
secondsLeft = numberOfSecondsToWait - secondsElapsed
refreshSpan.html(secondsLeft + (secondsLeft == 1 ? " second" : " seconds"))
if (secondsElapsed == numberOfSecondsToWait) {
location.reload(true);
}
}, 1000);
}
function cleanupFormValues(node) {
if (node.type && node.type === 'checkbox') {
return { name: node.id, value: node.checked ? true : false };

View file

@ -58,6 +58,19 @@
</div>
</div>
<div class="modal fade" id="restart-modal">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">domain-server is restarting</h4>
</div>
<div class="modal-body">
<h5>This page will automatically refresh in <span id="refresh-time">3 seconds</span>.</h5>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<!--#include virtual="footer.html"-->
<script src='/js/underscore-min.js'></script>
<script src='/js/settings.js'></script>