diff options
author | moisseev <moiseev@mezonplus.ru> | 2023-12-27 15:22:23 +0300 |
---|---|---|
committer | moisseev <moiseev@mezonplus.ru> | 2023-12-27 15:24:31 +0300 |
commit | 01a0df9f25cee9e56294aea179e6a4e5f1b9c09a (patch) | |
tree | 92bac00331fb1673c07d5c57c7ed3b3a7d8a9caf /interface/js/app/symbols.js | |
parent | 9686fcf0234256d0b16856899ac3f75b3572dde1 (diff) | |
download | rspamd-01a0df9f25cee9e56294aea179e6a4e5f1b9c09a.tar.gz rspamd-01a0df9f25cee9e56294aea179e6a4e5f1b9c09a.zip |
[Minor] Move common stuff to separate files
Diffstat (limited to 'interface/js/app/symbols.js')
-rw-r--r-- | interface/js/app/symbols.js | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js index b00fc990f..1e3fb5de7 100644 --- a/interface/js/app/symbols.js +++ b/interface/js/app/symbols.js @@ -24,8 +24,8 @@ /* global FooTable */ -define(["jquery", "app/rspamd", "footable"], - ($, rspamd) => { +define(["jquery", "app/common", "footable"], + ($, common) => { "use strict"; const ui = {}; let altered = {}; @@ -41,10 +41,10 @@ define(["jquery", "app/rspamd", "footable"], const values = []; Object.entries(altered).forEach(([key, value]) => values.push({name: key, value: value})); - rspamd.query("./savesymbols", { + common.query("./savesymbols", { success: function () { clear_altered(); - rspamd.alertMessage("alert-modal alert-success", "Symbols successfully saved"); + common.alertMessage("alert-modal alert-success", "Symbols successfully saved"); }, complete: () => $("#save-alert button").removeAttr("disabled", true), errorMessage: "Save symbols error", @@ -124,7 +124,7 @@ define(["jquery", "app/rspamd", "footable"], // @get symbols into modal form ui.getSymbols = function (checked_server) { clear_altered(); - rspamd.query("symbols", { + common.query("symbols", { success: function (json) { const [{data}] = json; const items = process_symbols_data(data); @@ -182,7 +182,7 @@ define(["jquery", "app/rspamd", "footable"], }); /* eslint-enable consistent-this, no-underscore-dangle, one-var-declaration-per-line */ - rspamd.tables.symbols = FooTable.init("#symbolsTable", { + common.tables.symbols = FooTable.init("#symbolsTable", { columns: [ {sorted: true, direction: "ASC", name: "group", title: "Group"}, {name: "symbol", title: "Symbol"}, @@ -213,7 +213,7 @@ define(["jquery", "app/rspamd", "footable"], }, on: { "ready.ft.table": function () { - if (rspamd.read_only) { + if (common.read_only) { $(".mb-disabled").attr("disabled", true); } } @@ -228,11 +228,11 @@ define(["jquery", "app/rspamd", "footable"], $("#updateSymbols").on("click", (e) => { e.preventDefault(); clear_altered(); - const checked_server = rspamd.getSelector("selSrv"); - rspamd.query("symbols", { + const checked_server = common.getSelector("selSrv"); + common.query("symbols", { success: function (data) { const [items] = process_symbols_data(data[0].data); - rspamd.tables.symbols.rows.load(items); + common.tables.symbols.rows.load(items); }, server: (checked_server === "All SERVERS") ? "local" : checked_server }); |