"no-empty": "off",
"no-empty-function": "off",
"no-inline-comments": "off",
+ "no-invalid-this": "off",
"no-loop-func": "off",
"no-negated-condition": "off",
"no-param-reassign": "off",
"one-var-declaration-per-line": "off",
"prefer-spread": "off",
"sort-keys": "off",
- "sort-vars": "off",
- "strict": "off"
+ "sort-vars": "off"
}
}
THE SOFTWARE.
*/
-/* global $span:true, $tbody:true */
-
define(["jquery"],
function ($) {
- var interface = {};
+ "use strict";
+ var ui = {};
function save_map_success(rspamd) {
rspamd.alertMessage("alert-modal alert-success", "Map data successfully saved");
success: function (data) {
$listmaps.empty();
$("#modalBody").empty();
- $tbody = $("<tbody>");
+ var $tbody = $("<tbody>");
$.each(data, function (i, item) {
var label;
}
var $tr = $("<tr>");
$("<td class=\"col-md-2 maps-cell\">" + label + "</td>").appendTo($tr);
- $span = $("<span class=\"map-link\" data-toggle=\"modal\" data-target=\"#modalDialog\">" + item.uri + "</span>").data("item", item);
+ var $span = $("<span class=\"map-link\" data-toggle=\"modal\" data-target=\"#modalDialog\">" + item.uri + "</span>").data("item", item);
$span.wrap("<td>").parent().appendTo($tr);
$("<td>" + item.description + "</td>").appendTo($tr);
$tr.appendTo($tbody);
}
// @upload edited actions
- interface.setup = function (rspamd) {
+ ui.setup = function (rspamd) {
// Modal form for maps
$(document).on("click", "[data-toggle=\"modal\"]", function () {
var item = $(this).data("item");
});
};
- interface.getActions = getActions;
- interface.getMaps = getMaps;
+ ui.getActions = getActions;
+ ui.getMaps = getMaps;
- return interface;
+ return ui;
});
define(["jquery", "d3evolution", "footable"],
function ($, D3Evolution) {
+ "use strict";
var rrd_pie_config = {
header: {},
size: {
});
}
- var interface = {};
+ var ui = {};
var prevUnit = "msg/s";
- interface.draw = function (rspamd, graphs, neighbours, checked_server, type) {
+ ui.draw = function (rspamd, graphs, neighbours, checked_server, type) {
function updateWidgets(data) {
// Autoranging
});
};
- interface.setup = function () {
+ ui.setup = function () {
// Handling mouse events on overlapping elements
$("#rrd-pie").mouseover(function () {
$("#rrd-pie").css("z-index", "200");
return getSelector("selData");
};
- return interface;
+ return ui;
});
define(["jquery", "footable", "humanize"],
function ($, _, Humanize) {
- var interface = {};
+ "use strict";
+ var ui = {};
var ft = {};
var htmlEscapes = {
"&": "&",
return func();
}
- interface.getHistory = function (rspamd, tables, neighbours, checked_server) {
+ ui.getHistory = function (rspamd, tables, neighbours, checked_server) {
FooTable.actionFilter = FooTable.Filtering.extend({
construct : function (instance) {
this._super(instance);
$("#updateHistory").off("click");
$("#updateHistory").on("click", function (e) {
e.preventDefault();
- interface.getHistory(rspamd, tables, neighbours, checked_server);
+ ui.getHistory(rspamd, tables, neighbours, checked_server);
});
$("#selSymOrder").unbind().change(function () {
- interface.getHistory(rspamd, tables, neighbours, checked_server);
+ ui.getHistory(rspamd, tables, neighbours, checked_server);
});
// @reset history log
}
if (checked_server === "All SERVERS") {
rspamd.queryNeighbours("errors", function () {
- interface.getHistory(rspamd, tables, neighbours, checked_server);
- interface.getErrors(rspamd, tables, neighbours, checked_server);
+ ui.getHistory(rspamd, tables, neighbours, checked_server);
+ ui.getErrors(rspamd, tables, neighbours, checked_server);
});
}
else {
xhr.setRequestHeader("Password", rspamd.getPassword());
},
success: function () {
- interface.getHistory(rspamd, tables, neighbours, checked_server);
- interface.getErrors(rspamd, tables, neighbours, checked_server);
+ ui.getHistory(rspamd, tables, neighbours, checked_server);
+ ui.getErrors(rspamd, tables, neighbours, checked_server);
},
error: function (data) {
rspamd.alertMessage("alert-modal alert-error", data.statusText);
});
}
- interface.getErrors = function (rspamd, tables, neighbours, checked_server) {
+ ui.getErrors = function (rspamd, tables, neighbours, checked_server) {
if (rspamd.read_only) return;
if (checked_server !== "All SERVERS") {
$("#updateErrors").off("click");
$("#updateErrors").on("click", function (e) {
e.preventDefault();
- interface.getErrors(rspamd, tables, neighbours, checked_server);
+ ui.getErrors(rspamd, tables, neighbours, checked_server);
});
};
- interface.setup = function () {};
- return interface;
+ ui.setup = function () {};
+ return ui;
});
"app/symbols", "app/history", "app/upload"],
function ($, d3pie, visibility, tab_stat, tab_graph, tab_config,
tab_symbols, tab_history, tab_upload) {
+ "use strict";
// begin
var graphs = {};
var tables = {};
var neighbours = []; // list of clusters
var checked_server = "All SERVERS";
- var interface = {
+ var ui = {
read_only: false,
};
stopTimers();
cleanCredentials();
- interface.connect();
+ ui.connect();
}
function tabClick(tab_id) {
switch (tab_id) {
case "#status_nav":
- tab_stat.statWidgets(interface, graphs, checked_server);
+ tab_stat.statWidgets(ui, graphs, checked_server);
timer_id.status = Visibility.every(10000, function () {
- tab_stat.statWidgets(interface, graphs, checked_server);
+ tab_stat.statWidgets(ui, graphs, checked_server);
});
break;
case "#throughput_nav":
- tab_graph.draw(interface, graphs, neighbours, checked_server, selData);
+ tab_graph.draw(ui, graphs, neighbours, checked_server, selData);
var autoRefresh = {
hourly: 60000,
daily: 300000
};
timer_id.throughput = Visibility.every(autoRefresh[selData] || 3600000, function () {
- tab_graph.draw(interface, graphs, neighbours, checked_server, selData);
+ tab_graph.draw(ui, graphs, neighbours, checked_server, selData);
});
break;
case "#configuration_nav":
- tab_config.getActions(interface);
- tab_config.getMaps(interface);
+ tab_config.getActions(ui);
+ tab_config.getMaps(ui);
break;
case "#symbols_nav":
- tab_symbols.getSymbols(interface, tables, checked_server);
+ tab_symbols.getSymbols(ui, tables, checked_server);
break;
case "#history_nav":
- tab_history.getHistory(interface, tables, neighbours, checked_server);
- tab_history.getErrors(interface, tables, neighbours, checked_server);
+ tab_history.getHistory(ui, tables, neighbours, checked_server);
+ tab_history.getErrors(ui, tables, neighbours, checked_server);
break;
case "#disconnect":
disconnect();
}
// Public functions
- interface.alertMessage = alertMessage;
- interface.setup = function () {
+ ui.alertMessage = alertMessage;
+ ui.setup = function () {
$("#selData").change(function () {
selData = this.value;
tabClick("#throughput_nav");
tabClick("#status_nav");
}
});
- tab_config.setup(interface);
- tab_symbols.setup(interface, tables);
- tab_history.setup(interface, tables);
- tab_upload.setup(interface);
+ tab_config.setup(ui);
+ tab_symbols.setup(ui, tables);
+ tab_history.setup(ui, tables);
+ tab_upload.setup(ui);
selData = tab_graph.setup();
};
- interface.connect = function () {
+ ui.connect = function () {
if (isLogged()) {
var data = JSON.parse(sessionStorage.getItem("Credentials"));
if (data && data[checked_server].read_only) {
- interface.read_only = true;
+ ui.read_only = true;
$("#learning_nav").hide();
$("#resetHistory").attr("disabled", true);
$("#errors-history").hide();
}
else {
- interface.read_only = false;
+ ui.read_only = false;
$("#learning_nav").show();
$("#resetHistory").removeAttr("disabled", true);
}
return;
}
- var ui = $("#mainUI");
var dialog = $("#connectDialog");
var backdrop = $("#backDrop");
- $(ui).hide();
+ $("#mainUI").hide();
$(dialog).show();
$(backdrop).show();
$("#connectPassword").focus();
// Is actually never returned by Rspamd
} else {
if (data.read_only) {
- interface.read_only = true;
+ ui.read_only = true;
$("#learning_nav").hide();
$("#resetHistory").attr("disabled", true);
$("#errors-history").hide();
}
else {
- interface.read_only = false;
+ ui.read_only = false;
$("#learning_nav").show();
$("#resetHistory").removeAttr("disabled", true);
}
}
},
error: function (data) {
- interface.alertMessage("alert-modal alert-error", data.statusText);
+ ui.alertMessage("alert-modal alert-error", data.statusText);
$("#connectPassword").val("");
$("#connectPassword").focus();
}
});
};
- interface.queryLocal = function (req_url, on_success, on_error, method, headers, params) {
+ ui.queryLocal = function (req_url, on_success, on_error, method, headers, params) {
var req_params = {
type: method,
jsonp: false,
$.ajax(req_params);
};
- interface.queryNeighbours = function (req_url, on_success, on_error, method, headers, params, req_data) {
+ ui.queryNeighbours = function (req_url, on_success, on_error, method, headers, params, req_data) {
$.ajax({
dataType: "json",
type: "GET",
});
});
$.each(neighbours_status, function (ind) {
- "use strict";
method = typeof method !== "undefined" ? method : "GET";
var req_params = {
type: method,
});
},
error: function () {
- interface.alertMessage("alert-error", "Cannot receive neighbours data");
+ ui.alertMessage("alert-error", "Cannot receive neighbours data");
},
});
};
- interface.drawPie = function (obj, id, data, conf) {
+ ui.drawPie = function (obj, id, data, conf) {
if (obj) {
obj.updateProp("data.content",
data.filter(function (elt) {
return obj;
};
- interface.getPassword = getPassword;
+ ui.getPassword = getPassword;
- return interface;
+ return ui;
});
define(["jquery", "d3pie", "humanize"],
function ($, d3pie, Humanize) {
- // @ ms to date
+ "use strict";
+ // @ ms to date
function msToTime(seconds) {
/* eslint-disable no-bitwise */
var years = seconds / 31536000 >> 0; // 3600*24*365
}
}
// Public API
- var interface = {
+ var ui = {
statWidgets: function (rspamd, graphs, checked_server) {
rspamd.queryNeighbours("/auth", function (neighbours_status) {
var neighbours_sum = {
},
};
- return interface;
+ return ui;
}
);
define(["jquery", "footable"],
function ($) {
- var interface = {};
+ "use strict";
var ft = {};
+ var ui = {};
function saveSymbols(rspamd, action, id, is_cluster) {
var inputs = $("#" + id + " :input[data-role=\"numerictextbox\"]");
return [items, distinct_groups];
}
// @get symbols into modal form
- interface.getSymbols = function (rspamd) {
+ ui.getSymbols = function (rspamd) {
$.ajax({
dataType: "json",
});
};
- interface.setup = function (rspamd) {
+ ui.setup = function (rspamd) {
$("#updateSymbols").on("click", function (e) {
e.preventDefault();
$.ajax({
});
};
- return interface;
+ return ui;
});
define(["jquery"],
function ($) {
- var interface = {};
+ "use strict";
+ var ui = {};
function cleanTextUpload(source) {
$("#" + source + "TextSource").val("");
});
}
- interface.setup = function (rspamd) {
+ ui.setup = function (rspamd) {
$("textarea").change(function () {
if ($(this).val().length !== "") {
$(this).closest("form").find("button").removeAttr("disabled").removeClass("disabled");
};
- return interface;
+ return ui;
});
(window.location.pathname !== "/" ? window.location.pathname : "") +
" - Rspamd Web Interface";
-define("d3.global", ["d3"], function (_) {
+define("d3.global", ["d3"], function (_) { // eslint-disable-line strict
d3 = _; // eslint-disable-line no-global-assign
});
// Load main UI
require(["domReady"],
function (domReady) {
+ "use strict";
domReady(function () {
require(["jquery", "d3", "app/rspamd"],
function ($, d3, rspamd) {