Add running display of stdout.log when executing upgrade
This commit is contained in:
parent
fbd73a48c4
commit
e5b0fe7198
6 changed files with 243 additions and 92 deletions
|
@ -5,98 +5,19 @@
|
|||
<html style="direction: ltr;" xmlns="http://www.w3.org/1999/xhtml" lang="en-us">
|
||||
<head>
|
||||
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
|
||||
<title>Working...</title>
|
||||
<title>${initial_msg or "Working"}...</title>
|
||||
${core_javascript()}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/normalize.css'))}
|
||||
${jquery_theme()}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/base.css'))}
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/layout.css'))}
|
||||
<style type="text/css">
|
||||
|
||||
#body-wrapper {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
#wrapper {
|
||||
height: 60px;
|
||||
left: 50%;
|
||||
margin-top: -45px;
|
||||
margin-left: -350px;
|
||||
position: absolute;
|
||||
top: 50%;
|
||||
width: 700px;
|
||||
}
|
||||
|
||||
#progress-wrapper {
|
||||
border-collapse: collapse;
|
||||
}
|
||||
|
||||
#progress {
|
||||
border-collapse: collapse;
|
||||
height: 25px;
|
||||
width: 550px;
|
||||
}
|
||||
|
||||
#complete {
|
||||
background-color: Gray;
|
||||
width: 0px;
|
||||
}
|
||||
|
||||
#remaining {
|
||||
background-color: LightGray;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#percentage {
|
||||
padding-left: 3px;
|
||||
min-width: 50px;
|
||||
width: 50px;
|
||||
}
|
||||
|
||||
#cancel .ui-button-text {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
</style>
|
||||
<script language="javascript" type="text/javascript">
|
||||
${h.stylesheet_link(request.static_url('tailbone:static/css/progress.css'))}
|
||||
${self.update_progress_func()}
|
||||
${self.extra_styles()}
|
||||
<script type="text/javascript">
|
||||
|
||||
var updater = null;
|
||||
|
||||
function update_progress() {
|
||||
$.ajax({
|
||||
url: '${url('progress', key=progress.key)}?sessiontype=${progress.session.type}',
|
||||
success: function(data) {
|
||||
if (data.error) {
|
||||
location.href = '${cancel_url}';
|
||||
} else if (data.complete || data.maximum) {
|
||||
$('#message').html(data.message);
|
||||
$('#total').html('('+data.maximum_display+' total)');
|
||||
$('#cancel button').show();
|
||||
if (data.complete) {
|
||||
clearInterval(updater);
|
||||
$('#cancel button').hide();
|
||||
$('#total').html('done!');
|
||||
$('#complete').css('width', '100%');
|
||||
$('#remaining').hide();
|
||||
$('#percentage').html('100 %');
|
||||
location.href = data.success_url;
|
||||
} else {
|
||||
var width = parseInt(data.value) / parseInt(data.maximum);
|
||||
width = Math.round(100 * width);
|
||||
if (width) {
|
||||
$('#complete').css('width', width+'%');
|
||||
$('#percentage').html(width+' %');
|
||||
} else {
|
||||
$('#complete').css('width', '0.01%');
|
||||
$('#percentage').html('0 %');
|
||||
}
|
||||
$('#remaining').css('width', 'auto');
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
updater = setInterval(function() {update_progress()}, 1000);
|
||||
|
||||
$(function() {
|
||||
|
@ -147,6 +68,52 @@
|
|||
|
||||
</div><!-- #wrapper -->
|
||||
|
||||
${self.after_progress()}
|
||||
|
||||
</div><!-- #body-wrapper -->
|
||||
</body>
|
||||
</html>
|
||||
|
||||
<%def name="update_progress_func()">
|
||||
<script type="text/javascript">
|
||||
|
||||
function update_progress() {
|
||||
$.ajax({
|
||||
url: '${url('progress', key=progress.key)}?sessiontype=${progress.session.type}',
|
||||
success: function(data) {
|
||||
if (data.error) {
|
||||
location.href = '${cancel_url}';
|
||||
} else if (data.complete || data.maximum) {
|
||||
$('#message').html(data.message);
|
||||
$('#total').html('('+data.maximum_display+' total)');
|
||||
$('#cancel button').show();
|
||||
if (data.complete) {
|
||||
clearInterval(updater);
|
||||
$('#cancel button').hide();
|
||||
$('#total').html('done!');
|
||||
$('#complete').css('width', '100%');
|
||||
$('#remaining').hide();
|
||||
$('#percentage').html('100 %');
|
||||
location.href = data.success_url;
|
||||
} else {
|
||||
var width = parseInt(data.value) / parseInt(data.maximum);
|
||||
width = Math.round(100 * width);
|
||||
if (width) {
|
||||
$('#complete').css('width', width+'%');
|
||||
$('#percentage').html(width+' %');
|
||||
} else {
|
||||
$('#complete').css('width', '0.01%');
|
||||
$('#percentage').html('0 %');
|
||||
}
|
||||
$('#remaining').css('width', 'auto');
|
||||
}
|
||||
}
|
||||
},
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="extra_styles()"></%def>
|
||||
|
||||
<%def name="after_progress()"></%def>
|
||||
|
|
77
tailbone/templates/upgrade.mako
Normal file
77
tailbone/templates/upgrade.mako
Normal file
|
@ -0,0 +1,77 @@
|
|||
## -*- coding: utf-8; -*-
|
||||
<%inherit file="/progress.mako" />
|
||||
|
||||
<%def name="update_progress_func()">
|
||||
<script type="text/javascript">
|
||||
|
||||
function update_progress() {
|
||||
$.ajax({
|
||||
url: '${url('upgrades.execute_progress', uuid=instance.uuid)}',
|
||||
success: function(data) {
|
||||
if (data.error) {
|
||||
location.href = '${cancel_url}';
|
||||
} else {
|
||||
|
||||
var stdout = $('.stdout');
|
||||
var height = $(window).height() - stdout.offset().top - 50;
|
||||
stdout.height(height);
|
||||
stdout.append(data.stdout);
|
||||
stdout.animate({scrollTop: stdout.get(0).scrollHeight - height}, 250);
|
||||
|
||||
if (data.complete || data.maximum) {
|
||||
$('#message').html(data.message);
|
||||
$('#total').html('('+data.maximum_display+' total)');
|
||||
$('#cancel button').show();
|
||||
if (data.complete) {
|
||||
clearInterval(updater);
|
||||
$('#cancel button').hide();
|
||||
$('#total').html('done!');
|
||||
$('#complete').css('width', '100%');
|
||||
$('#remaining').hide();
|
||||
$('#percentage').html('100 %');
|
||||
location.href = data.success_url;
|
||||
} else {
|
||||
var width = parseInt(data.value) / parseInt(data.maximum);
|
||||
width = Math.round(100 * width);
|
||||
if (width) {
|
||||
$('#complete').css('width', width+'%');
|
||||
$('#percentage').html(width+' %');
|
||||
} else {
|
||||
$('#complete').css('width', '0.01%');
|
||||
$('#percentage').html('0 %');
|
||||
}
|
||||
$('#remaining').css('width', 'auto');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</%def>
|
||||
|
||||
<%def name="extra_styles()">
|
||||
${parent.extra_styles()}
|
||||
<style type="text/css">
|
||||
#wrapper {
|
||||
top: 6em;
|
||||
}
|
||||
.stdout {
|
||||
border: 1px solid Black;
|
||||
height: 500px;
|
||||
margin-left: 4.5%;
|
||||
overflow: auto;
|
||||
padding: 4px;
|
||||
position: absolute;
|
||||
top: 10em;
|
||||
white-space: nowrap;
|
||||
width: 90%;
|
||||
}
|
||||
</style>
|
||||
</%def>
|
||||
|
||||
<%def name="after_progress()">
|
||||
<div class="stdout"></div>
|
||||
</%def>
|
||||
|
||||
${parent.body()}
|
Loading…
Add table
Add a link
Reference in a new issue