milleruntime commented on code in PR #2685:
URL: https://github.com/apache/accumulo/pull/2685#discussion_r870234677
##########
server/monitor/src/main/resources/org/apache/accumulo/monitor/resources/js/tservers.js:
##########
@@ -16,165 +16,115 @@
* specific language governing permissions and limitations
* under the License.
*/
+/* JSLint global definitions */
+/*global
+ $, document, sessionStorage, getTServers, clearDeadServers, refreshNavBar,
+ getRecoveryList, bigNumberForQuantity, timeDuration, dateFormat
+*/
"use strict";
-var tserversTable;
+var tserversTable, deadTServersTable, badTServersTable;
var recoveryList = [];
/**
- * Creates tservers initial table
+ * Checks if the given server is in the global recoveryList variable
+ *
+ * @param {JSON} server json server object
+ * @returns true if the server is in the recoveryList, else false
*/
-$(document).ready(function() {
-
- refreshRecoveryList();
-
- // Create a table for tserver list
- tserversTable = $('#tservers').DataTable({
- "ajax": {
- "url": '/rest/tservers',
- "dataSrc": "servers"
- },
- "stateSave": true,
- "columnDefs": [
- { "targets": "big-num",
- "render": function ( data, type, row ) {
- if(type === 'display') data = bigNumberForQuantity(data);
- return data;
- }
- },
- { "targets": "duration",
- "render": function ( data, type, row ) {
- if(type === 'display') data = timeDuration(data);
- return data;
- }
- },
- { "targets": "percent",
- "render": function ( data, type, row ) {
- if(type === 'display') data = Math.round(data * 100) + '%';
- return data;
- }
- }
- ],
- "columns": [
- { "data": "hostname",
- "type": "html",
- "render": function ( data, type, row, meta ) {
- if(type === 'display') data = '<a href="/tservers?s=' + row.id +
'">' + row.hostname + '</a>';
- return data;
- }
- },
- { "data": "tablets" },
- { "data": "lastContact" },
- { "data": "responseTime" },
- { "data": "entries" },
- { "data": "ingest" },
- { "data": "query" },
- { "data": "holdtime" },
- { "data": "scansCombo" },
- { "data": "minorCombo" },
- { "data": "majorCombo" },
- { "data": "indexCacheHitRate" },
- { "data": "dataCacheHitRate" },
- { "data": "osload" }
- ],
- "rowCallback": function (row, data, index) {
- // reset background of each row
- $(row).css('background-color', '');
-
- // return if the current row's tserver is not recovering
- if (!recoveryList.includes(data.hostname))
- return;
-
- // only show the caption if we know there are rows in the tservers
table
- $('#recovery-caption').show();
-
- // highlight current row
- console.log('Highlighting row index:' + index + ' tserver:' +
data.hostname);
- $(row).css('background-color', 'gold');
- }
- });
- refreshTServers();
-});
+function serverIsInRecoveryList(server) {
+ return recoveryList.includes(server.hostname);
Review Comment:
Cool!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]