Skip to content

Commit

Permalink
Autorefresh bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
dejande committed Jan 7, 2014
1 parent 34320a6 commit aeec3c3
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions Olog/public_html/static/js/rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,6 @@ function prepareParentAndChildren(i, children, prepend) {
var logTemplate = getTemplate("template_log");
var historyTemplate = getTemplate("template_log_history");
var html = "";
var htmlBlock = "";

var item = children[0];

Expand Down Expand Up @@ -526,7 +525,7 @@ function prepareParentAndChildren(i, children, prepend) {
$("#load_logs").append(html);

} else {
htmlBlock += html;
$(".log").first().before(html);
}

// Append children
Expand Down Expand Up @@ -588,9 +587,16 @@ function repeatLogs(data, prepend){
var children = [];

var logId = "";
var logIndex = 0;

// If we are prepending new data, reverse the order of logs so the will be prepended correctly
if(prepend) {
data.reverse();
}

// Go through all the logs
$.each(data, function(i, item) {
logIndex = i;
savedLogs[item.id + "_" + item.version] = item;
var currentLogId = item.id;

Expand All @@ -613,6 +619,12 @@ function repeatLogs(data, prepend){
children.push(item);
logId = currentLogId;
});

// Print the last element (with children)
if(children.length > 0) {
logIndex ++;
prepareParentAndChildren(logIndex, children, prepend);
}
}

/*
Expand Down

0 comments on commit aeec3c3

Please sign in to comment.