]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Add server selector to navbar
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 5 Feb 2017 14:34:31 +0000 (17:34 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sun, 5 Feb 2017 14:34:31 +0000 (17:34 +0300)
interface/index.html
interface/js/app/rspamd.js
interface/js/app/stats.js

index 3fa0459b40410f56e90ad5ab1e24def05c589438..71b9d575454eaeae2373dac13ddab0a684d25c2c 100644 (file)
@@ -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>
 
index 1490c927c967ee91b5bdc1b10fbb984457ef1488..98e6f54298553249907ac8d1e0cabd97a7109e06 100644 (file)
@@ -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) {
index e2ce33d0fcafcbdaeb58a8715b60a7e5014c814a..632b6a8abe1379ad4d4cf70d03987e4d77a3a89b 100644 (file)
@@ -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();
     }