status: Remove dead code
This commit is contained in:
parent
a4c8c5b6b7
commit
6176389a10
|
|
@ -45,7 +45,6 @@ var graph_module = angular.module('graph', [ ]).
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.load_graph_success = function(data) {
|
instance.load_graph_success = function(data) {
|
||||||
top_status();
|
|
||||||
var d = instance.graphs_available[this.k];
|
var d = instance.graphs_available[this.k];
|
||||||
instance.graph_fill(data, d);
|
instance.graph_fill(data, d);
|
||||||
instance.schedule_graph(60000);
|
instance.schedule_graph(60000);
|
||||||
|
|
@ -54,12 +53,14 @@ var graph_module = angular.module('graph', [ ]).
|
||||||
};
|
};
|
||||||
|
|
||||||
instance.load_graph_error = function(jqXHR, stat, errorThrown) {
|
instance.load_graph_error = function(jqXHR, stat, errorThrown) {
|
||||||
|
/*
|
||||||
var msg = 'Graph data download failed (' + stat + '). Server or network down?';
|
var msg = 'Graph data download failed (' + stat + '). Server or network down?';
|
||||||
|
|
||||||
if (errorThrown)
|
if (errorThrown)
|
||||||
msg += '<br />HTTP error: ' + htmlent(errorThrown);
|
msg += '<br />HTTP error: ' + htmlent(errorThrown);
|
||||||
|
|
||||||
top_status('msg_e', msg);
|
instance.scope.uierror = msg_e;
|
||||||
|
*/
|
||||||
instance.schedule_graph(60000);
|
instance.schedule_graph(60000);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,6 @@
|
||||||
|
|
||||||
var options = {};
|
var options = {};
|
||||||
|
|
||||||
function top_status(c, s)
|
|
||||||
{
|
|
||||||
if (!c) {
|
|
||||||
$('#status').hide('fast');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#status').hide().html('<div class="' + c + '">' + s + '</div>').show('fast');
|
|
||||||
}
|
|
||||||
|
|
||||||
function isUndefined(v)
|
function isUndefined(v)
|
||||||
{
|
{
|
||||||
var undef;
|
var undef;
|
||||||
|
|
@ -314,70 +304,8 @@ function render(d)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
var next_req_timer;
|
|
||||||
|
|
||||||
function schedule_update()
|
|
||||||
{
|
|
||||||
if (next_req_timer)
|
|
||||||
clearTimeout(next_req_timer);
|
|
||||||
|
|
||||||
next_req_timer = setTimeout(update_status, 10000);
|
|
||||||
}
|
|
||||||
|
|
||||||
var current_status;
|
var current_status;
|
||||||
|
|
||||||
function update_success(data)
|
|
||||||
{
|
|
||||||
if (next_req_timer) {
|
|
||||||
clearTimeout(next_req_timer);
|
|
||||||
next_req_timer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
top_status();
|
|
||||||
/* If this is the first successful status download, motd needs to be
|
|
||||||
* updated too.
|
|
||||||
*/
|
|
||||||
if (!current_status) {
|
|
||||||
current_status = data;
|
|
||||||
motd_check();
|
|
||||||
} else {
|
|
||||||
current_status = data;
|
|
||||||
}
|
|
||||||
render(data);
|
|
||||||
schedule_update();
|
|
||||||
}
|
|
||||||
|
|
||||||
function update_status()
|
|
||||||
{
|
|
||||||
if (next_req_timer) {
|
|
||||||
clearTimeout(next_req_timer);
|
|
||||||
next_req_timer = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
$.ajax({
|
|
||||||
url: '/status.json',
|
|
||||||
dataType: 'json',
|
|
||||||
cache: false,
|
|
||||||
timeout: 5000,
|
|
||||||
error: function(jqXHR, stat, errorThrown) {
|
|
||||||
var msg = '';
|
|
||||||
if (stat == 'timeout')
|
|
||||||
msg = 'Status download timed out. Network or server down?';
|
|
||||||
else if (stat == 'error')
|
|
||||||
msg = 'Status download failed with an error. Network or server down?';
|
|
||||||
else
|
|
||||||
msg = 'Status download failed (' + stat + ').';
|
|
||||||
|
|
||||||
if (errorThrown)
|
|
||||||
msg += '<br />HTTP error: ' + htmlent(errorThrown);
|
|
||||||
|
|
||||||
top_status('msg_e', msg);
|
|
||||||
|
|
||||||
schedule_update();
|
|
||||||
},
|
|
||||||
success: update_success
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var motd_last;
|
var motd_last;
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue