HBASE-22543 Revisit HBASE-21207 to make all values fully sortable

Signed-off-by: Wellington Chevreuil <wchevreuil@apache.org>
This commit is contained in:
Daisuke Kobayashi 2019-08-08 20:07:10 +09:00 committed by Wellington Chevreuil
parent 989e09a2d5
commit 0136b9873f
5 changed files with 185 additions and 30 deletions

View File

@ -404,11 +404,77 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<script>
$(document).ready(function()
{
$("#baseStatsTable").tablesorter();
$("#memoryStatsTable").tablesorter();
$("#requestStatsTable").tablesorter();
$("#storeStatsTable").tablesorter();
$("#compactionStatsTable").tablesorter();
$.tablesorter.addParser(
{
id: 'filesize',
is: function(s) {
return s.match(new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ));
},
format: function(s) {
var suf = s.match(new RegExp( /(KB|B|GB|MB|TB)$/ ))[1];
var num = parseFloat(s.match( new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ))[0]);
switch(suf) {
case 'B':
return num;
case 'KB':
return num * 1024;
case 'MB':
return num * 1024 * 1024;
case 'GB':
return num * 1024 * 1024 * 1024;
case 'TB':
return num * 1024 * 1024 * 1024 * 1024;
}
},
type: 'numeric'
});
$.tablesorter.addParser(
{
id: "separator",
is: function (s) {
return /^[0-9]?[0-9,]*$/.test(s);
}, format: function (s) {
return $.tablesorter.formatFloat( s.replace(/,/g,'') );
}, type: "numeric"
});
$("#baseStatsTable").tablesorter({
headers: {
4: {sorter: 'separator'},
5: {sorter: 'separator'}
}
});
$("#memoryStatsTable").tablesorter({
headers: {
1: {sorter: 'filesize'},
2: {sorter: 'filesize'},
3: {sorter: 'filesize'}
}
});
$("#requestStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'},
3: {sorter: 'separator'},
4: {sorter: 'separator'}
}
});
$("#storeStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'},
3: {sorter: 'filesize'},
4: {sorter: 'filesize'},
5: {sorter: 'filesize'},
6: {sorter: 'filesize'}
}
});
$("#compactionStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'},
3: {sorter: 'separator'}
}
});
$("#userTables").tablesorter();
}

View File

@ -125,8 +125,8 @@ Arrays.sort(serverNames);
<td><% new Date(startcode) %></td>
<td><% TraditionalBinaryPrefix.long2String(lastContact, "s", 1) %></td>
<td><% version %></td>
<td><% String.format("%.0f", requestsPerSecond) %></td>
<td><% numRegionsOnline %></td>
<td><% String.format("%,.0f", requestsPerSecond) %></td>
<td><% String.format("%,d", numRegionsOnline) %></td>
</tr>
<%java>
}
@ -225,10 +225,10 @@ if (sl != null) {
</%java>
<tr>
<td><& serverNameLink; serverName=serverName; &></td>
<td><% sl.getRequestCountPerSecond() %></td>
<td><% readRequestCount %></td>
<td><% filteredReadRequestCount %></td>
<td><% writeRequestCount %></td>
<td><% String.format("%,d", sl.getRequestCountPerSecond()) %></td>
<td><% String.format("%,d", readRequestCount) %></td>
<td><% String.format("%,d", filteredReadRequestCount) %></td>
<td><% String.format("%,d", writeRequestCount) %></td>
</tr>
<%java>
} else {
@ -282,8 +282,8 @@ if (sl != null) {
</%java>
<tr>
<td><& serverNameLink; serverName=serverName; &></td>
<td><% storeCount %></td>
<td><% storeFileCount %></td>
<td><% String.format("%,d", storeCount) %></td>
<td><% String.format("%,d", storeFileCount) %></td>
<td><% TraditionalBinaryPrefix.long2String(
storeUncompressedSizeMB * TraditionalBinaryPrefix.MEGA.value, "B", 1) %></td>
<td><% TraditionalBinaryPrefix.long2String(storeFileSizeMB
@ -339,9 +339,9 @@ if (totalCompactingCells > 0) {
</%java>
<tr>
<td><& serverNameLink; serverName=serverName; &></td>
<td><% totalCompactingCells %></td>
<td><% totalCompactedCells %></td>
<td><% totalCompactingCells - totalCompactedCells %></td>
<td><% String.format("%,d", totalCompactingCells) %></td>
<td><% String.format("%,d", totalCompactedCells) %></td>
<td><% String.format("%,d", totalCompactingCells - totalCompactedCells) %></td>
<td><% percentDone %></td>
</tr>
<%java>

View File

@ -270,11 +270,47 @@ $(document).ready(function()
},
type: 'numeric'
});
$.tablesorter.addParser(
{
id: "separator",
is: function (s) {
return /^[0-9]?[0-9,]*$/.test(s);
},
format: function (s) {
return $.tablesorter.formatFloat( s.replace(/,/g,'') );
},
type: "numeric"
});
$("#baseStatsTable").tablesorter();
$("#requestStatsTable").tablesorter();
$("#storeStatsTable").tablesorter();
$("#compactionStatsTable").tablesorter();
$("#memstoreStatsTable").tablesorter();
$("#requestStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'},
3: {sorter: 'separator'}
}
});
$("#storeStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'},
3: {sorter: 'filesize'},
4: {sorter: 'filesize'},
5: {sorter: 'filesize'},
6: {sorter: 'filesize'}
}
});
$("#compactionStatsTable").tablesorter({
headers: {
1: {sorter: 'separator'},
2: {sorter: 'separator'}
}
});
$("#memstoreStatsTable").tablesorter({
headers: {
1: {sorter: 'filesize'}
}
});
}
);
</script>

