From 29e35ede93a8c5ae9abcc9bf124119cd96e804ef Mon Sep 17 00:00:00 2001 From: Romain d'Alverny Date: Mon, 10 Dec 2012 14:09:34 +0000 Subject: A summary of events found in the log is shown after the log box. --- js/pkgsubmit.js | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'js') diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js index b1381a0..8e79a36 100644 --- a/js/pkgsubmit.js +++ b/js/pkgsubmit.js @@ -13,6 +13,33 @@ * option) any later version. */ +/** +*/ +var events_log = { + + events: {}, + + count: function (type, count) { + if (type in this.events) { + this.events[type] += count; + } else { + this.events[type] = 1; + } + }, + + reset: function () { + this.events = {}; + }, + + report: function () { + s = []; + for (i in this.events) { + s.push(this.events[i] + ' ' + i); + } + return s.join(", "); + } +}; + /** * Is the file in path expected to be in text/plain or not? * We just know what .log, .done and .youri files are. @@ -91,6 +118,9 @@ function highlight_text(text) { cl = 'error'; break; } + + events_log.count(cl, 1); + return '' + match + ''; }); } @@ -165,6 +195,7 @@ function show_log_file(ev) { "/" + $(this).attr("href"), {}, function (data) { + events_log.reset(); $("#" + elId).html(highlight_text(safe_tags_regex(data))) .before( $("
", { @@ -193,6 +224,12 @@ function show_log_file(ev) { }) ) ) + .after( + $("

", { + class: "stats", + html: events_log.report() + }) + ) .animate({ scrollTop: $("#" + elId).prop("scrollHeight") }, 1000); } ); -- cgit v1.2.1