From d0c5f22c081c6dae30307684d6d816ebf602c656 Mon Sep 17 00:00:00 2001 From: Bart Polot Date: Thu, 6 Mar 2014 01:36:10 +0000 Subject: -add filter by component --- contrib/log.php | 58 ++++++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 43 insertions(+), 15 deletions(-) (limited to 'contrib') diff --git a/contrib/log.php b/contrib/log.php index 2a4122105..4188800aa 100644 --- a/contrib/log.php +++ b/contrib/log.php @@ -3,6 +3,7 @@ $path='log'; $lines = array(); $peers = array(); +$comps = array(); $ajax = FALSE; $colors = array('#F00', '#F80', '#FF0', '#4F0', '#0A0', @@ -19,7 +20,7 @@ function render_row ($d, $component, $pid, $level, $msg, $c) list($comp,$peer) = explode (',', preg_replace ('/(.*)-(\d*)/', '\1,\2', $component)); $peer = array_key_exists ($peer, $peers) ? $peers[$peer] : $peer; $date = $d ? $d->format('Y-m-d'). $d->format('H:i:s') : ""; - echo ""; + echo ""; echo "$date"; echo ''; echo $d ? $d->format('u') : ""; @@ -30,7 +31,6 @@ function render_row ($d, $component, $pid, $level, $msg, $c) { echo '
'; echo '
'; -// echo ''; } else echo ''; @@ -49,6 +49,7 @@ function process ($line, $c) { global $lines; global $peers; + global $comps; $a = explode (' ', $line); if (count($a) < 6) return; @@ -64,6 +65,8 @@ function process ($line, $c) } $lines[] = array ($date, $component, 0, $level, $msg, $c); + $comp = preg_replace ('/(.*)-\d*/', '\1', $component); + $comps[$comp] = 1; } if (array_key_exists ('a', $_GET)) { @@ -99,6 +102,7 @@ if ($handle) { } $t1 = microtime(true); +/* Ajax request: don't render container HTML, just table rows. */ if ($start !== null || $stop !== null) { render_rows(); die(); @@ -188,15 +192,22 @@ if ($start !== null || $stop !== null) {
- - + +
$id): ?> - + - - + + +
+
+ $one): ?> + + + +
@@ -214,8 +225,10 @@ if ($start !== null || $stop !== null) { - + default +

Processed in seconds.

+

Rendered in seconds.

@@ -248,15 +261,14 @@ if ($start !== null || $stop !== null) { } } - function shownone() + function shownone(btn) { - $(".btn-showpeer").removeClass("active"); - $("tbody > tr").hide(); + $(btn).parents(".btn-group").children(".btn-element.active").each(function(){$(this).click()}); } - function showall() + function showall(btn) { - $(".btn-showpeer:not(.active)").each(function(){showpeer(this.id)}); + $(btn).parents(".btn-group").children(".btn-element:not(.active)").each(function(){$(this).click()}); } function showpeer (peer) @@ -273,6 +285,21 @@ if ($start !== null || $stop !== null) { $("."+peer).hide(); } } + + function showcomp (comp) + { + $("#"+comp).toggleClass("active"); + if ($("#"+comp).hasClass("active")) { + for (var index = 0; index < types.length; ++index) { + var className = "." + types[index] + "." + comp; + $(className).show(); + if ($("#"+types[index]).hasClass("active")) + return; + } + } else { + $("."+comp).hide(); + } + } function load_debug (btn, up) { @@ -337,8 +364,9 @@ if ($start !== null || $stop !== null) { $(".btn-showdown").on ("click", function(){ load_debug(this, false) }); $(".btn-showlevel").on ("click", function(){ showlevel(this.id) }); $(".btn-showpeer").on ("click", function(){ showpeer(this.id) }); - $("#btn-showall").on ("click", function(){ showall() }); - $("#btn-shownone").on ("click", function(){ shownone() }); + $(".btn-showcomp").on ("click", function(){ showcomp(this.id) }); + $(".btn-showall").on ("click", function(){ showall(this) }); + $(".btn-shownone").on ("click", function(){ shownone(this) }); }); -- cgit v1.2.3