X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=plekit%2Ftable%2Fcolumns.js;h=daf64d604adef4fabf1cb87c3ca04fbc0af93919;hb=bbdd2d949c4f1dc8db02dcc184d651f534a7b2a5;hp=b4dc7f157f9419d34673e850b363a1429f50a114;hpb=a4caddaed5e2d702e9f1b7295a8f009a2d0c5549;p=plewww.git diff --git a/plekit/table/columns.js b/plekit/table/columns.js index b4dc7f1..daf64d6 100644 --- a/plekit/table/columns.js +++ b/plekit/table/columns.js @@ -15,32 +15,34 @@ var sourceMyPLC = 'MANIACS'; var sourceMaxmind = 'MaxMind'; var sourceMonitor = 'Monitor'; -var selectReferenceNode ='Select reference node: '; -var addButton = ''; -var deleteButton = ''; +var hardwareReqs = 'current PlanetLab hardware requirement'; +var selectReferenceNode ='Select reference node: '; +//var addButton = ''; +//var deleteButton = ''; var descHOSTNAME = "test"; -var titleA = 'Architecture name'; -var detailA = 'The node architecture.'; -var sourceA = 'Source: '+sourceMyPLC; -var valuesA = 'Values: x86_64, i386'; -var descA = ''+titleA+'

'+detailA+'

'+valuesA+'

'+sourceA; - -var titlef = 'Operating system'; -var detailf = 'Fedora or CentOS distribution to use for node or slivers.'; -var sourcef = 'Source: '+sourceMyPLC; -var descf = ''+titlef+'

'+detailf+'

'+sourcef; var titleAU = 'Authority'; var detailAU = 'The authority of the global PlanetLab federation that the site of the node belongs to.'; var valuesAU = 'Values: PLC (PlanetLab Central), PLE (PlanetLab Europe)'; -var sourceAU = 'Source: '+sourceMyPLC; +var sourceAU = 'Source: '+sourceMyPLC; var descAU = ''+titleAU+'

'+detailAU+'

'+valuesAU+'

'+sourceAU; +var titleST = 'Status'; +var sourceST = 'Source: '+sourceMonitor; +var valuesST = 'Values: online (up and running), good (up and running recently), offline (unreachable today), down (node unreachable for more than one day), failboot (reachable, but only by administrators for debugging purposes).'; +var descST = ''+titleST+'

'+valuesST+'

'+sourceST; + +var titleA = 'Architecture name'; +var detailA = 'The node architecture.'; +var sourceA = 'Source: '+sourceMyPLC; +var valuesA = 'Values: x86_64, i386, n/a'; +var descA = ''+titleA+'

'+detailA+'

'+valuesA+'

'+sourceA; + var titleAS = 'Autonomous system ID'; var sourceAS = 'Source: '+sourceCymru+' (via '+sourceTophat+')'; -var valuesAS = 'Unit: Integer between 0 and 65535'; +var valuesAS = 'Values: Integer between 0 and 65535, n/a'; var descAS = ''+titleAS+'

'+valuesAS+'

' + sourceAS; var titleAST = 'Autonomous system type'; @@ -67,18 +69,19 @@ var descBW = ''+titleBW+'

'+detailBW+'

'+ var titleCC = 'Number of CPU cores'; var sourceCC = 'Source: '+sourceComon; -var valuesCC = 'Current PlanetLab hardware requirements: 4 cores min.
(Older nodes may have fewer cores).'; +var valuesCC = 'The number of CPU cores on the node. For reference, the '+hardwareReqs+' is 4 cores min.
(Older nodes may have fewer cores)
.'; var descCC = ''+titleCC+'

'+valuesCC+'

'+sourceCC; var titleCN = 'Number of CPUs'; var sourceCN = 'Source: '+sourceComon; -var valuesCN = 'Current PlanetLab hardware requirements: 1 (if quad core) or 2 (if dual core)'; +var valuesCN = 'The number of CPUs on the node. For reference, the '+hardwareReqs+' is 1 (if quad core) or 2 (if dual core).'; var descCN = ''+titleCN+'

'+valuesCN+'

'+sourceCN; var titleCR = 'CPU clock rate'; +var detailCR = 'The clock rate for the CPUs on the node. For reference, the '+hardwareReqs+' is 2.4 GHz.'; var sourceCR = 'Source: '+sourceComon; -var valuesCR = 'Unit: GHz

