<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="learning_nav" aria-controls="learning" role="tab" href="#learning" data-toggle="tab">Learning</a></li>
+ <li role="presentation"><a id="learning_nav" aria-controls="learning" role="tab" href="#learning" data-toggle="tab" style="display: none;">Learning</a></li>
<li role="presentation"><a id="scan_nav" aria-controls="scan" role="tab" href="#scan" data-toggle="tab">Scan</a></li>
<li role="presentation"><a id="history_nav" aria-controls="history" role="tab" href="#history" data-toggle="tab">History</a></li>
</ul>
var tables = {};
var neighbours = []; // list of clusters
var checked_server = "All SERVERS";
- var ui = {
- read_only: false,
- };
-
+ var ui = {};
var timer_id = [];
var selData; // Graph's dataset selector state
}
function displayUI() {
- // @toggle auth and main
+ // In many browsers local storage can only store string.
+ // So when we store the boolean true or false, it actually stores the strings "true" or "false".
+ ui.read_only = sessionStorage.getItem("read_only") === "true";
+ if (ui.read_only) {
+ $("#learning_nav").hide();
+ $("#resetHistory").attr("disabled", true);
+ $("#errors-history").hide();
+ } else {
+ $("#learning_nav").show();
+ $("#resetHistory").removeAttr("disabled", true);
+ }
+
var buttons = $("#navBar .pull-right");
$("#mainUI").show();
$("#progress").show();
ui.connect = function () {
if (isLogged()) {
- var data = JSON.parse(sessionStorage.getItem("Credentials"));
-
- if (data && data[checked_server].read_only) {
- ui.read_only = true;
- $("#learning_nav").hide();
- $("#resetHistory").attr("disabled", true);
- $("#errors-history").hide();
- } else {
- ui.read_only = false;
- $("#learning_nav").show();
- $("#resetHistory").removeAttr("disabled", true);
- }
displayUI();
return;
}
if (json.auth === "failed") {
// Is actually never returned by Rspamd
} else {
- if (json.read_only) {
- ui.read_only = true;
- $("#learning_nav").hide();
- $("#resetHistory").attr("disabled", true);
- $("#errors-history").hide();
- } else {
- ui.read_only = false;
- $("#learning_nav").show();
- $("#resetHistory").removeAttr("disabled", true);
- }
-
+ sessionStorage.setItem("read_only", json.read_only);
saveCredentials(password);
$(dialog).hide();
$(backdrop).hide();