in server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js [132:327]
$(function () {
refreshRecoveryList();
// Create a table for tserver list
tserversTable = $('#tservers').DataTable({
"ajax": {
"url": '/rest/tservers',
"dataSrc": "servers"
},
"stateSave": true,
"columnDefs": [{
"targets": "big-num",
"render": function (data, type) {
if (type === 'display') {
data = bigNumberForQuantity(data);
}
return data;
}
},
{
"targets": "duration",
"render": function (data, type) {
if (type === 'display') {
data = timeDuration(data);
}
return data;
}
},
{
"targets": "percent",
"render": function (data, type) {
if (type === 'display') {
data = Math.round(data * 100) + '%';
}
return data;
}
},
// ensure these 3 columns are sorted by the 2 numeric values that comprise the combined string
// instead of sorting them lexicographically by the string itself.
// Specifically: 'targets' column will use the values in the 'orderData' columns
// scan column will be sorted by number of running, then by number of queued
{
"targets": [8],
"type": "numeric",
"orderData": [14, 15]
},
// minor compaction column will be sorted by number of running, then by number of queued
{
"targets": [9],
"type": "numeric",
"orderData": [16, 17]
},
],
"columns": [{
"data": "hostname",
"type": "html",
"render": function (data, type, row) {
if (type === 'display') {
data = '<a href="/tservers?s=' + row.id + '">' + row.hostname + '</a>';
}
return data;
}
},
{
"data": "tablets"
},
{
"data": "lastContact"
},
{
"data": "responseTime"
},
{
"data": "entries"
},
{
"data": "ingest"
},
{
"data": "query"
},
{
"data": "holdtime"
},
{
"data": "scansCombo"
},
{
"data": "minorCombo"
},
{
"data": "indexCacheHitRate"
},
{
"data": "dataCacheHitRate"
},
{
"data": "osload"
},
{
"data": "scansRunning",
"visible": false
},
{
"data": "scansQueued",
"visible": false
},
{
"data": "minorRunning",
"visible": false
},
{
"data": "minorQueued",
"visible": false
}
],
"rowCallback": function (row, data, index) {
// reset background of each row
$(row).css('background-color', '');
// if the curent hostname is in the reovery list
if (serverIsInRecoveryList(data)) {
// highlight the current row
console.log('Highlighting row index:' + index + ' tserver:' + data.hostname);
$(row).css('background-color', 'gold');
}
}
});
// Create a table for deadServers list
deadTServersTable = $('#deadtservers').DataTable({
"ajax": {
"url": '/rest/tservers',
"dataSrc": "deadServers"
},
"stateSave": true,
"columnDefs": [{
"targets": "date",
"render": function (data, type) {
if (type === 'display' && data > 0) {
data = dateFormat(data);
}
return data;
}
}],
"columns": [{
"data": "server"
},
{
"data": "lastStatus"
},
{
"data": "status"
},
{
"data": "server",
"type": "html",
"render": function (data, type) {
if (type === 'display') {
data = '<a href="javascript:clearDeadTServers(\'' + data + '\');">clear</a>';
}
return data;
}
}
]
});
// Create a table for badServers list
badTServersTable = $('#badtservers').DataTable({
"ajax": {
"url": '/rest/tservers',
"dataSrc": "badServers"
},
"stateSave": true,
"columnDefs": [{
"targets": "date",
"render": function (data, type) {
if (type === 'display' && data > 0) {
data = dateFormat(data);
}
return data;
}
}],
"columns": [{
"data": "id"
},
{
"data": "status"
}
]
});
refreshTServers();
});