X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=plugins%2Fquerytable%2Fstatic%2Fjs%2Fquerytable.js;h=76934e79b49ab90b7c5881e9b843d9f852071f0c;hb=d035a1f93e4acbeee79b7c8200264687d940ccc2;hp=7ddf300d75e3fe8e0e839b7c9ef1e925c00e4f90;hpb=261afa50a6fade31685a23b104ab919bebaf25ef;p=myslice.git
diff --git a/plugins/querytable/static/js/querytable.js b/plugins/querytable/static/js/querytable.js
index 7ddf300d..76934e79 100644
--- a/plugins/querytable/static/js/querytable.js
+++ b/plugins/querytable/static/js/querytable.js
@@ -10,14 +10,6 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
(function($){
-
- var QUERYTABLE_MAP = {
- 'Facility': 'facility_name',
- 'Testbed': 'testbed_name',
- 'Resource name': 'hostname',
- 'Type': 'type',
- };
-
var debug=false;
// debug=true
@@ -163,6 +155,79 @@ 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['available'] = self.getColIndex('available',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']],
+ 'available' : aData[index['available']],
+ '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[20],
+ 'latitude' : aData[17],
+ };
+ var coordinates = resourceLocation['latitude']+','+resourceLocation['longitude'];
+ console.log(coordinates);
+ }
+
+ 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
/**
@@ -232,7 +297,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 +403,7 @@ QUERYTABLE_BGCOLOR_REMOVED = 2;
}
} else {
msg = '';
- msg += '- '
+ msg += '
- ';
msg += '⚠';
msg += '