From 356cfe9351fadef6043fc6c15e85154d8058ee78 Mon Sep 17 00:00:00 2001 From: eomiks Date: Mon, 29 Jun 2020 01:18:45 +0900 Subject: [PATCH] HBASE-24652 master-status UI make date type fields sortable --- .../hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon index cce8a12dfe9..87b8289692c 100644 --- a/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon +++ b/hbase-server/src/main/jamon/org/apache/hadoop/hbase/tmpl/master/MasterStatusTmpl.jamon @@ -452,8 +452,20 @@ AssignmentManager assignmentManager = master.getAssignmentManager(); return $.tablesorter.formatFloat( s.replace(/,/g,'') ); }, type: "numeric" }); + $.tablesorter.addParser( + { + id: "dateTime", + is: function (s) { + return /^([a-zA-Z]{3}\s){2}\d{2}\s\d{2}:\d{2}:\d{2}\s[a-zA-Z]{3}\s\d{4}$/.test(s); + }, format: function (s) { + var split = s.split(" "); + var time = Date.parse(split[1] + " " + split[2] + " " + split[3] + " " + split[5]); + return $.tablesorter.formatFloat(time); + }, type: "numeric" + }); $("#baseStatsTable").tablesorter({ headers: { + 1: {sorter: 'dateTime'}, 4: {sorter: 'separator'}, 5: {sorter: 'separator'} }