1
0
Fork 0

style changes + dashboard now async ajax calls

This commit is contained in:
Heiko Kernbach 2014-08-22 11:39:51 +02:00
parent cc58900515
commit 2e6d4562d0
5 changed files with 60 additions and 21 deletions

View File

@ -5,6 +5,7 @@
<div class="navlogo"> <div class="navlogo">
<a class="logo" href="#"><img src="img/logo_arangodb_white.png"/></a> <a class="logo" href="#"><img src="img/logo_arangodb_white.png"/></a>
</div> </div>
<div id="progressPlaceholderIcon"></div>
<div class="statmenu" id="statisticBar"> <div class="statmenu" id="statisticBar">
</div> </div>
<div class="usermenu" id="userBar" style="float:right;"> <div class="usermenu" id="userBar" style="float:right;">

View File

@ -407,7 +407,7 @@
cuts[counter] : cuts[counter - 1] + " - " + cuts[counter]; cuts[counter] : cuts[counter - 1] + " - " + cuts[counter];
}, },
getStatistics: function () { getStatistics: function (callback) {
var self = this; var self = this;
var url = "/_db/_system/_admin/aardvark/statistics/short"; var url = "/_db/_system/_admin/aardvark/statistics/short";
var urlParams = "?start="; var urlParams = "?start=";
@ -430,13 +430,20 @@
$.ajax( $.ajax(
url + urlParams, url + urlParams,
{async: false} {async: true}
).done( ).done(
function (d) { function (d) {
if (d.times.length > 0) { if (d.times.length > 0) {
self.isUpdating = true; self.isUpdating = true;
self.mergeHistory(d); self.mergeHistory(d);
} }
if (self.isUpdating === false) {
return;
}
if (callback) {
callback();
}
self.updateCharts();
} }
); );
}, },
@ -459,7 +466,7 @@
$.ajax( $.ajax(
url + urlParams, url + urlParams,
{async: false} {async: true}
).done( ).done(
function (d) { function (d) {
var i; var i;
@ -664,10 +671,6 @@
} }
self.timer = window.setInterval(function () { self.timer = window.setInterval(function () {
self.getStatistics(); self.getStatistics();
if (self.isUpdating === false) {
return;
}
self.updateCharts();
}, },
self.interval self.interval
); );
@ -697,7 +700,7 @@
if (!modalView) { if (!modalView) {
$(this.el).html(this.template.render()); $(this.el).html(this.template.render());
} }
this.getStatistics(); var callback = function() {
this.prepareDygraphs(); this.prepareDygraphs();
if (this.isUpdating) { if (this.isUpdating) {
this.prepareD3Charts(); this.prepareD3Charts();
@ -705,6 +708,11 @@
this.updateTendencies(); this.updateTendencies();
} }
this.startUpdating(); this.startUpdating();
}.bind(this);
this.getStatistics(callback);
} }
}); });
}()); }());

View File

@ -8,8 +8,11 @@
window.ProgressView = Backbone.View.extend({ window.ProgressView = Backbone.View.extend({
template: templateEngine.createTemplate("progressBase.ejs"), template: templateEngine.createTemplate("progressBase.ejs"),
el: "#progressPlaceholder", el: "#progressPlaceholder",
el2: "#progressPlaceholderIcon",
initialize: function() { initialize: function() {
}, },
@ -17,10 +20,12 @@
$(this.el).html(this.template.render({})); $(this.el).html(this.template.render({}));
$(".progress-message").text(msg); $(".progress-message").text(msg);
$(this.el).show(); $(this.el).show();
$(this.el2).html('<i class="fa fa-spinner fa-spin"></i>');
}, },
hide: function() { hide: function() {
$(this.el).fadeOut(); $(this.el).hide();
$(this.el2).html('');
} }
}); });

View File

@ -8,7 +8,8 @@
} }
.progress-view { .progress-view {
background-color: rgba(0, 0, 0, .1); opacity: 0;
background-color: rgba(0, 0, 0, .0);
border-radius: 5px; border-radius: 5px;
color: $c-nav-bg; color: $c-nav-bg;
height: 180px; height: 180px;
@ -16,13 +17,16 @@
margin: -100px 0 0 -150px; margin: -100px 0 0 -150px;
position: absolute; position: absolute;
top: 50%; top: 50%;
opacity: 0;
width: 300px; width: 300px;
.progress-content { .progress-content {
margin-left: 90px; margin-left: 90px;
margin-top: 10px; margin-top: 10px;
opacity: 0;
.fa-spinner { .fa-spinner {
opacity: 0;
font-size: 100pt; font-size: 100pt;
} }
@ -37,5 +41,14 @@
height: 25px; height: 25px;
padding-top: 3px; padding-top: 3px;
text-align: center; text-align: center;
opacity: 0;
} }
} }
#progressPlaceholderIcon {
color: $c-positive;
float: left;
font-size: 22px;
margin-left: 10px;
margin-top: 6px;
}

View File

@ -5852,7 +5852,8 @@ input.gv-radio-button {
z-index: 9999; } z-index: 9999; }
.progress-view { .progress-view {
background-color: rgba(0, 0, 0, 0.1); opacity: 0;
background-color: transparent;
border-radius: 5px; border-radius: 5px;
color: #333232; color: #333232;
height: 180px; height: 180px;
@ -5860,11 +5861,14 @@ input.gv-radio-button {
margin: -100px 0 0 -150px; margin: -100px 0 0 -150px;
position: absolute; position: absolute;
top: 50%; top: 50%;
opacity: 0;
width: 300px; } width: 300px; }
.progress-view .progress-content { .progress-view .progress-content {
margin-left: 90px; margin-left: 90px;
margin-top: 10px; } margin-top: 10px;
opacity: 0; }
.progress-view .progress-content .fa-spinner { .progress-view .progress-content .fa-spinner {
opacity: 0;
font-size: 100pt; } font-size: 100pt; }
.progress-view .progress-message { .progress-view .progress-message {
background-color: #333232; background-color: #333232;
@ -5874,7 +5878,15 @@ input.gv-radio-button {
font-weight: 200; font-weight: 200;
height: 25px; height: 25px;
padding-top: 3px; padding-top: 3px;
text-align: center; } text-align: center;
opacity: 0; }
#progressPlaceholderIcon {
color: #8aa051;
float: left;
font-size: 22px;
margin-left: 10px;
margin-top: 6px; }
.hotkeysList .hotkeysLabel { .hotkeysList .hotkeysLabel {
clear: both; clear: both;