summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Magorsch <arzano@gentoo.org>2020-06-07 20:39:47 +0000
committerMax Magorsch <arzano@gentoo.org>2020-06-07 20:39:47 +0000
commit0c18044a46251aeefb66a8145f75d964ccbe691c (patch)
treee72c92e0b0a973af0575fddf5b726776909c7b46
parentShow the tls version for https mirrors only (diff)
downloadgentoo-mirrorstats-0c18044a46251aeefb66a8145f75d964ccbe691c.tar.gz
gentoo-mirrorstats-0c18044a46251aeefb66a8145f75d964ccbe691c.tar.bz2
gentoo-mirrorstats-0c18044a46251aeefb66a8145f75d964ccbe691c.zip
Add filters
Signed-off-by: Max Magorsch <arzano@gentoo.org>
-rw-r--r--html/stats.jinja231
1 files changed, 31 insertions, 0 deletions
diff --git a/html/stats.jinja2 b/html/stats.jinja2
index 98d8474..482a2cf 100644
--- a/html/stats.jinja2
+++ b/html/stats.jinja2
@@ -8,6 +8,13 @@
<link href="https://www.gentoo.org/assets/css/leaflet.css" rel="stylesheet" media="screen">
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/bs4/dt-1.10.21/b-1.6.2/b-colvis-1.6.2/b-print-1.6.2/rg-1.1.2/datatables.min.css"/>
<link rel="icon" href="https://www.gentoo.org/favicon.ico" type="image/x-icon">
+ <style>
+ .filter-button, .filter-button:hover {
+ color: #495057;
+ background-color: #fff;
+ border: 1px solid #ced4da;
+ }
+ </style>
</head>
<body>
@@ -345,6 +352,7 @@
],
"initComplete": function( settings, json ) {
setTimeout(function(){
+ $('#table_id_length').prepend("<button onclick='addFilters();' class='btn btn-outline-secondary filter-button btn-sm mr-4'>Toggle Filters</button>");
table.buttons().container().prependTo($('#table_id_length'));
$('#table_id_length').prepend("<span class='mr-1'> Show </span>");
document.getElementsByClassName("buttons-colvis")[0].classList = "custom-select custom-select-sm form-control form-control-sm mr-4";
@@ -353,6 +361,29 @@
});
} );
+ function addFilters(){
+
+ if($("#filterRow").length) {
+ $("#filterRow").remove();
+ }else{
+ $('#table_id thead tr').clone(true).appendTo('#table_id thead');
+ $('#table_id thead tr:eq(1)').attr("id", "filterRow");
+ $('#table_id thead tr:eq(1) th').each(function (i) {
+ var title = $(this).text();
+ $(this).html('<input type="text" placeholder="Search ' + title + '" />');
+
+ $('input', this).on('keyup change', function () {
+ if (table.column(i).search() !== this.value) {
+ table
+ .column(i)
+ .search(this.value)
+ .draw();
+ }
+ });
+ });
+ }
+ }
+
</script>
</body>