Waiting pop-up for post-install

This commit is contained in:
Kload 2013-11-21 10:54:33 +01:00
parent 4839a57646
commit 788b607e1c
2 changed files with 23 additions and 4 deletions

View file

@ -31,6 +31,18 @@
</div>
</div>
<div id="popup" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
<h4 class="modal-title" id="popup-title"></h4>
</div>
<div class="modal-body" id="popup-body"></div>
</div>
</div>
</div>
<script type="text/javascript" src="js/vendor/jquery-1.10.1.min.js"></script>
<script type="text/javascript" src="js/vendor/mustache.js"></script>
<script type="text/javascript" src="js/vendor/sammy.js"></script>

View file

@ -45,9 +45,14 @@ app = Sammy('#main', function (sam) {
if (uri == '/postinstall') {
var installing = false;
check = setInterval(function () {
setInterval(function () {
installing = true;
}, 4000);
}, 6000);
}
if (uri == '/postinstall') {
$('#popup-title').text('Installing');
$('#popup-body').html('<p>YunoHost is being installed on <strong>'+ data.domain +'</strong>. It may take a few minutes ...</p><br><div class="text-center"><img src="img/ajax-loader.gif"></div>');
$('#popup').modal('show');
}
jQuery.ajax({
url: store.get('url') + uri,
@ -78,10 +83,12 @@ app = Sammy('#main', function (sam) {
} else {
if (uri == '/postinstall') {
if (installing) {
window.location.replace('https://'+ data['domain'] +'/ynhadmin');
$('#popup-body').html('<p>YunoHost has been successfully installed, please go to <a href="https://'+ window.location.hostname +'/ynhadmin" target="_blank"><strong>https://'+ window.location.hostname +'/ynhadmin</strong></a>.</p>');
} else {
$('#popup').modal('hide');
}
}
c.flash('fail', 'Server error');
c.flash('fail', 'An error occured at post-installation.');
}
store.clear('slide');
c.redirect(store.get('path-1'));