minor graph updates

This commit is contained in:
Hamza 2012-08-01 21:06:25 +08:00
parent 98cb53b3ba
commit 3cdfeb9a50

View File

@ -1,6 +1,5 @@
var graphSize = 5; var graphSize = 10;
var graphData = []; var graphData = [];
var graphSec = 0;
var modals = { var modals = {
err_connect: undefined, err_connect: undefined,
change_conf: undefined, change_conf: undefined,
@ -477,6 +476,12 @@ function deleteDownloadTemplates(top_elem, data) {
found = true; found = true;
} }
if(!found) { if(!found) {
for (var k = 0; k < graphData.length; k++) {
if (graphData[k].gid == gid) {
graphData.splice(k, 1);
break;
}
}
elem.remove(); elem.remove();
} }
} }
@ -547,16 +552,15 @@ function updateGraphData(data) {
for (var i = 0; i < data.length; i++) { for (var i = 0; i < data.length; i++) {
var gid = data[i].gid; var gid = data[i].gid;
var graph; var graph;
for (var i = 0; i < graphData.length; i++) { for (var k = 0; i < graphData.length; i++) {
if (graphData[i].gid == gid) { if (graphData[k].gid == gid) {
graph = graphData[i]; graph = graphData[k];
break; break;
} }
} }
var downSpeed = data[i].downloadSpeed; var downSpeed = data[i].downloadSpeed;
var upSpeed = data[i].uploadSpeed; var upSpeed = data[i].uploadSpeed;
var that = this; var that = this;
graphSec++;
if (!graph) { if (!graph) {
graphData.push((function() { graphData.push((function() {
return { return {
@ -925,9 +929,9 @@ function updateDownloads() {
}]], }]],
success: function(data) { success: function(data) {
mergeDownloads(data.result); mergeDownloads(data.result);
updateActiveDownloads(d_files.active);
updateWaitingDownloads(d_files.waiting);
updateStoppedDownloads(d_files.stopped); updateStoppedDownloads(d_files.stopped);
updateWaitingDownloads(d_files.waiting);
updateActiveDownloads(d_files.active);
updateGlobalStatistics(data.result[3][0]); updateGlobalStatistics(data.result[3][0]);
}, },
error: function() { error: function() {