Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,50 @@

var compactorsTable;

/**
* Shows a red banner with the given message
*/
function showCompactorsBanner(message) {
$('#compactors-banner-message')
.removeClass('alert-warning')
.addClass('alert-danger')
.text(message);
$('#compactorsStatusBanner').show();
}

/**
* Show the error banner when there are no compactors
*/
function updateCompactorsBanner(compactors) {
if (!Array.isArray(compactors) || compactors.length === 0) {
showCompactorsBanner('No compactors are currently registered.');
} else {
$('#compactorsStatusBanner').hide();
}
}

$(function () {
// display datatables errors in the console instead of in alerts
$.fn.dataTable.ext.errMode = 'throw';

compactorsTable = $('#compactorsTable').DataTable({
"autoWidth": false,
"ajax": {
"url": contextPath + 'rest-v2/ec/compactors',
"dataSrc": "compactors"
"ajax": function (data, callback) {
$.ajax({
"url": contextPath + 'rest-v2/ec/compactors',
"method": 'GET'
}).done(function (response) {
var compactors = Array.isArray(response.compactors) ? response.compactors : [];
updateCompactorsBanner(compactors);
callback({
"data": compactors
});
}).fail(function () {
showCompactorsBanner('Unable to retrieve compactor status.');
callback({
"data": []
});
});
},
"stateSave": true,
"dom": 't<"align-left"l>p',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ function updateServerNotifications(statusData) {
}

/**
* Updates the scan server notification based on REST v2 metrics status.
* Updates the scan server notification based on REST v2 status.
*/
function refreshSserverStatus() {
return getSserversView().done(function () {
Expand All @@ -156,7 +156,7 @@ function refreshSserverStatus() {
return;
}

if (status.level === STATUS.WARN) {
if (status.hasProblemScanServers === true) {
sessionStorage.sServerStatus = STATUS.WARN;
updateElementStatus('sserverStatusNotification', STATUS.WARN);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
/* JSLint global definitions */
/*global
$, sessionStorage, getTServers, getRecoveryList, bigNumberForQuantity, timeDuration,
$, sessionStorage, getTServers, getRecoveryList, getStatus, bigNumberForQuantity, timeDuration,
ajaxReloadTable
*/
"use strict";
Expand Down Expand Up @@ -69,12 +69,35 @@ function refreshTServersTable() {
ajaxReloadTable(tserversTable);
}

/**
* If manager is down, tserver status will be ERROR. Add a banner to indicate
*/
function refreshTServersBanner(managerStatus) {
if (managerStatus === 'ERROR') {
$('#tserversManagerBanner').show();
$('#tservers_wrapper').hide();
$('#recovery-caption').hide();
} else {
$('#tserversManagerBanner').hide();
$('#tservers_wrapper').show();
}
}

/**
* Makes the REST calls, generates the tables with the new information
*/
function refreshTServers() {
getTServers().then(function () {
refreshTServersTable();
getStatus().then(function () {
var managerStatus = JSON.parse(sessionStorage.status).managerStatus;
refreshTServersBanner(managerStatus);

if (managerStatus === 'ERROR') {
return;
}

getTServers().then(function () {
refreshTServersTable();
});
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<h3>${title}</h3>
</div>
</div>
<div id="compactorsStatusBanner" style="display: none;">
<div id="compactors-banner-message" class="alert" role="alert"></div>
</div>
<div class="row">
<div class="col-xs-12">
<table id="compactorsTable" class="table caption-top table-bordered table-striped table-condensed">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
<h3>${title}</h3>
</div>
</div>
<div id="tserversManagerBanner" style="display: none;">
<div class="alert alert-danger" role="alert">Manager Not Running</div>
</div>
<div class="row">
<div class="col-xs-12">
<span id="recovery-caption" style="background-color: gold; display: none;">Highlighted rows correspond to tservers in recovery mode.</span>
Expand Down