From 09b0a164a354806e1017a1bf36c413701e1e4c97 Mon Sep 17 00:00:00 2001 From: Marco Malavolti <marco.malavolti@gmail.com> Date: Sun, 14 Jun 2020 02:28:15 +0200 Subject: [PATCH] Improved Web Gui with Status Filter --- web/index.php | 8 +++++++- web/script.js | 21 ++++++++++++++++----- 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/web/index.php b/web/index.php index 8bead0e..27d92bc 100644 --- a/web/index.php +++ b/web/index.php @@ -13,6 +13,13 @@ <title>eduGAIN Connectivity Check Service 2</title> </head> <body> + <hr> + <div id="status"> + <input type="checkbox" name="status" value="ERROR">ERROR + <input type="checkbox" name="status" value="OK">OK + <input type="checkbox" name="status" value="DISABLE">DISABLE + </div> + <hr> <div class="container"> <table id="eccstable" class="display" style="width:100%"> <thead> @@ -21,7 +28,6 @@ <th>DisplayName</th> <th>EntityID</th> <th>Registration Authority</th> - <th>Technical Contacts</th> <th>Check Date</th> <th>Status</th> </tr> diff --git a/web/script.js b/web/script.js index d40d296..2227645 100644 --- a/web/script.js +++ b/web/script.js @@ -36,6 +36,8 @@ $(document).ready(function() { "url": "data.json", "dataSrc": "" }, + "lengthMenu": [[10, 20, 30, 40, 50, 100, -1], [10, 20, 30, 40, 50, 100, "All"]], + "autoWidth": false, "columns": [ { "className": 'details-control', @@ -50,14 +52,12 @@ $(document).ready(function() { { "data": "entityID" }, { "data": "registrationAuthority" }, { - "data": "contacts.technical", - "defaultContent": "" - }, - { "data": "date", + "data": "date", "width": "180px", "className": "dt-body-center" }, - { "data": "status", + { + "data": "status", "className": "dt-body-center" } ], @@ -91,4 +91,15 @@ $(document).ready(function() { tr.addClass('shown'); } } ); + + $('input:checkbox').on('change', function () { + //build a regex filter string with an or(|) condition + var sts = $('input:checkbox[name="status"]:checked').map(function() { + return this.value; + }).get().join('|'); + + //filter in column 5, with an regex, no smart filtering, not case sensitive + table.column(5).search(sts, true, false, false).draw(false); + }); + } ); -- GitLab