Current PlanetLab hardware requirements: 2.4 GHz'; -var descCR = ''+titleCR+'

'+valuesCR+'

'+sourceCR; +var valuesCR = 'Unit: GHz'; +var descCR = ''+titleCR+'

'+detailCR+'

'+valuesCR+'

'+sourceCR; var selectPeriodCF = 'Select period: '; var titleCF = 'Free CPU'; @@ -91,10 +94,16 @@ var titleDN = 'Toplevel domain name'; var sourceDN = 'Source: '+sourceMyPLC; var descDN = ''+titleDN+'

'+sourceDN; +var titleDA = 'Date added'; +var sourceDA = 'Source: '+sourceMyPLC; +var detailDA = ' The date that the noded was added to PlanetLab.'; +var descDA = ''+titleDA+'

'+detailDA+'

'+sourceDA; + var titleDS = 'Disk size'; +var detailDS = 'The size of the hard disk available on the node. For reference, the '+hardwareReqs+' is 500 GB.'; var sourceDS = 'Source: '+sourceComon; -var valuesDS = 'Unit: GB

Current PlanetLab hardware requirements: 500 GB'; -var descDS = ''+titleDS+'

'+valuesDS+'

'+sourceDS; +var valuesDS = 'Unit: GB'; +var descDS = ''+titleDS+'

'+detailDS+'

'+valuesDS+'

'+sourceDS; var titleDU = 'Current disk utilization'; var sourceDU = 'Source: '+sourceComon+' (via '+sourceMySlice+')'; @@ -149,7 +158,7 @@ var descLCY = ''+titleLCY+'

'+detailLCY+'

'+detailLPR+'

'+valuesLPR+'

'+sourceLPR; @@ -159,8 +168,9 @@ var detailLRN = 'Based on the latitude and longitude information.'; var descLRN = ''+titleLRN+'

'+detailLRN+'

'+sourceLRN; var titleMS= 'Memory size'; +var detailMS = 'The memory size (RAM) available on the node. For reference, the '+hardwareReqs+' is 4 GB.'; var sourceMS = 'Source: '+sourceComon; -var valuesMS = 'Unit: GB

Current PlanetLab hardware requirements: 4 GB.'; +var valuesMS = 'Unit: GB.'; var descMS = ''+titleMS+'

'+valuesMS+'

'+sourceMS; var selectPeriodMU = 'Select period: '; @@ -219,8 +229,9 @@ var detailNRR = ' Whether the node can send packets packets using the IP reco var descNRR = ''+titleNRR+'

'+detailNRR+'

'+valuesNRR+'

'+sourceNRR; var titleOS = 'Operating system'; +var detailOS = 'Fedora or CentOS distribution to use for node or slivers.'; var sourceOS = 'Source: '+sourceMyPLC; -var valuesOS = 'Values: Fedora, Cent/OS, other, n/a'; +var valuesOS = 'Values: f8, f12, Cent/OS, other, n/a'; var descOS = ''+titleOS+'

'+valuesOS+'

'+sourceOS; var selectPeriodR = 'Select period: '; @@ -255,10 +266,12 @@ var detailSSH = 'The average response delay of the node to SSH logins over th var sourceSSH ='Source: '+sourceComon+' (via '+sourceMySlice+')'; var descSSH = ''+titleSSH+'

'+detailSSH+'

'+selectPeriodSSH+'

'+valuesSSH+'

'+sourceSSH; -var titleST = 'Status'; -var sourceST = 'Source: '+sourceMonitor; -var valuesST = 'Values: online (up and running), good (up and running recently), offline (unreachable today), down (node unreachable for more than one day), failboot (reachable, but only by administrators for debugging purposes).'; -var descST = ''+titleST+'

'+valuesST+'

'+sourceST; + +var titleUT = 'Uptime'; +var sourceUT = 'Source: '+sourceComon; +var valuesUT = 'Unit: days'; +var detailUT = 'The continuous uptime until the moment that the page is loaded, as reported by the CoMon html query API.'; +var descUT = ''+titleUT+'

'+detailUT+'

'+valuesUT+'

