diff options
author | Romain d'Alverny <rda@mageia.org> | 2012-12-10 14:09:34 +0000 |
---|---|---|
committer | Romain d'Alverny <rda@mageia.org> | 2012-12-10 14:09:34 +0000 |
commit | 29e35ede93a8c5ae9abcc9bf124119cd96e804ef (patch) | |
tree | 0c1c2fd8f33e97adcfa334f04a74e830df8fa9e4 /js | |
parent | 5900aea5385448d52ede157c19395e9e624abd02 (diff) | |
download | pkgsubmit-29e35ede93a8c5ae9abcc9bf124119cd96e804ef.tar pkgsubmit-29e35ede93a8c5ae9abcc9bf124119cd96e804ef.tar.gz pkgsubmit-29e35ede93a8c5ae9abcc9bf124119cd96e804ef.tar.bz2 pkgsubmit-29e35ede93a8c5ae9abcc9bf124119cd96e804ef.tar.xz pkgsubmit-29e35ede93a8c5ae9abcc9bf124119cd96e804ef.zip |
A summary of events found in the log is shown after the log box.
Diffstat (limited to 'js')
-rw-r--r-- | js/pkgsubmit.js | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/js/pkgsubmit.js b/js/pkgsubmit.js index b1381a0..8e79a36 100644 --- a/js/pkgsubmit.js +++ b/js/pkgsubmit.js @@ -14,6 +14,33 @@ */ /** +*/ +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 '<span class="hl hl-' + cl + '">' + match + '</span>'; }); } @@ -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( $("<div />", { @@ -193,6 +224,12 @@ function show_log_file(ev) { }) ) ) + .after( + $("<p />", { + class: "stats", + html: events_log.report() + }) + ) .animate({ scrollTop: $("#" + elId).prop("scrollHeight") }, 1000); } ); |