aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authorAlexander Moisseev <moiseev@mezonplus.ru>2017-02-05 17:34:31 +0300
committerAlexander Moisseev <moiseev@mezonplus.ru>2017-02-05 17:34:31 +0300
commitb285d8ff2e352e108807e4d7e0673082d6650883 (patch)
treec7a931cf35c72b817460a95c601ff9ce7152a482 /interface
parent1475fa5bc677ea4baa8782b5edebf0d50c92378a (diff)
downloadrspamd-b285d8ff2e352e108807e4d7e0673082d6650883.tar.gz
rspamd-b285d8ff2e352e108807e4d7e0673082d6650883.zip
[WebUI] Add server selector to navbar
Diffstat (limited to 'interface')
-rw-r--r--interface/index.html3
-rw-r--r--interface/js/app/rspamd.js6
-rw-r--r--interface/js/app/stats.js8
3 files changed, 17 insertions, 0 deletions
diff --git a/interface/index.html b/interface/index.html
index 3fa0459b4..71b9d5754 100644
--- a/interface/index.html
+++ b/interface/index.html
@@ -19,6 +19,9 @@
<div class="navbar-header">
<a class="navbar-brand" href="."><img src="./img/rspamd_logo_navbar.png" style="width: 67px; margin-top: -16px;"/></a>
</div>
+ <form class="navbar-form navbar-left">
+ <select id="selSrv" class="form-control"></select>
+ </form>
<ul class="nav navbar-nav nav-pills" role="tablist">
<li role="presentation" class="active"><a id="status_nav" aria-controls="status" role="tab" href="#status" data-toggle="tab">Status</a></li>
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 1490c927c..98e6f5429 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -205,6 +205,12 @@ define(['jquery', 'd3pie', 'visibility', 'app/stats', 'app/graph', 'app/config',
tabClick(tab_id);
});
+ $("#selSrv").change(function () {
+ checked_server = this.value;
+ $('#selSrv [value="' + checked_server + '"]').prop("checked", true);
+ tabClick("#" + $("#navBar ul li.active > a").attr("id"));
+ });
+
// Radio buttons
$(document).on('click', 'input:radio[name="clusterName"]', function () {
if (!this.disabled) {
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js
index e2ce33d0f..632b6a8ab 100644
--- a/interface/js/app/stats.js
+++ b/interface/js/app/stats.js
@@ -98,6 +98,7 @@ function($, d3pie, Humanize) {
$('#statWidgets').find('li.pull-right').appendTo('#statWidgets');
$("#clusterTable tbody").empty();
+ $("#selSrv").empty();
$.each(servers, function (key, val) {
var glyph_status;
if (val.status) {
@@ -135,6 +136,13 @@ function($, d3pie, Humanize) {
}
}
+
+ $("#selSrv").append( $('<option value="' + key + '">' + key + '</option>'));
+ if (checked_server == key) {
+ $('#selSrv [value="' + key + '"]').attr("selected", "selected");
+ } else if (!val.status) {
+ $('#selSrv [value="' + key + '"]').attr("disabled", "disabled");
+ }
});
$(widgets).show();
}