[projects/pld-ftp-admin] html/qa: add filtering to errors
glen
glen at pld-linux.org
Sat Mar 19 17:32:17 CET 2016
commit 95dbdd8ce58ef82dc21c8eec170b6cbcc4fcfd12
Author: Elan Ruusamäe <glen at pld-linux.org>
Date: Sat Mar 19 18:30:41 2016 +0200
html/qa: add filtering to errors
html/qa.php | 32 ++++++++++++++++++++++++++++++--
1 file changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/html/qa.php b/html/qa.php
index cdc8dd5..61c014d 100644
--- a/html/qa.php
+++ b/html/qa.php
@@ -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);
}
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/projects/pld-ftp-admin.git/commitdiff/95dbdd8ce58ef82dc21c8eec170b6cbcc4fcfd12
More information about the pld-cvs-commit
mailing list