X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plugins%2Fquerytable%2Fstatic%2Fjs%2Fquerytable.js;h=01c72b66eb851e3776c6d72bf9db6a80c881219e;hb=0b0b20a702f126f0e40ef63cd8f87c705ac962c8;hp=4b9e5461a51a89c81c1f0e6819e4f2a42675a797;hpb=3aae671a1ca0cef870a268b88ddcde8d520d7621;p=unfold.git
diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js
index 4b9e5461..01c72b66 100644
--- a/plugins/querytable/static/js/querytable.js
+++ b/plugins/querytable/static/js/querytable.js
@@ -10,13 +10,6 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
(function($){
-
- var QUERYTABLE_MAP = {
- 'Testbed': 'network_hrn',
- 'Resource name': 'hostname',
- 'Type': 'type',
- };
-
var debug=false;
// debug=true
@@ -162,6 +155,76 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
});
$(".dataTables_filter").append("
");
$(".dataTables_filter input").css("width","100%");
+
+ // resource info
+ var sTable = this.table;
+ var oSettings = this.table.fnSettings();
+ var cols = oSettings.aoColumns;
+ var self = this;
+ $('table.dataTable').delegate('a.resource-info','click',function() {
+ var aPos = sTable.fnGetPosition( this.parentNode );
+ var aData = sTable.fnGetData( aPos[0] );
+ //console.log(aData);
+
+ var index = {}
+ // XXX Loic @ Hardcoded !!! Maybe a loop over all fields would be better
+ index['network_hrn'] = self.getColIndex('network_hrn',cols);
+ var network_hrn = aData[index['network_hrn']];
+
+ index['hostname'] = self.getColIndex('hostname',cols);
+ index['urn'] = self.getColIndex('urn',cols);
+ index['type'] = self.getColIndex('type',cols);
+ index['status'] = self.getColIndex('boot_state',cols);
+ index['testbed'] = self.getColIndex('testbed_name',cols);
+ index['facility'] = self.getColIndex('facility_name',cols);
+ var resourceData = {
+ 'hostname' : strip(aData[index['hostname']]),
+ 'urn' : aData[index['urn']],
+ 'type' : aData[index['type']],
+ 'status' : aData[index['status']],
+ 'testbed' : aData[index['testbed']],
+ 'facility' : aData[index['facility']],
+ };
+
+ /*
+ //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') {
+ */
+ 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 = resourceData['testbed'];
+ 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(' |
');
+ for (var j in resourceData) {
+ table.append('' + j + ' | ' + resourceData[j] + ' |
');
+ }
+ if (coordinates != '') {
+ table.append(' |
');
+ }
+ modal.modal();
+ });
+
}, // initialize_table
/**
@@ -231,7 +294,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
@@ -336,7 +400,7 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
}
} else {
msg = '';
- msg += '- '
+ msg += '
- ';
msg += '⚠';
msg += '