forked from v1v/jenkinslint-plugin
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[JENKINS-42359] Search box to filter jobs/agents (#35)
* Initial approach to filter job names Change-Id: I2e4fca42970154763ca79aa0034ee3840cb01bb3 * Filtering Agents and Jobs altogether Change-Id: I055ff4f1d0590b92531062343b18d7a3d32575e7
- Loading branch information
Showing
4 changed files
with
46 additions
and
1 deletion.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
src/main/resources/org/jenkins/ci/plugins/jenkinslint/JenkinsLintAction/_table.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
29 changes: 29 additions & 0 deletions
29
src/main/resources/org/jenkins/ci/plugins/jenkinslint/JenkinsLintAction/_table.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file added
BIN
+591 Bytes
src/main/resources/org/jenkins/ci/plugins/jenkinslint/JenkinsLintAction/search.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.