Skip to content

Commit

Permalink
Merge pull request #1360 from giraffate/add_a_filter_to_the_triage_da…
Browse files Browse the repository at this point in the history
…shboard

Add a filter to the triage dashboard
  • Loading branch information
Mark-Simulacrum authored May 31, 2021
2 parents 67f108c + 8d05684 commit dbbcb0f
Showing 1 changed file with 51 additions and 1 deletion.
52 changes: 51 additions & 1 deletion templates/triage/pulls.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,61 @@
border-radius:2;
}
</style>
<script>
function filter() {
var input, filter, table, tr, i, txtValue;
input = document.getElementById("filter-input");
filter = input.value;
table = document.getElementById("pr-table");
tr = table.getElementsByTagName("tr");

filters = filter.split(' ').map(function(x) {
return x.split(':');
});


for (i = 0; i < tr.length; i++) {
filters.forEach(function(flt) {
if (flt.length == 2) {
var td;
switch (flt[0]) {
case 'label':
case '-label':
td = tr[i].getElementsByTagName("td")[6];
break;
case 'assignee':
case '-assignee':
td = tr[i].getElementsByTagName("td")[5];
break;
case 'author':
case '-author':
td = tr[i].getElementsByTagName("td")[4];
break;
}
if (td) {
txtValue = td.textContent || td.innerText;
console.log(flt[0].charAt(0));
if ((flt[0].charAt(0) != '-' && txtValue.indexOf(flt[1]) > -1)
|| (flt[0].charAt(0) == '-' && txtValue.indexOf(flt[1]) <= -1)) {
tr[i].style.display = "";
} else {
tr[i].style.display = "none";
}
}
} else {
tr[i].style.display = "";
}
});
}
}
</script>
</head>

<body>
<h1>Triage dashboard - <a href="https://github.com/{{ owner }}/{{ repo }}">{{ owner }}/{{ repo }}</a></h1>
<table>
<input id="filter-input" type="search" style="width: 400px;">
<input type="submit" value="filter" onclick="filter()">
<table id="pr-table">
<thead>
<tr>
<th>#</th>
Expand Down

0 comments on commit dbbcb0f

Please sign in to comment.