commit 388329d: Merge pull request #3397 from moisseev/webui

GitHub noreply at github.com
Sun Jun 7 19:49:08 UTC 2020


Author: Vsevolod Stakhov
Date: 2020-06-07 20:42:30 +0100
URL: https://github.com/rspamd/rspamd/commit/388329de57ed412fe66063238964f77b609d5891 (HEAD -> master)

Merge pull request #3397 from moisseev/webui
[Minor] Hide Refresh button when it is unused

 interface/index.html       | 2 +-
 interface/js/app/rspamd.js | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --combined interface/index.html
index 12f7ab2ba,64f9fedd8..3dc35d20c
--- a/interface/index.html
+++ b/interface/index.html
@@@ -39,12 -39,11 +39,12 @@@
  			<li role="presentation"><a id="configuration_nav" aria-controls="configuration" role="tab" href="#configuration" data-toggle="tab">Configuration</a></li>
  			<li role="presentation"><a id="symbols_nav" aria-controls="symbols" role="tab" href="#symbols" data-toggle="tab">Symbols</a></li>
  			<li role="presentation"><a id="scan_nav" aria-controls="scan" role="tab" href="#scan" data-toggle="tab">Scan<span class="learn" style="display: none;">/Learn</span></a></li>
 +			<li role="presentation"><a id="selectors_nav" aria-controls="selectors" role="tab" href="#selectors" data-toggle="tab" style="display: none;">Test selectors</a></li>
  			<li role="presentation"><a id="history_nav" aria-controls="history" role="tab" href="#history" data-toggle="tab">History</a></li>
  		</ul>
      	<form class="navbar-form navbar-right" style="display: none;">
  			<div class="btn-group">
- 				<a href="#" class="btn btn-default" role="button" data-toggle="button" id="refresh"><i class="glyphicon glyphicon-refresh glyphicon-spin"></i> Refresh</a>
+ 				<a href="#" class="btn btn-default" role="button" data-toggle="button" id="refresh" style="display: none;"><i class="glyphicon glyphicon-refresh glyphicon-spin"></i> Refresh</a>
  				<button class="btn btn-default dropdown-toggle" data-toggle="dropdown" id="autoRefresh">
  					<span id="countdown">--:--</span> <span class="caret"></span>
  				</button>
@@@ -316,50 -315,6 +316,50 @@@
  				</div>
  			</div>
  
 +			<div class="tab-pane" id="selectors">
 +				<div class="widget-box">
 +					<div class="widget-title">
 +						<span class="icon"><i class="glyphicon glyphicon-envelope"></i></span>
 +						<h5>Test Rspamd selectors</h5>
 +					</div>
 +					<div class="widget-content">
 +						<h5>Message source:</h5>
 +						<div class="row">
 +							<form class="col-md-12">
 +								<div class="form-group">
 +									<textarea class="form-control" id="selectorsMsgArea" rows="9" placeholder="Paste raw message source"></textarea>
 +								</div>
 +								<div class="form-group">
 +									<button class="btn btn-default pull-right" id="selectorsMsgClean"><i class="glyphicon glyphicon-trash"></i> Clean form</button>
 +								</div>
 +							</form>
 +						</div>
 +
 +						<h5>Selector(s):</h5>
 +						<div class="row">
 +							<form class="col-md-12">
 +								<div class="form-group has-feedback">
 +									<textarea class="form-control" id="selectorsSelArea" rows="1" placeholder="extractor.transform(arg);extractor.transform(arg);..."></textarea>
 +									<span id="selector-feedback-icon" class="glyphicon form-control-feedback"></span>
 +								</div>
 +								<div class="form-group">
 +									<button type="submit" class="btn btn-default btn-primary" id="selectorsChkMsgBtn"><i class="glyphicon glyphicon-search"></i> Check message</button>
 +									<button class="btn btn-default pull-right" id="selectorsClean"><i class="glyphicon glyphicon-trash"></i> Clean form</button>
 +								</div>
 +							</form>
 +						</div>
 +						<h5>Result:</h5>
 +						<div class="row">
 +							<form class="col-md-12">
 +								<div class="form-group">
 +									<textarea class="form-control" id="selectorsResArea" rows="5" readonly></textarea>
 +								</div>
 +							</form>
 +						</div>
 +					</div>
 +				</div>
 +			</div>
 +
  			<div class="tab-pane" id="history">
  
  				<div class="widget-box">
diff --combined interface/js/app/rspamd.js
index dc343a694,585e20648..ffd3173d9
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@@ -26,10 -26,10 +26,10 @@@
  /* global jQuery:false, FooTable:false, Visibility:false */
  
  define(["jquery", "d3pie", "visibility", "nprogress", "stickytabs", "app/stats", "app/graph", "app/config",
 -    "app/symbols", "app/history", "app/upload"],
 +    "app/symbols", "app/history", "app/upload", "app/selectors"],
  // eslint-disable-next-line max-params
  function ($, D3pie, visibility, NProgress, stickyTabs, tab_stat, tab_graph, tab_config,
 -    tab_symbols, tab_history, tab_upload) {
 +    tab_symbols, tab_history, tab_upload, tab_selectors) {
      "use strict";
      var ui = {
          page_size: {
@@@ -125,6 -125,12 +125,12 @@@
              });
          }
  
+         if (["#scan_nav", "#selectors_nav", "#disconnect"].indexOf(tab_id) !== -1) {
+             $("#refresh").hide();
+         } else {
+             $("#refresh").show();
+         }
+ 
          switch (tab_id) {
              case "#status_nav":
                  (function () {
@@@ -260,7 -266,6 +266,7 @@@
                          $('#selSrv [value="' + e.name + '"]').prop("disabled", true);
                      }
                  });
 +                tab_selectors.checkSelectors(ui);
              },
              errorMessage: "Cannot get server status",
              server: "All SERVERS"
@@@ -273,12 -278,10 +279,12 @@@
              $(".learn").hide();
              $("#resetHistory").attr("disabled", true);
              $("#errors-history").hide();
 +            $("#selectors_nav").hide();
          } else {
              $(".learn").show();
              $("#resetHistory").removeAttr("disabled", true);
              $("#errors-history").show();
 +            $("#selectors_nav").show();
          }
  
          var buttons = $("#navBar form.navbar-right");
@@@ -430,7 -433,6 +436,7 @@@
          });
          tab_config.setup(ui);
          tab_history.setup(ui, tables);
 +        tab_selectors.setup(ui);
          tab_symbols.setup(ui, tables);
          tab_upload.setup(ui, tables);
          selData = tab_graph.setup(ui);


More information about the Commits mailing list