Skip to content
Snippets Groups Projects
Commit bba1bc6a authored by Valentin Pocotilenco's avatar Valentin Pocotilenco
Browse files

issue 1 and 2 : solved

parent d2f423c7
No related branches found
No related tags found
1 merge request!1Feature request2
...@@ -2,143 +2,146 @@ ...@@ -2,143 +2,146 @@
var table; var table;
var url = "/eccs/api/eccsresults?eccsdt=1"; var url = "/eccs/api/eccsresults?eccsdt=1";
var infoCircle = '<a href="https://wiki.geant.org/display/eduGAIN/eduGAIN+Connectivity+Check+2#eduGAINConnectivityCheck2-Statusesandresults"><i class="fas fa-info-circle"></i></a>'; var infoCircle = '<a href="https://wiki.geant.org/display/eduGAIN/eduGAIN+Connectivity+Check+2#eduGAINConnectivityCheck2-Statusesandresults"><i class="fas fa-info-circle"></i></a>';
var dateFrom;
var dateTo;
/* /*
* Secure Hash Algorithm (SHA1) * Secure Hash Algorithm (SHA1)
* https://www.webtoolkit.info/javascript_sha1.html * https://www.webtoolkit.info/javascript_sha1.html
*/ */
function SHA1(msg) { function SHA1(msg) {
function rotate_left(n,s) { function rotate_left(n, s) {
var t4 = ( n<<s ) | (n>>>(32-s)); var t4 = (n << s) | (n >>> (32 - s));
return t4; return t4;
}; };
function lsb_hex(val) {
var str='';
var i;
var vh;
var vl;
for( i=0; i<=6; i+=2 ) {
vh = (val>>>(i*4+4))&0x0f;
vl = (val>>>(i*4))&0x0f;
str += vh.toString(16) + vl.toString(16);
}
return str;
};
function cvt_hex(val) {
var str='';
var i;
var v;
for( i=7; i>=0; i-- ) {
v = (val>>>(i*4))&0x0f;
str += v.toString(16);
}
return str;
};
function Utf8Encode(string) {
string = string.replace(/\r\n/g,'\n');
var utftext = '';
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
}
else if((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
}
else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
var blockstart;
var i, j;
var W = new Array(80);
var H0 = 0x67452301;
var H1 = 0xEFCDAB89;
var H2 = 0x98BADCFE;
var H3 = 0x10325476;
var H4 = 0xC3D2E1F0;
var A, B, C, D, E;
var temp;
msg = Utf8Encode(msg);
var msg_len = msg.length;
var word_array = new Array();
for( i=0; i<msg_len-3; i+=4 ) {
j = msg.charCodeAt(i)<<24 | msg.charCodeAt(i+1)<<16 |
msg.charCodeAt(i+2)<<8 | msg.charCodeAt(i+3);
word_array.push( j );
}
switch( msg_len % 4 ) {
case 0:
i = 0x080000000;
break;
case 1:
i = msg.charCodeAt(msg_len-1)<<24 | 0x0800000;
break;
case 2:
i = msg.charCodeAt(msg_len-2)<<24 | msg.charCodeAt(msg_len-1)<<16 | 0x08000;
break;
case 3:
i = msg.charCodeAt(msg_len-3)<<24 | msg.charCodeAt(msg_len-2)<<16 | msg.charCodeAt(msg_len-1)<<8 | 0x80;
break;
}
word_array.push( i );
while( (word_array.length % 16) != 14 ) word_array.push( 0 );
word_array.push( msg_len>>>29 );
word_array.push( (msg_len<<3)&0x0ffffffff );
for ( blockstart=0; blockstart<word_array.length; blockstart+=16 ) {
for( i=0; i<16; i++ ) W[i] = word_array[blockstart+i];
for( i=16; i<=79; i++ ) W[i] = rotate_left(W[i-3] ^ W[i-8] ^ W[i-14] ^ W[i-16], 1);
A = H0;
B = H1;
C = H2;
D = H3;
E = H4;
for( i= 0; i<=19; i++ ) {
temp = (rotate_left(A,5) + ((B&C) | (~B&D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for( i=20; i<=39; i++ ) {
temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for( i=40; i<=59; i++ ) {
temp = (rotate_left(A,5) + ((B&C) | (B&D) | (C&D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
for( i=60; i<=79; i++ ) {
temp = (rotate_left(A,5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B,30);
B = A;
A = temp;
}
H0 = (H0 + A) & 0x0ffffffff;
H1 = (H1 + B) & 0x0ffffffff;
H2 = (H2 + C) & 0x0ffffffff;
H3 = (H3 + D) & 0x0ffffffff;
H4 = (H4 + E) & 0x0ffffffff;
}
var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
return temp.toLowerCase(); function lsb_hex(val) {
var str = '';
var i;
var vh;
var vl;
for (i = 0; i <= 6; i += 2) {
vh = (val >>> (i * 4 + 4)) & 0x0f;
vl = (val >>> (i * 4)) & 0x0f;
str += vh.toString(16) + vl.toString(16);
}
return str;
};
function cvt_hex(val) {
var str = '';
var i;
var v;
for (i = 7; i >= 0; i--) {
v = (val >>> (i * 4)) & 0x0f;
str += v.toString(16);
}
return str;
};
function Utf8Encode(string) {
string = string.replace(/\r\n/g, '\n');
var utftext = '';
for (var n = 0; n < string.length; n++) {
var c = string.charCodeAt(n);
if (c < 128) {
utftext += String.fromCharCode(c);
} else if ((c > 127) && (c < 2048)) {
utftext += String.fromCharCode((c >> 6) | 192);
utftext += String.fromCharCode((c & 63) | 128);
} else {
utftext += String.fromCharCode((c >> 12) | 224);
utftext += String.fromCharCode(((c >> 6) & 63) | 128);
utftext += String.fromCharCode((c & 63) | 128);
}
}
return utftext;
};
var blockstart;
var i, j;
var W = new Array(80);
var H0 = 0x67452301;
var H1 = 0xEFCDAB89;
var H2 = 0x98BADCFE;
var H3 = 0x10325476;
var H4 = 0xC3D2E1F0;
var A, B, C, D, E;
var temp;
msg = Utf8Encode(msg);
var msg_len = msg.length;
var word_array = new Array();
for (i = 0; i < msg_len - 3; i += 4) {
j = msg.charCodeAt(i) << 24 | msg.charCodeAt(i + 1) << 16 |
msg.charCodeAt(i + 2) << 8 | msg.charCodeAt(i + 3);
word_array.push(j);
}
switch (msg_len % 4) {
case 0:
i = 0x080000000;
break;
case 1:
i = msg.charCodeAt(msg_len - 1) << 24 | 0x0800000;
break;
case 2:
i = msg.charCodeAt(msg_len - 2) << 24 | msg.charCodeAt(msg_len - 1) << 16 | 0x08000;
break;
case 3:
i = msg.charCodeAt(msg_len - 3) << 24 | msg.charCodeAt(msg_len - 2) << 16 | msg.charCodeAt(msg_len - 1) << 8 | 0x80;
break;
}
word_array.push(i);
while ((word_array.length % 16) != 14) word_array.push(0);
word_array.push(msg_len >>> 29);
word_array.push((msg_len << 3) & 0x0ffffffff);
for (blockstart = 0; blockstart < word_array.length; blockstart += 16) {
for (i = 0; i < 16; i++) W[i] = word_array[blockstart + i];
for (i = 16; i <= 79; i++) W[i] = rotate_left(W[i - 3] ^ W[i - 8] ^ W[i - 14] ^ W[i - 16], 1);
A = H0;
B = H1;
C = H2;
D = H3;
E = H4;
for (i = 0; i <= 19; i++) {
temp = (rotate_left(A, 5) + ((B & C) | (~B & D)) + E + W[i] + 0x5A827999) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B, 30);
B = A;
A = temp;
}
for (i = 20; i <= 39; i++) {
temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0x6ED9EBA1) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B, 30);
B = A;
A = temp;
}
for (i = 40; i <= 59; i++) {
temp = (rotate_left(A, 5) + ((B & C) | (B & D) | (C & D)) + E + W[i] + 0x8F1BBCDC) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B, 30);
B = A;
A = temp;
}
for (i = 60; i <= 79; i++) {
temp = (rotate_left(A, 5) + (B ^ C ^ D) + E + W[i] + 0xCA62C1D6) & 0x0ffffffff;
E = D;
D = C;
C = rotate_left(B, 30);
B = A;
A = temp;
}
H0 = (H0 + A) & 0x0ffffffff;
H1 = (H1 + B) & 0x0ffffffff;
H2 = (H2 + C) & 0x0ffffffff;
H3 = (H3 + D) & 0x0ffffffff;
H4 = (H4 + E) & 0x0ffffffff;
}
var temp = cvt_hex(H0) + cvt_hex(H1) + cvt_hex(H2) + cvt_hex(H3) + cvt_hex(H4);
return temp.toLowerCase();
} }
...@@ -149,214 +152,233 @@ function SHA1(msg) { ...@@ -149,214 +152,233 @@ function SHA1(msg) {
// status (the ECCS IdP Status) // status (the ECCS IdP Status)
// check_result (the ECCS check result) // check_result (the ECCS check result)
if (date) { if (date) {
url = url.concat("&date=" + date); url = url.concat("&date=" + date);
} }
if (reg_auth) { if (reg_auth) {
url = url.concat("&reg_auth=" + reg_auth); url = url.concat("&reg_auth=" + reg_auth);
} }
if (idp) { if (idp) {
url = url.concat("&idp=" + idp); url = url.concat("&idp=" + idp);
} }
if (status) { if (status) {
url = url.concat("&status=" + status); url = url.concat("&status=" + status);
} }
if (check_result) { if (check_result) {
url = url.concat("&check_result=" + check_result); url = url.concat("&check_result=" + check_result);
} }
function getPastResults() { function getPastResults() {
var checkDate = $.datepicker.formatDate("yy-mm-dd", $('#datepicker').datepicker().datepicker('getDate')); let dateFrom = $("#datepicker").data('daterangepicker').startDate.format('YYYY-MM-DD');
let dateTo = $("#datepicker").data('daterangepicker').endDate.format('YYYY-MM-DD');
url = "/eccs/api/eccsresults?eccsdt=1&date=" + checkDate; let getUrl = window.location;
$("#datepicker").datepicker("setDate",checkDate); let baseUrl = getUrl.protocol + "//" + getUrl.host + "/";
table.ajax.url( url ).load(); table.clear().draw();
var getUrl = window.location; // solution used to load each selected day separately
var baseUrl = getUrl .protocol + "//" + getUrl.host + "/" + getUrl.pathname.split('/')[1]; let iterator = moment(dateFrom);
let dataSourceIterator = baseUrl + "/eccs/api/eccsresults?eccsdt=1&date=";
while (iterator.isSameOrBefore(moment(dateTo), 'day')) {
//$.get(dataSourceIterator + iterator.format('YYYY-MM-DD'), // <<< PROD
$.get('http://localhost/eccs/text_' + iterator.format('YYYY-MM-DD') + '.json', /// <<< TEST
function(data) {
table.rows.add(data).draw();
});
iterator.add(1, 'days');
}
document.location.href = baseUrl + "?date=" + checkDate; // solution used to load entire data set at once
//let dataSource = baseUrl + "/eccs/api/eccsresults?eccsdt=1&dateFrom=" + dateFrom + "&dateTo=" + dateTo;
//table.ajax.url(dataSource).load();
} }
// use URL constructor and return hostname // use URL constructor and return hostname
function getHostname(url) { function getHostname(url) {
if (url == ""){ if (url == "") {
return null return null
} }
const urlNew = new URL(url); const urlNew = new URL(url);
if (urlNew.hostname){ if (urlNew.hostname) {
return urlNew.hostname; return urlNew.hostname;
} } else {
else { return url.replace(/.+:/g, '');
return url.replace(/.+:/g, ''); }
}
} }
function getCheckResult(checkResult){ function getCheckResult(checkResult) {
if (checkResult == "OK"){ if (checkResult == "OK") {
return '<div class="tooltip">OK <span class="tooltiptext tooltip-top tooltip-ok">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div> '+infoCircle; return '<div class="tooltip">OK <span class="tooltiptext tooltip-top tooltip-ok">The IdP is consuming correctly the eduGAIN metadata and return a valid login page</span></div> ' + infoCircle;
} } else if (checkResult == "Timeout") {
else if (checkResult == "Timeout"){ return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top tooltip-timeout">The IdP does not load a valid login page within 30 seconds</span></div> ' + infoCircle;
return '<div class="tooltip">Timeout <span class="tooltiptext tooltip-top tooltip-timeout">The IdP does not load a valid login page within 30 seconds</span></div> '+infoCircle; } else if (checkResult == "Invalid-Form") {
} return '<div class="tooltip">Invalid Form <span class="tooltiptext tooltip-top tooltip-invalid-form">The IdP does not load a valid login page</span></div> ' + infoCircle;
else if (checkResult == "Invalid-Form"){ } else if (checkResult == "Connection-Error") {
return '<div class="tooltip">Invalid Form <span class="tooltiptext tooltip-top tooltip-invalid-form">The IdP does not load a valid login page</span></div> '+infoCircle; return '<div class="tooltip">Connection Error <span class="tooltiptext tooltip-top tooltip-invalid-form">Check failed due a connection error</span></div> ' + infoCircle;
} } else if (checkResult == "No-eduGAIN-Metadata") {
else if (checkResult == "Connection-Error"){ return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top tooltip-no-edugain-metadata">The IdP is not consuming correctly edugGAIN metadata stream</span></div> ' + infoCircle
return '<div class="tooltip">Connection Error <span class="tooltiptext tooltip-top tooltip-invalid-form">Check failed due a connection error</span></div> '+infoCircle; } else if (checkResult == "SSL-Error") {
} return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top tooltip-ssl-error">The IdP has a problem on its SSL certificate</span></div> ' + infoCircle;
else if (checkResult == "No-eduGAIN-Metadata"){ } else if (checkResult == "IdP-Error") {
return '<div class="tooltip">No-eduGAIN-Metadata <span class="tooltiptext tooltip-top tooltip-no-edugain-metadata">The IdP is not consuming correctly edugGAIN metadata stream</span></div> '+infoCircle return '<div class="tooltip">IdP-Error <span class="tooltiptext tooltip-top tooltip-idp-error">The IdP reported an error</span></div> ' + infoCircle
} } else if (checkResult == "DISABLED") {
else if (checkResult == "SSL-Error"){ return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top tooltip-disabled">The check has been disabled for the IdP</span></div> ' + infoCircle;
return '<div class="tooltip">SSL-Error <span class="tooltiptext tooltip-top tooltip-ssl-error">The IdP has a problem on its SSL certificate</span></div> '+infoCircle; } else {
} return checkResult;
else if (checkResult == "IdP-Error"){ }
return '<div class="tooltip">IdP-Error <span class="tooltiptext tooltip-top tooltip-idp-error">The IdP reported an error</span></div> '+infoCircle
}
else if (checkResult == "DISABLED"){
return '<div class="tooltip">Disabled <span class="tooltiptext tooltip-top tooltip-disabled">The check has been disabled for the IdP</span></div> '+infoCircle;
}
else{
return checkResult;
}
} }
/* Formatting function for row details - modify as you need */ /* Formatting function for row details - modify as you need */
function format ( d ) { function format(d) {
// `d` is the original data object for the row // `d` is the original data object for the row
return '<table id="inner-table">'+ return '<table id="inner-table">' +
'<tr>'+ '<tr>' +
'<td class="strong">IdP DisplayName:</td>'+ '<td class="strong">IdP DisplayName:</td>' +
'<td>'+d.displayName+'</td>'+ '<td>' + d.displayName + '</td>' +
'</tr>'+ '</tr>' +
'<tr>'+ '<tr>' +
'<td class="strong">Technical Contacts:</td>'+ '<td class="strong">Technical Contacts:</td>' +
'<td>'+d.contacts.technical+'</td>'+ '<td>' + d.contacts.technical + '</td>' +
'</tr>'+ '</tr>' +
'<tr>'+ '<tr>' +
'<td class="strong">Support Contacts:</td>'+ '<td class="strong">Support Contacts:</td>' +
'<td>'+d.contacts.support+'</td>'+ '<td>' + d.contacts.support + '</td>' +
'<td class="strong">Check Time</td>'+ '<td class="strong">Check Time</td>' +
'<td class="strong">Check Result</td>'+ '<td class="strong">Check Result</td>' +
//'<td class="strong">HTTP Code</td>'+ //'<td class="strong">HTTP Code</td>'+
'<td class="strong">Page Source</td>'+ '<td class="strong">Page Source</td>' +
'<td class="strong">Retry Check</td>'+ '<td class="strong">Retry Check</td>' +
'</tr>'+ '</tr>' +
'<tr>'+ '<tr>' +
'<td class="strong">SP1:</td>'+ '<td class="strong">SP1:</td>' +
'<td>https://'+getHostname(d.sp1.wayflessUrl)+'</td>'+ '<td>https://' + getHostname(d.sp1.wayflessUrl) + '</td>' +
'<td>'+d.sp1.checkTime+'</td>'+ '<td>' + d.sp1.checkTime + '</td>' +
'<td>'+getCheckResult(d.sp1.checkResult)+'</td>'+ '<td>' + getCheckResult(d.sp1.checkResult) + '</td>' +
//'<td>'+d.sp1.httpCode+'</td>'+ //'<td>'+d.sp1.httpCode+'</td>'+
'<td><a href="/eccs/html/'+d.date+'/'+SHA1(d.entityID)+'---'+getHostname(d.sp1.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="/eccs/html/' + d.date + '/' + SHA1(d.entityID) + '---' + getHostname(d.sp1.wayflessUrl) + '.html" target="_blank">Click to open</a></td>' +
'<td><a href="'+d.sp1.wayflessUrl+'" target="_blank">Click to retry</a></td>'+ '<td><a href="' + d.sp1.wayflessUrl + '" target="_blank">Click to retry</a></td>' +
'</tr>'+ '</tr>' +
'<tr>'+ '<tr>' +
'<td class="strong">SP2:</td>'+ '<td class="strong">SP2:</td>' +
'<td>https://'+getHostname(d.sp2.wayflessUrl)+'</td>'+ '<td>https://' + getHostname(d.sp2.wayflessUrl) + '</td>' +
'<td>'+d.sp2.checkTime+'</td>'+ '<td>' + d.sp2.checkTime + '</td>' +
'<td>'+getCheckResult(d.sp2.checkResult)+'</td>'+ '<td>' + getCheckResult(d.sp2.checkResult) + '</td>' +
//'<td>'+d.sp2.httpCode+'</td>'+ //'<td>'+d.sp2.httpCode+'</td>'+
'<td><a href="/eccs/html/'+d.date+'/'+SHA1(d.entityID)+'---'+getHostname(d.sp2.wayflessUrl)+'.html" target="_blank">Click to open</a></td>'+ '<td><a href="/eccs/html/' + d.date + '/' + SHA1(d.entityID) + '---' + getHostname(d.sp2.wayflessUrl) + '.html" target="_blank">Click to open</a></td>' +
'<td><a href="'+d.sp2.wayflessUrl+'" target="_blank">Click to retry</a></td>'+ '<td><a href="' + d.sp2.wayflessUrl + '" target="_blank">Click to retry</a></td>' +
'</tr>'+ '</tr>' +
'</table>'; '</table>';
} }
$(document).ready(function() { $(document).ready(function() {
$("#datepicker").daterangepicker({
opens: 'left',
todayHighlight: 'TRUE',
autoApply: false,
defaultDate: new Date()
}, function(start, end, label) {
dateFrom = start.format('YYYY-MM-DD');
dateTo = end.format('YYYY-MM-DD');
}).on('apply.daterangepicker', function(ev, picker) {
getPastResults()
});
// Setup - add a text input to each footer cell // Setup - add a text input to each footer cell
$('#eccstable thead tr').clone(true).appendTo( '#eccstable thead' ); $('#eccstable thead tr').clone(true).appendTo('#eccstable thead');
$('#eccstable thead tr:not(:eq(1)) th').each( function (i) { $('#eccstable thead tr:not(:eq(1)) th').each(function(i) {
var title = $('#eccstable thead th').eq( $(this).index() ).text(); var title = $('#eccstable thead th').eq($(this).index()).text();
if($(this).index() !=0 && $(this).index() !=5) $(this).html( '<input type="text" placeholder="Search '+title+'" style="text-align:center;width: 100%;" />' ); if ($(this).index() != 0 && $(this).index() != 5) $(this).html('<input type="text" placeholder="Search ' + title + '" style="text-align:center;width: 100%;" />');
$( 'input', this ).on( 'keyup change', function () { $('input', this).on('keyup change', function() {
if ( table.column(i).search() !== this.value ) { if (table.column(i).search() !== this.value) {
table table
.column(i) .column(i)
.search( this.value ) .search(this.value)
.draw(); .draw();
} }
} ); });
} ); });
table = $('#eccstable').DataTable( { table = $('#eccstable').DataTable({
"responsive": "true", "responsive": "true",
"ajax": { "ajax": {
"url": url, "url": url,
"dataSrc": "" "dataSrc": ""
}, },
"lengthMenu": [[10, 30, 50, 100, -1], [10, 30, 50, 100, "All"]], "lengthMenu": [
[10, 30, 50, 100, -1],
[10, 30, 50, 100, "All"]
],
"autoWidth": false, "autoWidth": false,
"dom": '<"top"lip>rt<"bottom"><"clear">', "dom": '<"top"lip>rt<"bottom"><"clear">',
"columns": [ "columns": [{
{ "className": 'details-control',
"className": 'details-control', "orderable": false,
"orderable": false, "data": null,
"data": null, "defaultContent": ''
"defaultContent": ''
}, },
{ {
"data": "displayName", "data": "displayName",
"defaultContent": '' "defaultContent": ''
}, },
{ "data": "entityID" }, { "data": "entityID" },
{ "data": "registrationAuthority" }, { "data": "registrationAuthority" },
{ {
"data": "date", "data": "date",
"width": "180px", "width": "180px",
"className": "dt-body-center", "className": "dt-body-center",
"visible": false "visible": false
}, },
{ {
"data": "status", "data": "status",
"className": "dt-body-center", "className": "dt-body-center",
"visible": false "visible": false
} }
], ],
"rowCallback": function( row, data, index ) { "rowCallback": function(row, data, index) {
if (data.status == "ERROR") { if (data.status == "ERROR") {
//$('td', row).css('background-color', '#EA4335'); // NEW ECCS //$('td', row).css('background-color', '#EA4335'); // NEW ECCS
$('td', row).css('background-color', '#EA3D3F'); // OLD ECCS $('td', row).css('background-color', '#EA3D3F'); // OLD ECCS
//$('td', row).css('background-color', '#FF0000'); //$('td', row).css('background-color', '#FF0000');
//$('td', row).css('background-color', '#F22422'); //$('td', row).css('background-color', '#F22422');
} }
if (data.status == "DISABLED") { if (data.status == "DISABLED") {
$('td', row).css('background-color', '#FFFFFF'); $('td', row).css('background-color', '#FFFFFF');
} }
if (data.status == "OK") { if (data.status == "OK") {
//$('td', row).css('background-color', '#34A853'); //$('td', row).css('background-color', '#34A853');
//$('td', row).css('background-color', '#00CE00'); // NEW ECCS //$('td', row).css('background-color', '#00CE00'); // NEW ECCS
$('td', row).css('background-color', '#72F81B'); // OLD ECCS $('td', row).css('background-color', '#72F81B'); // OLD ECCS
} }
}, },
"order": [[1, 'asc']] "order": [
} ); [1, 'asc']
]
});
// Add event listener for opening and closing details // Add event listener for opening and closing details
$('#eccstable tbody').on('click', 'td.details-control', function () { $('#eccstable tbody').on('click', 'td.details-control', function() {
var tr = $(this).closest('tr'); var tr = $(this).closest('tr');
var row = table.row( tr ); var row = table.row(tr);
if ( row.child.isShown() ) { if (row.child.isShown()) {
// This row is already open - close it // This row is already open - close it
row.child.hide(); row.child.hide();
tr.removeClass('shown'); tr.removeClass('shown');
} } else {
else {
// Open this row // Open this row
row.child( format(row.data()) ).show(); row.child(format(row.data())).show();
tr.addClass('shown'); tr.addClass('shown');
} }
} ); });
$('input:checkbox').on('change', function () { $('input:checkbox').on('change', function() {
//build a regex filter string with an or(|) condition //build a regex filter string with an or(|) condition
var sts = $('input:checkbox[name="status"]:checked').map(function() { var sts = $('input:checkbox[name="status"]:checked').map(function() {
return this.value; return this.value;
}).get().join('|'); }).get().join('|');
//filter in column 5, with an regex, no smart filtering, not case sensitive //filter in column 5, with an regex, no smart filtering, not case sensitive
table.column(5).search(sts, true, false, false).draw(false); table.column(5).search(sts, true, false, false).draw(false);
}); });
} ); });
\ No newline at end of file
...@@ -26,19 +26,12 @@ $data['check_result'] = htmlspecialchars($_GET["check_result"]); ...@@ -26,19 +26,12 @@ $data['check_result'] = htmlspecialchars($_GET["check_result"]);
<meta charset=utf-8 /> <meta charset=utf-8 />
<script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js" crossorigin="anonymous"></script> <script type="text/javascript" src="https://code.jquery.com/jquery-3.5.1.js" crossorigin="anonymous"></script>
<script type="text/javascript" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script> <script type="text/javascript" src="https://cdn.datatables.net/1.10.22/js/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/momentjs/latest/moment.min.js"></script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.min.js"></script>
<link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css"/> <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/1.10.22/css/jquery.dataTables.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"/> <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css"/>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/daterangepicker/daterangepicker.css" />
<link rel="stylesheet" type="text/css" href="eccs.css" /> <link rel="stylesheet" type="text/css" href="eccs.css" />
<script>
$( function() {
$( "#datepicker" ).datepicker({
dateFormat: "yy-mm-dd",
minDate: "<?php echo $data['firstDate'] ?>",
maxDate: "<?php echo $data['lastDate'] ?>",
defaultDate: "<?php echo $data['date'] ?>"
}).datepicker("setDate","<?php echo $data['date'] ?>");
} );
</script>
<title>eduGAIN Connectivity Check Service</title> <title>eduGAIN Connectivity Check Service</title>
</head> </head>
<body> <body>
...@@ -56,7 +49,6 @@ $data['check_result'] = htmlspecialchars($_GET["check_result"]); ...@@ -56,7 +49,6 @@ $data['check_result'] = htmlspecialchars($_GET["check_result"]);
</div> </div>
<div class="boxCalendar"> <div class="boxCalendar">
<div id="calendarGo"> <div id="calendarGo">
<button id="goButton" onclick="getPastResults()">Go</button>
<label id="lbl-datepicker" for="datepicker" class="strong">Select date:</label> <label id="lbl-datepicker" for="datepicker" class="strong">Select date:</label>
<input type="text" id="datepicker" /> <input type="text" id="datepicker" />
</div> </div>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment