ACCUMULO-2181 Added missing sorting for tables
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ccd9fb56 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ccd9fb56 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ccd9fb56 Branch: refs/heads/master Commit: ccd9fb5644ee481e9b344229a4e5a587b6482ab8 Parents: dd75ed8 Author: Luis Tavarez <[email protected]> Authored: Wed Apr 5 12:47:16 2017 -0400 Committer: Christopher Tubbs <[email protected]> Committed: Thu Jul 6 16:22:41 2017 -0400 ---------------------------------------------------------------------- .../src/main/resources/resources/bulkImport.js | 19 +++++---- .../src/main/resources/resources/master.js | 26 ++++++------ .../src/main/resources/resources/tservers.js | 44 +++++++++++--------- 3 files changed, 48 insertions(+), 41 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ccd9fb56/server/monitor/src/main/resources/resources/bulkImport.js ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/bulkImport.js b/server/monitor/src/main/resources/resources/bulkImport.js index 9e9b2a6..15cce25 100644 --- a/server/monitor/src/main/resources/resources/bulkImport.js +++ b/server/monitor/src/main/resources/resources/bulkImport.js @@ -125,9 +125,11 @@ function refreshServerBulkTable() { /** * Sorts the bulkImportStatus table on the selected column * + * @param {string} table Table ID to sort * @param {number} n Column number to sort by */ -function sortTable(n) { +function sortTable(table, n) { + var tableIDs = ['bulkImportStatus', 'masterBulkImportStatus']; if (sessionStorage.tableColumnSort !== undefined && sessionStorage.tableColumnSort == n && @@ -137,8 +139,9 @@ function sortTable(n) { direction = sessionStorage.direction === undefined ? 'asc' : sessionStorage.direction; } + sessionStorage.tableColumn = tableIDs[table]; sessionStorage.tableColumnSort = n; - sortTables('bulkImportStatus', direction, n); + sortTables(tableIDs[table], direction, n); } /** @@ -165,13 +168,13 @@ function createBulkImportHeader() { * Adds the columns, add sortTable function on click, * if the column has a description, add title taken from the global.js */ - items.push('<th class="firstcell" onclick="sortTable(0)" >Directory ' + + items.push('<th class="firstcell" onclick="sortTable(1,0)" >Directory ' + '</th>'); - items.push('<th onclick="sortTable(1)" title="' + + items.push('<th onclick="sortTable(1,1)" title="' + descriptions['Import Age'] + '">Age </th>'); - items.push('<th onclick="sortTable(2)" title="' + + items.push('<th onclick="sortTable(1,2)" title="' + descriptions['Import State'] + '">State </th>'); $('<tr/>', { @@ -198,10 +201,10 @@ function createServerBulkHeader() { * Adds the columns, add sortTable function on click, * if the column has a description, add title taken from the global.js */ - items.push('<th class="firstcell" onclick="sortTable(0)">Server </th>'); - items.push('<th onclick="sortTable(1)" title="' + descriptions['# Imports'] + + items.push('<th class="firstcell" onclick="sortTable(0,0)">Server </th>'); + items.push('<th onclick="sortTable(0,1)" title="' + descriptions['# Imports'] + '"># </th>'); - items.push('<th onclick="sortTable(2)" title="' + descriptions['Oldest Age'] + + items.push('<th onclick="sortTable(0,2)" title="' + descriptions['Oldest Age'] + '">Oldest Age </th>'); $('<tr/>', { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ccd9fb56/server/monitor/src/main/resources/resources/master.js ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/master.js b/server/monitor/src/main/resources/resources/master.js index bc98a97..a4c4c3e 100644 --- a/server/monitor/src/main/resources/resources/master.js +++ b/server/monitor/src/main/resources/resources/master.js @@ -188,7 +188,7 @@ function refreshMasterTable() { * * @param {number} n Column number to sort by */ -function sortTable(n) { +function sortMasterTable(n) { if (sessionStorage.tableColumnSort !== undefined && sessionStorage.tableColumnSort == n && sessionStorage.direction !== undefined) { @@ -226,37 +226,37 @@ function createHeader() { * Adds the columns, add sortTable function on click, * if the column has a description, add title taken from the global.js */ - items.push('<th class="firstcell" onclick="sortTable(0)" title="' + + items.push('<th class="firstcell" onclick="sortMasterTable(0)" title="' + descriptions['Master'] + '">Master </th>'); - items.push('<th onclick="sortTable(1)" title="' + + items.push('<th onclick="sortMasterTable(1)" title="' + descriptions['# Online Tablet Servers'] + '"># Online<br />Tablet Servers </th>'); - items.push('<th onclick="sortTable(2)" title="' + + items.push('<th onclick="sortMasterTable(2)" title="' + descriptions['# Total Tablet Servers'] + '"># Total<br />Tablet Servers </th>'); - items.push('<th onclick="sortTable(3)" title="' + + items.push('<th onclick="sortMasterTable(3)" title="' + descriptions['Last GC'] + '">Last GC </th>'); - items.push('<th onclick="sortTable(4)" title="' + + items.push('<th onclick="sortMasterTable(4)" title="' + descriptions['# Tablets'] + '"># Tablets </th>'); - items.push('<th onclick="sortTable(5)"># Unassigned' + + items.push('<th onclick="sortMasterTable(5)"># Unassigned' + '<br />Tablets </th>'); - items.push('<th onclick="sortTable(6)" title="' + + items.push('<th onclick="sortMasterTable(6)" title="' + descriptions['Total Entries'] + '">Entries </th>'); - items.push('<th onclick="sortTable(7)" title="' + + items.push('<th onclick="sortMasterTable(7)" title="' + descriptions['Total Ingest'] + '">Ingest </th>'); - items.push('<th onclick="sortTable(8)" title="' + + items.push('<th onclick="sortMasterTable(8)" title="' + descriptions['Total Entries Read'] + '">Entries<br />Read </th>'); - items.push('<th onclick="sortTable(9)" title="' + + items.push('<th onclick="sortMasterTable(9)" title="' + descriptions['Total Entries Returned'] + '">Entries<br />Returned </th>'); - items.push('<th onclick="sortTable(10)" title="' + + items.push('<th onclick="sortMasterTable(10)" title="' + descriptions['Max Hold Time'] + '">Hold Time </th>'); - items.push('<th onclick="sortTable(11)" title="' + + items.push('<th onclick="sortMasterTable(11)" title="' + descriptions['OS Load'] + '">OS Load </th>'); $('<tr/>', { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ccd9fb56/server/monitor/src/main/resources/resources/tservers.js ---------------------------------------------------------------------- diff --git a/server/monitor/src/main/resources/resources/tservers.js b/server/monitor/src/main/resources/resources/tservers.js index d8c109a..7f19c2d 100644 --- a/server/monitor/src/main/resources/resources/tservers.js +++ b/server/monitor/src/main/resources/resources/tservers.js @@ -76,9 +76,9 @@ function refreshBadTServersTable() { var items = []; - items.push('<th class="firstcell" onclick="sortTable(0)">' + + items.push('<th class="firstcell" onclick="sortTable(0,0)">' + 'Tablet Server </th>'); - items.push('<th onclick="sortTable(1)">Tablet Server ' + + items.push('<th onclick="sortTable(0,1)">Tablet Server ' + 'Status </th>'); $('<tr/>', { @@ -130,10 +130,10 @@ function refreshDeadTServersTable() { var items = []; - items.push('<th class="firstcell" onclick="sortTable(0)">' + + items.push('<th class="firstcell" onclick="sortTable(1,0)">' + 'Server </th>'); - items.push('<th onclick="sortTable(1)">Last Updated </th>'); - items.push('<th onclick="sortTable(2)">Event </th>'); + items.push('<th onclick="sortTable(1,1)">Last Updated </th>'); + items.push('<th onclick="sortTable(1,2)">Event </th>'); items.push('<th>Clear</th>'); $('<tr/>', { @@ -254,9 +254,12 @@ function refreshTServersTable() { /** * Sorts the tservers table on the selected column * + * @param {string} table Table ID to sort * @param {number} n Column number to sort by */ -function sortTable(n) { +function sortTable(table, n) { + var tableIDs = ['badtservers', 'deadtservers', 'tservers']; + if (sessionStorage.tableColumnSort !== undefined && sessionStorage.tableColumnSort == n && sessionStorage.direction !== undefined) { @@ -265,8 +268,9 @@ function sortTable(n) { direction = sessionStorage.direction === undefined ? 'asc' : sessionStorage.direction; } + sessionStorage.tableColumn = tableIDs[table]; sessionStorage.tableColumnSort = n; - sortTables('tservers', direction, n); + sortTables(tableIDs[table], direction, n); } /** @@ -286,32 +290,32 @@ function createHeader() { var items = []; - items.push('<th class="firstcell" onclick="sortTable(0)">Server </th>'); - items.push('<th onclick="sortTable(1)">Hosted Tablets </th>'); - items.push('<th onclick="sortTable(2)">Last Contact </th>'); - items.push('<th onclick="sortTable(3)" title="' + + items.push('<th class="firstcell" onclick="sortTable(2,0)">Server </th>'); + items.push('<th onclick="sortTable(2,1)">Hosted Tablets </th>'); + items.push('<th onclick="sortTable(2,2)">Last Contact </th>'); + items.push('<th onclick="sortTable(2,3)" title="' + descriptions['Entries'] + '">Entries </th>'); - items.push('<th onclick="sortTable(4)" title="' + + items.push('<th onclick="sortTable(2,4)" title="' + descriptions['Ingest'] + '">Ingest </th>'); - items.push('<th onclick="sortTable(5)" title="' + + items.push('<th onclick="sortTable(2,5)" title="' + descriptions['Query'] + '">Query </th>'); - items.push('<th onclick="sortTable(6)" title="' + + items.push('<th onclick="sortTable(2,6)" title="' + descriptions['Hold Time'] + '">Hold Time </th>'); - items.push('<th onclick="sortTable(7)" title="' + + items.push('<th onclick="sortTable(2,7)" title="' + descriptions['Running Scans'] + '">Running<br />Scans </th>'); - items.push('<th onclick="sortTable(8)" title="' + + items.push('<th onclick="sortTable(2,8)" title="' + descriptions['Minor Compactions'] + '">Minor<br />Compactions </th>'); - items.push('<th onclick="sortTable(9)" title="' + + items.push('<th onclick="sortTable(2,9)" title="' + descriptions['Major Compactions'] + '">Major<br />Compactions </th>'); - items.push('<th onclick="sortTable(10)" title="' + + items.push('<th onclick="sortTable(2,10)" title="' + descriptions['Index Cache Hit Rate'] + '">Index Cache<br />Hit Rate </th>'); - items.push('<th onclick="sortTable(11)" title="' + + items.push('<th onclick="sortTable(2,11)" title="' + descriptions['Data Cache Hit Rate'] + '">Data Cache<br />Hit Rate </th>'); - items.push('<th onclick="sortTable(12)" title="' + + items.push('<th onclick="sortTable(2,12)" title="' + descriptions['OS Load'] + '">OS Load </th>'); $('<tr/>', {
