aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authormoisseev <moiseev@mezonplus.ru>2023-11-20 15:58:06 +0300
committermoisseev <moiseev@mezonplus.ru>2023-11-20 15:58:06 +0300
commiteab17b201a5ec7cbe13c15a7cf2b1bbd9480816a (patch)
tree74c111256ad419c5744b9d0196910fdebefad2d6 /interface
parent4d10f4efe643a84da936f29d48cc28ad70803ab0 (diff)
downloadrspamd-eab17b201a5ec7cbe13c15a7cf2b1bbd9480816a.tar.gz
rspamd-eab17b201a5ec7cbe13c15a7cf2b1bbd9480816a.zip
[Minor] Use destructuring
Diffstat (limited to 'interface')
-rw-r--r--interface/js/app/config.js2
-rw-r--r--interface/js/app/graph.js2
-rw-r--r--interface/js/app/history.js4
-rw-r--r--interface/js/app/rspamd.js8
-rw-r--r--interface/js/app/stats.js8
-rw-r--r--interface/js/app/symbols.js8
-rw-r--r--interface/js/app/upload.js2
7 files changed, 17 insertions, 17 deletions
diff --git a/interface/js/app/config.js b/interface/js/app/config.js
index e0adb365b..9f62c97db 100644
--- a/interface/js/app/config.js
+++ b/interface/js/app/config.js
@@ -120,7 +120,7 @@ define(["jquery", "app/rspamd"],
$listmaps.closest(".card").hide();
rspamd.query("maps", {
success: function (json) {
- const data = json[0].data;
+ const [{data}] = json;
$listmaps.empty();
$("#modalBody").empty();
const $tbody = $("<tbody>");
diff --git a/interface/js/app/graph.js b/interface/js/app/graph.js
index ea330aef6..a661d4a19 100644
--- a/interface/js/app/graph.js
+++ b/interface/js/app/graph.js
@@ -209,7 +209,7 @@ define(["jquery", "app/rspamd", "d3evolution", "d3pie", "d3", "footable"],
.map(function (d) { return d.data; });
if (neighbours_data.length === 1) {
- data = neighbours_data[0];
+ [data] = neighbours_data;
} else {
let time_match = true;
neighbours_data.reduce(function (res, curr, _, arr) {
diff --git a/interface/js/app/history.js b/interface/js/app/history.js
index 3d06f667c..568c69763 100644
--- a/interface/js/app/history.js
+++ b/interface/js/app/history.js
@@ -340,7 +340,7 @@ define(["jquery", "app/rspamd", "d3", "footable"],
.map(function (d) { return d.data; });
if (neighbours_data.length && !differentVersions(neighbours_data)) {
let data = {};
- const version = neighbours_data[0].version;
+ const [{version}] = neighbours_data;
if (version) {
data.rows = [].concat.apply([], neighbours_data
.map(function (e) {
@@ -354,7 +354,7 @@ define(["jquery", "app/rspamd", "d3", "footable"],
$("#legacy-history-badge").show();
}
const o = process_history_data(data);
- const items = o.items;
+ const {items} = o;
rspamd.symbols.history = o.symbols;
if (Object.prototype.hasOwnProperty.call(rspamd.tables, "history") &&
diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js
index 26bd6c40d..64eab27a0 100644
--- a/interface/js/app/rspamd.js
+++ b/interface/js/app/rspamd.js
@@ -492,7 +492,7 @@ function ($, NProgress) {
Password: password
},
success: function (json) {
- const data = json[0].data;
+ const [{data}] = json;
$("#connectPassword").val("");
if (data.auth === "ok") {
sessionStorage.setItem("read_only", data.read_only);
@@ -563,7 +563,7 @@ function ($, NProgress) {
if (o.server === "All SERVERS") {
queryServer(neighbours_status, 0, "neighbours", {
success: function (json) {
- const data = json[0].data;
+ const [{data}] = json;
if (jQuery.isEmptyObject(data)) {
neighbours = {
local: {
@@ -695,7 +695,7 @@ function ($, NProgress) {
});
},
_onStatusDropdownChanged: function (e) {
- const self = e.data.self;
+ const {self} = e.data;
const selected = self.$action.val();
if (selected !== self.def) {
const not = self.$not.is(":checked");
@@ -1054,7 +1054,7 @@ function ($, NProgress) {
$(".dropdown-menu a").click(function (e) {
e.preventDefault();
const classList = $(this).attr("class");
- const menuClass = (/\b(?:dynamic|history|preset)\b/).exec(classList)[0];
+ const [menuClass] = (/\b(?:dynamic|history|preset)\b/).exec(classList);
$(".dropdown-menu a.active." + menuClass).removeClass("active");
$(this).addClass("active");
tabClick("#autoRefresh");
diff --git a/interface/js/app/stats.js b/interface/js/app/stats.js
index 8fa580421..c445793d9 100644
--- a/interface/js/app/stats.js
+++ b/interface/js/app/stats.js
@@ -58,7 +58,7 @@ define(["jquery", "app/rspamd", "d3pie", "d3"],
const servers = JSON.parse(sessionStorage.getItem("Credentials"));
let data = {};
if (servers && servers[checked_server]) {
- data = servers[checked_server].data;
+ ({data} = servers[checked_server]);
}
const stat_w = [];
@@ -122,7 +122,7 @@ define(["jquery", "app/rspamd", "d3pie", "d3"],
uptime = msToTime(val.data.uptime);
}
if ("version" in val.data) {
- version = val.data.version;
+ ({version} = val.data);
}
if (key === "All SERVERS") {
short_id = "";
@@ -249,7 +249,7 @@ define(["jquery", "app/rspamd", "d3pie", "d3"],
const creds = JSON.parse(sessionStorage.getItem("Credentials"));
// Controller doesn't return the 'actions' object until at least one message is scanned
if (creds && creds[checked_server] && creds[checked_server].data.scanned) {
- const actions = creds[checked_server].data.actions;
+ const {actions} = creds[checked_server].data;
["no action", "soft reject", "add header", "rewrite subject", "greylist", "reject"]
.forEach(function (action) {
@@ -295,7 +295,7 @@ define(["jquery", "app/rspamd", "d3pie", "d3"],
};
function process_node_stat(e) {
- const data = neighbours_status[e].data;
+ const {data} = neighbours_status[e];
// Controller doesn't return the 'actions' object until at least one message is scanned
if (data.scanned) {
for (const action in neighbours_sum.actions) {
diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js
index ab6e8c101..be6ad8d81 100644
--- a/interface/js/app/symbols.js
+++ b/interface/js/app/symbols.js
@@ -141,14 +141,14 @@ define(["jquery", "app/rspamd", "footable"],
ui.getSymbols = function (checked_server) {
rspamd.query("symbols", {
success: function (json) {
- const data = json[0].data;
+ const [{data}] = json;
const items = process_symbols_data(data);
/* eslint-disable consistent-this, no-underscore-dangle, one-var-declaration-per-line */
FooTable.groupFilter = FooTable.Filtering.extend({
construct: function (instance) {
this._super(instance);
- this.groups = items[1];
+ [,this.groups] = items;
this.def = "Any group";
this.$group = null;
},
@@ -176,7 +176,7 @@ define(["jquery", "app/rspamd", "footable"],
});
},
_onStatusDropdownChanged: function (e) {
- const self = e.data.self;
+ const {self} = e.data;
const selected = $(this).val();
if (selected !== self.def) {
self.addFilter("group", selected, ["group"]);
@@ -254,7 +254,7 @@ define(["jquery", "app/rspamd", "footable"],
const checked_server = rspamd.getSelector("selSrv");
rspamd.query("symbols", {
success: function (data) {
- const items = process_symbols_data(data[0].data)[0];
+ const [items] = process_symbols_data(data[0].data);
rspamd.tables.symbols.rows.load(items);
},
server: (checked_server === "All SERVERS") ? "local" : checked_server
diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js
index 01031c4a0..9893477f1 100644
--- a/interface/js/app/upload.js
+++ b/interface/js/app/upload.js
@@ -172,7 +172,7 @@ define(["jquery", "app/rspamd"],
const rows_total = $("#historyTable_scan > tbody > tr:not(.footable-detail-row)").length + 1;
const o = rspamd.process_history_v2({rows: [json]}, "scan");
- const items = o.items;
+ const {items} = o;
rspamd.symbols.scan.push(o.symbols[0]);
if (Object.prototype.hasOwnProperty.call(rspamd.tables, "scan")) {