Browse Source

HUE-6870 [jb] Add filter on Job properties tab

Romain Rigaux 8 years ago
parent
commit
1655b8e
1 changed files with 14 additions and 1 deletions
  1. 14 1
      apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

+ 14 - 1
apps/jobbrowser/src/jobbrowser/templates/job_browser.mako

@@ -1317,7 +1317,11 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
 <script type="text/html" id="render-properties${ SUFFIX }">
   <!-- ko hueSpinner: { spin: !$data.properties, center: true, size: 'xlarge' } --><!-- /ko -->
   <!-- ko if: $data.properties -->
-  <table class="table table-condensed">
+  <form class="form-search">
+    <input type="text" data-bind="clearable: $parent.propertiesFilter, valueUpdate: 'afterkeydown'" class="input-xlarge search-query" placeholder="${_('Text Filter')}">
+  </form>
+  <br>
+  <table id="jobbrowserJobPropertiesTable" class="table table-condensed">
     <thead>
     <tr>
       <th>${ _('Name') }</th>
@@ -1567,6 +1571,15 @@ ${ commonheader("Job Browser", "jobbrowser", user, request) | n,unicode }
           }
         });
       });
+      self.propertiesFilter = ko.observable('');
+      self.propertiesFilter.subscribe(function(newValue) {
+        $("#jobbrowserJobPropertiesTable tbody tr").removeClass("hide");
+        $("#jobbrowserJobPropertiesTable tbody tr").each(function () {
+          if ($(this).text().toLowerCase().indexOf(newValue.toLowerCase()) == -1) {
+            $(this).addClass("hide");
+          }
+        });
+      });
 
       self.rerunModalContent = ko.observable('');