alerman closed pull request #424: Reverse default sort direction for tables in monitor URL: https://github.com/apache/accumulo/pull/424
This is a PR merged from a forked repository. As GitHub hides the original diff on merge, it is displayed below for the sake of provenance: As this is a foreign pull request (from a fork), the diff is supplied below (as it won't show otherwise due to GitHub magic): diff --git a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java index 4590a8b7f0..04db76c56d 100644 --- a/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java +++ b/server/monitor/src/main/java/org/apache/accumulo/monitor/util/Table.java @@ -110,7 +110,7 @@ public synchronized void generate(HttpServletRequest req, StringBuilder sb) { if (row.size() != columns.size()) throw new RuntimeException("Each row must have the same number of columns"); - boolean sortAscending = !"false".equals(BasicServlet.getCookieValue(req, "tableSort." + boolean sortDescending = "false".equals(BasicServlet.getCookieValue(req, "tableSort." + BasicServlet.encode(page) + "." + BasicServlet.encode(tableName) + "." + "sortAsc")); int sortCol = -1; // set to first sortable column by default @@ -173,11 +173,11 @@ public synchronized void generate(HttpServletRequest req, StringBuilder sb) { String title = col.getTitle(); if (rows.size() > 1 && col.getCellType().isSortable()) { String url = String.format("/op?action=sortTable&redir=%s&page=%s&table=%s&%s=%s", redir, - page, tableName, sortCol == i ? "asc" : "col", sortCol == i ? !sortAscending : i); + page, tableName, sortCol == i ? "asc" : "col", sortCol == i ? !sortDescending : i); String img = ""; if (sortCol == i) img = String.format(" <img width='10px' height='10px' src='/web/%s.gif' alt='%s' />", - sortAscending ? "up" : "down", !sortAscending ? "^" : "v"); + !sortDescending ? "up" : "down", sortDescending ? "^" : "v"); col.setTitle(String.format("<a href='%s'>%s%s</a>", url, title, img)); } String legend = col.getLegend(); @@ -200,7 +200,7 @@ public synchronized void generate(HttpServletRequest req, StringBuilder sb) { // don't sort if no columns are sortable or if there aren't enough rows if (rows.size() > 1 && sortCol > -1) { Collections.sort(rows, TableRow.getComparator(sortCol, columns.get(sortCol).getCellType())); - if (!sortAscending) + if (!sortDescending) Collections.reverse(rows); } boolean highlight = true; ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services