View File

@ -142,9 +142,9 @@
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% load.getReadRequestsCount() %></td>
<td><% load.getFilteredReadRequestsCount() %></td>
<td><% load.getWriteRequestsCount() %></td>
<td><% String.format("%,1d", load.getReadRequestsCount()) %></td>
<td><% String.format("%,1d", load.getFilteredReadRequestsCount()) %></td>
<td><% String.format("%,1d", load.getWriteRequestsCount()) %></td>
</%if>
</tr>
</%for>
@ -182,8 +182,8 @@
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% load.getStores() %></td>
<td><% load.getStorefiles() %></td>
<td><% String.format("%,1d", load.getStores()) %></td>
<td><% String.format("%,1d", load.getStorefiles()) %></td>
<td><% TraditionalBinaryPrefix.long2String(load.getStoreUncompressedSizeMB()
* TraditionalBinaryPrefix.MEGA.value, "B", 1)%></td>
<td><% TraditionalBinaryPrefix.long2String(load.getStorefileSizeMB()
@ -239,8 +239,8 @@
</%java>
<td><a href="region.jsp?name=<% r.getEncodedName() %>"><% displayName %></a></td>
<%if load != null %>
<td><% load.getTotalCompactingKVs() %></td>
<td><% load.getCurrentCompactedKVs() %></td>
<td><% String.format("%,1d", load.getTotalCompactingKVs()) %></td>
<td><% String.format("%,1d", load.getCurrentCompactedKVs()) %></td>
<td><% percentDone %></td>
<td><% compactTime %></td>
</%if>

View File

@ -726,9 +726,62 @@ Actions:
<script>
$(document).ready(function()
{
$("#regionServerTable").tablesorter();
$("#regionServerDetailsTable").tablesorter();
$("#tableRegionTable").tablesorter();
$.tablesorter.addParser(
{
id: 'filesize',
is: function(s) {
return s.match(new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ));
},
format: function(s) {
var suf = s.match(new RegExp( /(B|KB|MB|GB|TB)$/ ))[1];
var num = parseFloat(s.match( new RegExp( /([\.0-9]+)\ (B|KB|MB|GB|TB)/ ))[0]);
switch(suf) {
case 'B':
return num;
case 'KB':
return num * 1024;
case 'MB':
return num * 1024 * 1024;
case 'GB':
return num * 1024 * 1024 * 1024;
case 'TB':
return num * 1024 * 1024 * 1024 * 1024;
}
},
type: 'numeric'
});
$.tablesorter.addParser(
{
id: "separator",
is: function (s) {
return /^[0-9]?[0-9,]*$/.test(s);
}, format: function (s) {
return $.tablesorter.formatFloat( s.replace(/,/g,'') );
}, type: "numeric"
});
$("#regionServerTable").tablesorter({
headers: {
1: {sorter: 'separator'}
}
});
$("#regionServerDetailsTable").tablesorter({
headers: {
2: {sorter: 'separator'},
3: {sorter: 'separator'},
4: {sorter: 'filesize'},
5: {sorter: 'separator'},
6: {sorter: 'filesize'}
}
});
$("#tableRegionTable").tablesorter({
headers: {
2: {sorter: 'separator'},
3: {sorter: 'separator'},
4: {sorter: 'filesize'},
5: {sorter: 'separator'},
6: {sorter: 'filesize'}
}
});
}
);
</script>