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 9f6c37bcc3
commit e4157f0fe6
5 changed files with 185 additions and 30 deletions

View File

@ -404,11 +404,77 @@ AssignmentManager assignmentManager = master.getAssignmentManager();
<script> <script>
$(document).ready(function() $(document).ready(function()
{ {
$("#baseStatsTable").tablesorter(); $.tablesorter.addParser(
$("#memoryStatsTable").tablesorter(); {
$("#requestStatsTable").tablesorter(); id: 'filesize',
$("#storeStatsTable").tablesorter(); is: function(s) {
$("#compactionStatsTable").tablesorter(); 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(); $("#userTables").tablesorter();
} }

View File

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

View File

@ -270,11 +270,47 @@ $(document).ready(function()
}, },
type: 'numeric' 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(); $("#baseStatsTable").tablesorter();
$("#requestStatsTable").tablesorter(); $("#requestStatsTable").tablesorter({
$("#storeStatsTable").tablesorter(); headers: {
$("#compactionStatsTable").tablesorter(); 1: {sorter: 'separator'},
$("#memstoreStatsTable").tablesorter(); 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> </script>

View File

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

View File

@ -706,9 +706,62 @@ Actions:
<script> <script>
$(document).ready(function() $(document).ready(function()
{ {
$("#regionServerTable").tablesorter(); $.tablesorter.addParser(
$("#regionServerDetailsTable").tablesorter(); {
$("#tableRegionTable").tablesorter(); 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> </script>