'+sourceUT; //Categorization of columns in different types, useful for filtering @@ -349,20 +362,21 @@ function overrideTitles() { //When the checkbox is clicked. Adds/removes column respectively function changeCheckStatus(column) { + var h = document.getElementById(column).value; + if (document.getElementById('selectdescr')) - showDescription(document.getElementById(column).value); + showDescription(h); + + //debugfilter("HERE: "+column+" - "+document.getElementById('type '+column).value); + //debugfilter("HERE: "+column); + if (document.getElementById(column).checked) - addColumn(document.getElementById(column).value, true); + addColumn(h, true, document.getElementById('type'+h).value); else - deleteColumn(document.getElementById(column).value); + deleteColumn(h); } -function removeSelectHandler(object) -{ - debugfilter(object); - object.onclick = null; -} //This function is used when the alternative "quick" selection list is used @@ -391,6 +405,23 @@ function changeSelectStatus(column) { } } +function updateReferenceNode(new_ref_node) { + + var old_ref_node = document.getElementById('selected_reference_node').value; + document.getElementById('selected_reference_node').value=new_ref_node; + + //debugfilter("changed "+old_ref_node+" with "+new_ref_node); + + if (document.getElementById('checkHC').checked) + { + addColumnAjax('HC', 'HC'); + //debugfilter("replacing "+old_ref_node+" with "+new_ref_node); + replaceColumnConfiguration('HC:'+old_ref_node,'HC:'+new_ref_node); + } + +} + + //When the period of an already selected column is changed function updatePeriod(h, new_period) { @@ -454,7 +485,7 @@ function closeMessage(tab) var person_id = document.getElementById('person_id').value; var tag_id = document.getElementById('show_tag_id').value; - var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id; + var url = "/plekit/php/updateConfiguration.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=showconf&tag_id="+tag_id; //debugfilter("updating conf with "+url); document.getElementById('show_configuration').value = value; @@ -525,7 +556,7 @@ function updateColumnConfiguration(value, reload) } } - xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_id="+tag_id,true); + xmlhttp.open("GET","/plekit/php/updateConfiguration.php?value="+new_configuration+"&slice_id="+slice_id+"&person_id="+person_id+"&tag_name=columnconf&tag_id="+tag_id,true); //xmlhttp.open("GET","/plekit/php/updateConf.php?value="+value+"&slice_id="+slice_id+"&person_id="+person_id+"&tagName=Columnconf",true); xmlhttp.send(); @@ -557,11 +588,17 @@ function sortCompleteCallback(tableid) { for(var i = 0, th; th = ths[i]; i++) { if (th.className.indexOf("Sort") != -1) { + //debugfilter("sorted"+th.getAttribute("name")); + + var column_name = th.getAttribute("name"); var hclass = th.className; var column = hclass.substr(hclass.indexOf("column"),hclass.indexOf("column")+1); - var sortdirection = hclass.substr(hclass.indexOf("Sort")-8,hclass.indexOf("Sort")); + var sortdirection = "forward"; + if (hclass.indexOf("reverse")!=-1) + sortdirection = "reverse"; + if (column.indexOf("column-1")==-1 && column.indexOf("column-0")==-1) - logSortingAction(person_id, slice_id, tableid+"|"+column+"|"+sortdirection); + logSortingAction(person_id, slice_id, tableid+"|"+column_name+"|"+sortdirection); } } } @@ -609,9 +646,11 @@ function replaceColumnConfiguration(column_old, column_new) { var old_columns = old_configuration.split("|"); var new_columns = new Array(); + var olds = column_old.split(':'); + for (var column_index = 0; column_index < old_columns.length ; column_index++) { var conf = old_columns[column_index].split(':'); - if (conf[0] != column_old) + if (conf[0] != olds[0]) new_columns.push(old_columns[column_index]); else new_columns.push(column_new); @@ -629,9 +668,37 @@ ADD/REMOVE COLUMNS */ +function convert_data(value, data_source, data_type, tagname) { + //debugfilter("v["+tagname+"]="+value+"-"); + + if (value == "" || value == "n/a" || value == null || value == "NaN" || value == "None") + return "n/a"; + + if (tagname == "uptime") { + return parseInt((parseFloat(value) / 86400)); + } + + if (data_type == "date") { -function load_data(column, header, url) { + var date = new Date(value*1000); + + var year = date.getFullYear(); + var month = date.getMonth()+1; + if (month < 10) + month = "0"+month; + var day = date.getDate(); + if (day < 10) + day = "0"+day; + + return year + '-' + month + '-' + day; + } + + return value; +} + + +function load_data(column, header, url, data_source, data_type, tagname) { //debugfilter("
loading "+url); var req = getHTTPObject(); @@ -641,13 +708,13 @@ function load_data(column, header, url) { req.onreadystatechange = function() { if (req.readyState == 4) - { updateColumnData(column, header, req.responseText); } + { updateColumnData(column, header, req.responseText, data_source, data_type, tagname); } } req.send(null); } -function updateColumnData(column, header, data) { +function updateColumnData(column, header, data, data_source, data_type, tagname) { var headers = header.split("|"); var data_table = data.split("|"); @@ -655,10 +722,12 @@ var data_table = data.split("|"); //debugfilter("

