summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Rękorajski2021-01-16 19:57:11 (GMT)
committerJan Rękorajski2021-01-16 19:57:11 (GMT)
commit11c36e0f8d3d0c89bffd65eab0370c4b5169e2bf (patch)
tree9c0bc1bd7106ee3e4817a9d11464531900cdf727
parent6f15d422c09c8a41d6496b4453b275762804a9a5 (diff)
downloadpld-ftp-admin-11c36e0f8d3d0c89bffd65eab0370c4b5169e2bf.zip
pld-ftp-admin-11c36e0f8d3d0c89bffd65eab0370c4b5169e2bf.tar.gz
Add filter-out feature to rpmqa query page (adamg?)
-rw-r--r--html/qa.php74
1 files changed, 44 insertions, 30 deletions
diff --git a/html/qa.php b/html/qa.php
index a24416e..4a74ff3 100644
--- a/html/qa.php
+++ b/html/qa.php
@@ -1,42 +1,20 @@
-<html>
+<!doctype html>
+<html lang='en'>
<head>
<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; }
+ .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>
-jQuery(function($) {
- $('#q').on('change', function(e) {
- var el = e.target;
- var o = el.options;
- 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>
<?php
+// (c) -2019 PLD developers
+// filter-out feature - adamg
+
$report = isset($_GET['q']) ? basename($_GET['q']) : null;
$reports = array(
"main" => "Main deps x86_64",
@@ -72,7 +50,8 @@ function reports_selection($reports) {
* Create text input for filtering results
*/
function filter_box() {
- echo '<br>Filter results: <input id="filter">';
+ echo '<br>Filter results: <input id="filter" class="filter">';
+ echo '<br>Filter-out (grep -v) <input id="filter_out" class="filter">';
echo '<br><span id="count">?</span> errors';
}
@@ -99,5 +78,40 @@ if (isset($reports[$report])) {
}
?>
+<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
+<script>
+jQuery(function($) {
+ $('#q').on('change', function(e) {
+ var el = e.target;
+ var o = el.options;
+ var v = o[o.selectedIndex].value;
+ location.href = "?q=" + v;
+ });
+
+ var $lines = $('#lines>li');
+ var $count = $('#count');
+ $('.filter').on('keyup', function() {
+ var filter_in = $('#filter').val();
+ var filter_out = $('#filter_out').val().trim();
+ var do_filter_out = filter_out.length > 0;
+ var count = 0;
+ $lines.each(function() {
+ var $line = $(this);
+ var text = $line.text();
+ // everything is visible by default
+ $line.removeClass('hidden');
+ count++;
+ // but we hide lines that do not match filter
+ // OR match non-empty filter-out
+ if ( ! text.match(filter_in) || (do_filter_out && text.match(filter_out)) ) {
+ $line.addClass('hidden');
+ count--;
+ }
+ });
+ $count.html(count);
+ });
+ $count.html($lines.length);
+});
+</script>
</body>
</html>