Skip to content

Commit

Permalink
[JENKINS-42359] Search box to filter jobs/agents (#35)
Browse files Browse the repository at this point in the history
* Initial approach to filter job names

Change-Id: I2e4fca42970154763ca79aa0034ee3840cb01bb3

* Filtering Agents and Jobs altogether

Change-Id: I055ff4f1d0590b92531062343b18d7a3d32575e7
  • Loading branch information
v1v committed Aug 15, 2017
1 parent 4637878 commit be509f7
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 1 deletion.
@@ -0,0 +1,10 @@
#filter-box {
background: white url('search.gif') no-repeat 2px center;
padding-left: 20px;
width: 15em;
}

#filter-container {
margin: 1em;
text-align: right;
}
@@ -0,0 +1,29 @@
Behaviour.specify("#filter-box", '_table', 0, function(e) {
function applyFilter() {
var filter = e.value.toLowerCase();
["jenkinsLintTable","jenkinsSlaveTable"].each(function(clz) {
// Declare variables
var input, filter, table, tr, td, i;
input = document.getElementById("filter-box");
filter = input.value.toUpperCase();
table = document.getElementById(clz);
tr = table.getElementsByTagName("tr");

// Loop through all table rows, and hide those who don't match the search query
for (i = 0; i < tr.length; i++) {
td = tr[i].getElementsByTagName("td")[0];
if (td) {
if (td.innerHTML.toUpperCase().indexOf(filter) > -1) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
}
});

layoutUpdateCallback.call();
}

e.onkeyup = applyFilter;
});
@@ -1,5 +1,5 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout">
<j:jelly xmlns:j="jelly:core" xmlns:l="/lib/layout" xmlns:st="jelly:stapler">
<j:getStatic var="permission" className="hudson.model.Item" field="CREATE"/>
<l:layout norefresh="true" permission="${permission}" title="${%Jenkins.Lint.Title}">
<l:side-panel>
Expand All @@ -24,10 +24,16 @@
<j:set var="data" value="${it.data}"/>
<h1>${%Jenkins.Lint.Title}</h1>
<j:if test="${(filter == null) or (filter == 'job')}">

<h4>${%Jenkins.Lint.Description}</h4>
${%Jenkins.Lint.Description.1}
${%Jenkins.Lint.Description.2}
<br/>
<st:adjunct includes="org.jenkins.ci.plugins.jenkinslint.JenkinsLintAction._table"/>
<div id="filter-container">
${%Filter}:
<input type="text" id="filter-box" />
</div>
<table class="sortable pane bigtable" id="jenkinsLintTable">
<thead>
<tr>
Expand Down
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit be509f7

Please sign in to comment.