]> git.pld-linux.org Git - projects/pld-ftp-admin.git/commitdiff
html/qa: add filtering to errors
authorElan Ruusamäe <glen@pld-linux.org>
Sat, 19 Mar 2016 16:30:41 +0000 (18:30 +0200)
committerElan Ruusamäe <glen@pld-linux.org>
Sat, 19 Mar 2016 16:31:30 +0000 (18:31 +0200)
html/qa.php

index cdc8dd514ad768c9b09a3ebd8e8a71fdc2450b59..61c014d6b7b322e4b08d6294bc512ff1261d4b3d 100644 (file)
@@ -3,6 +3,10 @@
 <link rel="Shortcut Icon" href="//www.pld-linux.org/favicon.ico"/>
        <title>PLD QA Reports</title>
        <link rel="stylesheet" type="text/css" charset="utf-8" media="all" href="//srcbuilder.pld-linux.org/th/style.css">
+       <style>
+       .hidden { display: none; }
+       span#count { font-weight: bold; }
+       </style>
 </head>
 <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
 <script>
@@ -13,6 +17,21 @@ jQuery(function($) {
                var v = o[o.selectedIndex].value;
                location.href = "?q=" + v;
        });
+
+       var $lines = $('#lines>li');
+       var $count = $('#count');
+       $('#filter').on('keyup', function() {
+               var search = $(this).val();
+               var count = 0;
+               $lines.each(function() {
+                       var $line = $(this);
+                       var text = $line.text();
+                       var fn = text.match(search) && ++count ? 'removeClass' : 'addClass';
+                       $line[fn]('hidden');
+               });
+               $count.html(count);
+       });
+       $count.html($lines.length);
 });
 </script>
 <body>
@@ -48,11 +67,19 @@ function reports_selection($reports) {
        echo "</select>\n";
 }
 
+/**
+ * Create text input for filtering results
+ */
+function filter_box() {
+       echo '<br>Filter results: <input id="filter">';
+       echo '<br><span id="count">?</span> errors';
+}
+
 function format_report($report) {
-       echo "<a href=$report.txt>raw</a><br/>\n";
+       echo "<br>View the <a href=$report.txt>raw</a> report<br/>\n";
        $file = "$report.txt";
        $giturl = 'http://git.pld-linux.org/gitweb.cgi?p=packages/%1$s.git;f=%1$s.spec;h=HEAD;a=shortlog';
-       echo '<ol>';
+       echo '<ol id="lines">';
        foreach (file($file) as $line) {
                $line = preg_replace_callback('/^(?P<prefix>error:|GIT:)\s*\[(?P<spec>[^]]+)\]\s*(?P<msg>.+)$/', function($m) use ($giturl) {
                        $package = basename($m['spec'], '.spec');
@@ -65,6 +92,7 @@ function format_report($report) {
 }
 
 reports_selection($reports);
+filter_box();
 if (isset($reports[$report])) {
        format_report($report);
 }
This page took 0.201905 seconds and 4 git commands to generate.