From 1f295d9267c0ba3968840f24779190282c12d296 Mon Sep 17 00:00:00 2001 From: Ciro Scognamiglio Date: Tue, 7 Oct 2014 19:33:47 +0200 Subject: [PATCH] added modeal for resource information --- plugins/querytable/static/js/querytable.js | 72 ++++++++++++++++++-- plugins/querytable/templates/querytable.html | 14 ++++ portal/static/css/onelab.css | 17 +++++ 3 files changed, 99 insertions(+), 4 deletions(-) diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js index 7ddf300d..3c1aab2a 100644 --- a/plugins/querytable/static/js/querytable.js +++ b/plugins/querytable/static/js/querytable.js @@ -163,6 +163,62 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; }); $(".dataTables_filter").append("
"); $(".dataTables_filter input").css("width","100%"); + + // resource info + var sTable = this.table; + $('table.dataTable').delegate('a.resource-info','click',function() { + var aPos = sTable.fnGetPosition( this.parentNode ); + var aData = sTable.fnGetData( aPos[0] ); + //console.log(aData); + + var network_hrn = aData[18]; + var resourceData = { + 'hostname' : strip(aData[2]), + 'urn' : aData[6], + 'type' : aData[3], + 'status' : aData[10], + 'testbed' : aData[4], + 'facility' : aData[5], + }; + + + console.log(network_hrn); + //Greece: 37.6687092,22.2282404 + if (network_hrn == 'omf.nitos') { + var logo = 'nitos'; + var resourceLocation = { + 'longitude' : '22.2282404', + 'latitude' : '37.6687092', + }; + var coordinates = resourceLocation['latitude']+','+resourceLocation['longitude']; + } else if (network_hrn == 'iotlab') { + var logo = network_hrn; + var s = resourceData['hostname'].split("."); + var n = s[0].split("-"); + resourceData['type'] = 'node ( Hardware: '+n[0]+' )'; + var coordinates = resourceData['testbed']; + } else { + var logo = network_hrn; + var resourceLocation = { + 'longitude' : aData[13], + 'latitude' : aData[23], + }; + var coordinates = resourceLocation['latitude']+','+resourceLocation['longitude']; + } + + var modal = $('#resource-info-modal'); + modal.find('.modal-title').text(resourceData['testbed'] + ': ' +resourceData['hostname']); + table = modal.find('.modal-resource-info'); + table.html(''+resourceData['facility']+' - '+resourceData['testbed']+''); + for (var j in resourceData) { + table.append('' + j + '' + resourceData[j] + ''); + } + if (coordinates != '') { + table.append(''); + } + modal.modal(); + }); + }, // initialize_table /** @@ -232,7 +288,8 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; //TODO: we need to add source/destination for links line.push(''); else - line.push(record['hostname']); + //line.push(record['hostname']); + line.push('' + record['hostname'] + ''); } else if (colnames[j] == this.init_key && typeof(record) != 'undefined') { obj = this.object @@ -337,7 +394,7 @@ QUERYTABLE_BGCOLOR_REMOVED = 2; } } else { msg = '