Patchwork [bitbake-devel,63/94] bitbake: webhob: add search functionality to the Simple interface

login
register
mail settings
Submitter Alexandru DAMIAN
Date Sept. 24, 2013, 4:52 p.m.
Message ID <97735b2a1b5e37ff1962901c1776606b7db429c8.1380041477.git.alexandru.damian@intel.com>
Download mbox | patch
Permalink /patch/58753/
State New
Headers show

Comments

Alexandru DAMIAN - Sept. 24, 2013, 4:52 p.m.
From: Alexandru DAMIAN <alexandru.damian@intel.com>

We add generic table search function for the builds table,
and make it generic to be able to expand to all other table views.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/webhob/bldviewer/templates/base.html    | 12 +++++++++++-
 bitbake/lib/webhob/bldviewer/templates/build.html   | 12 +++++++-----
 bitbake/lib/webhob/bldviewer/templates/package.html |  2 +-
 3 files changed, 19 insertions(+), 7 deletions(-)

Patch

diff --git a/bitbake/lib/webhob/bldviewer/templates/base.html b/bitbake/lib/webhob/bldviewer/templates/base.html
index 3f056a0..45f8652 100644
--- a/bitbake/lib/webhob/bldviewer/templates/base.html
+++ b/bitbake/lib/webhob/bldviewer/templates/base.html
@@ -17,7 +17,17 @@  function showhideTableColumn(i, sh) {
         $('td:nth-child('+i+'),th:nth-child('+i+')').show();
     else
         $('td:nth-child('+i+'),th:nth-child('+i+')').hide();
-g
+}
+
+
+function filterTableRows(test) {
+    if (test.length > 0) {
+        var r = new RegExp(test);
+        $('tr.data').map( function (i, el) { if (! r.test($(el).html())) {$(el).hide()} else $(el).show()});
+    } else
+    {
+        $('tr.data').show();
+    }
 }
 </script>
 
diff --git a/bitbake/lib/webhob/bldviewer/templates/build.html b/bitbake/lib/webhob/bldviewer/templates/build.html
index e30801b..aa92929 100644
--- a/bitbake/lib/webhob/bldviewer/templates/build.html
+++ b/bitbake/lib/webhob/bldviewer/templates/build.html
@@ -3,14 +3,16 @@ 
 {% block pagecontent %}
     <h1>WebHob Builds</h1>
 
-    <table border="1">
-
-<div align="right" style="display: float">Show/Hide columns:
+<div style="padding-top:1em ;padding-bottom: 1em">
+<div align="left" style="display:inline-block; width: 49%"> Search: <input type="search" id="filterstring" style="width: 30em" onkeyup="filterTableRows($('#filterstring').val())" autocomplete="off">
+</div>
+<div align="right" style="display: inline-block; width: 49%">Show/Hide columns:
 <span>Output: <input type="checkbox" id="ctoutput" onchange="showhideTableColumn(10, $('#ctoutput').is(':checked'))" checked autocomplete="off"></span> |
 <span>Log: <input type="checkbox" id="ctlog" onchange="showhideTableColumn(11, $('#ctlog').is(':checked'))"checked autocomplete="off"></span> |
 <span>Build Name: <input type="checkbox" id="ctbuildname" onchange="showhideTableColumn(13, $('#ctbuildname').is(':checked'))" checked autocomplete="off"></span> |
 </div>
-
+</div>
+    <table border="1">
     {% load projecttags %}
 
         <tr>
@@ -31,7 +33,7 @@ 
 
         {% for build in builds %}
 
-        <tr>
+        <tr class="data">
             <td><a href="/simple/build/{{build.id}}/task/">{{build.get_outcome_display}}</a></td>
             <td>{{build.started_on}}</td>
             <td>{{build.completed_on}}</td>
diff --git a/bitbake/lib/webhob/bldviewer/templates/package.html b/bitbake/lib/webhob/bldviewer/templates/package.html
index d31ecbb..d1259e9 100644
--- a/bitbake/lib/webhob/bldviewer/templates/package.html
+++ b/bitbake/lib/webhob/bldviewer/templates/package.html
@@ -19,7 +19,7 @@ 
 
             {% for package in packages %}
 
-                <tr>
+                <tr class="data">
                 <td><a name="#{{package.name}}">{{package.name}}</a></td>
                 <td>{{package.version}}</td>
                 <td>{{package.size}}</td>