headers[0] = "+headers[0]); //debugfilter("

data[2] = "+data_table[2]); -//debugfilter("data = "+data); +//debugfilter("data = "+data + " with type "+data_type + " and source "+data_source); if (data != "") { + +//debugfilter("GOT SOME DATA"); var node_data; @@ -680,10 +749,10 @@ if (data != "") for (var h_index=0; h_index < headers.length; h_index++) { - if (node_data[h_index+1] == "") + if (node_data[h_index+1] == "" || node_data[h_index+1] == "None") data_array1[node_data[0]][h_index] = "n/a"; else - data_array1[node_data[0]][h_index] = node_data[h_index+1]; + data_array1[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname); } } @@ -705,8 +774,8 @@ if (data != "") } } + //tablePaginater.init(table_id1); fdTableSort.init(table_id1); - tablePaginater.init(table_id1); //potential nodes if (data_table[node_index] == '---potential---') @@ -733,7 +802,7 @@ if (data_table[node_index] == '---potential---') if (node_data[h_index+1] == "") data_array2[node_data[0]][h_index] = "n/a"; else - data_array2[node_data[0]][h_index] = node_data[h_index+1]; + data_array2[node_data[0]][h_index] = convert_data(node_data[h_index+1], data_source, data_type, tagname); } } @@ -750,12 +819,15 @@ if (data_table[node_index] == '---potential---') } } } - - //fdTableSort.removeTableCache(table_id2); fdTableSort.init(table_id2); - tablePaginater.init(table_id2); + //tablePaginater.init(table_id2); + } + //fdTableSort.removeTableCache(table_id2); + //document.getElementById('loading'+column).innerHTML = ""; + //debugfilter("Reset sorting ....."); + } document.getElementById('loading'+column).innerHTML = ""; @@ -789,6 +861,8 @@ function addColumnAjax(column, header) { var selectedperiod = document.getElementById('period'+column).value; var fetched = document.getElementById('fetched'+column).value; + var data_source = document.getElementById('source'+column).value; + var data_type = document.getElementById('type'+column).value; var to_load = false; //debugfilter("
adding "+column+","+header+','+fetched+','+t); @@ -807,8 +881,8 @@ function addColumnAjax(column, header) { if (to_load) { document.getElementById('loading'+column).innerHTML = ""; - var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t; - load_data(column, header, url); + var url = "/plekit/php/updateColumn.php?slice_id="+slice_id+"&tagName="+t+"&data_type="+data_type+"&data_source="+data_source; + load_data(column, header, url, data_source, data_type, t); } } @@ -818,6 +892,7 @@ function addColumn(column, fetch) { var selectedperiod=""; var header=column; + var conf=""; if (inTypeC(column)!=-1) @@ -828,14 +903,22 @@ function addColumn(column, fetch) { selectedperiod = document.getElementById('period'+column).value; header = column+""+selectedperiod; - //debugfilter("adding column "+column+" and header "+header); + if (inTypeD(column)!=-1) + { + conf = header+":"+document.getElementById('reference_node').value; + document.getElementById('selected_reference_node').value=document.getElementById('reference_node').value; + } + else + conf = header; + + //debugfilter("adding column "+column+" and header "+header+" and conf = "+conf); addColumnCells(header); if (fetch) addColumnAjax(column, header); - addColumnToConfiguration(header); + addColumnToConfiguration(conf); } @@ -868,6 +951,13 @@ function deleteColumn(column) { EXTRA + +function removeSelectHandler(object) +{ + debugfilter(object); + object.onclick = null; +} + //to be used for scrolling the column list with down/up arrows function scrollList() {