Patchwork [bitbake-devel,64/94] bitbake: webhob: refactor column hiding code

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

Comments

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

We're refactoring the column show/hide code to get it
more generic, and easier to apply it to all table pages.

Signed-off-by: Alexandru DAMIAN <alexandru.damian@intel.com>
---
 bitbake/lib/webhob/bldviewer/templates/build.html | 6 +++---
 bitbake/lib/webhob/bldviewer/views.py             | 6 +++++-
 2 files changed, 8 insertions(+), 4 deletions(-)

Patch

diff --git a/bitbake/lib/webhob/bldviewer/templates/build.html b/bitbake/lib/webhob/bldviewer/templates/build.html
index aa92929..5db72db 100644
--- a/bitbake/lib/webhob/bldviewer/templates/build.html
+++ b/bitbake/lib/webhob/bldviewer/templates/build.html
@@ -7,9 +7,9 @@ 
 <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> |
+{% for i in hideshowcols %}
+    <span>{{i.name}} <input type="checkbox" id="ct{{i.name}}" onchange="showhideTableColumn({{i.order}}, $('#ct{{i.name}}').is(':checked'))" checked autocomplete="off"></span> |
+{% endfor %}
 </div>
 </div>
     <table border="1">
diff --git a/bitbake/lib/webhob/bldviewer/views.py b/bitbake/lib/webhob/bldviewer/views.py
index ab69c91..2ef905a 100644
--- a/bitbake/lib/webhob/bldviewer/views.py
+++ b/bitbake/lib/webhob/bldviewer/views.py
@@ -12,7 +12,11 @@  def build(request):
     build_info = Build.objects.all()
     logs = LogMessage.objects.all()
 
-    context = {'builds': build_info, 'logs': logs }
+    context = {'builds': build_info, 'logs': logs , 
+        'hideshowcols' : [
+                {'name': 'Output', 'order':10},
+                {'name': 'Log', 'order':11},
+            ]}
 
     return render(request, template, context)