aboutsummaryrefslogtreecommitdiffstats
path: root/interface/js
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-31 17:35:44 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2017-01-31 17:35:44 +0000
commitc296719bb2bde1310c3cbc19d8d18950ed59c16f (patch)
tree229078db6647baca68ac9d7a1b256a55f47f082f /interface/js
parent3ea3361a8c17f35223854dd8b814e9220ffd0726 (diff)
downloadrspamd-c296719bb2bde1310c3cbc19d8d18950ed59c16f.tar.gz
rspamd-c296719bb2bde1310c3cbc19d8d18950ed59c16f.zip
[WebUI] Move symbols config as well
Diffstat (limited to 'interface/js')
-rw-r--r--interface/js/app/symbols.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/interface/js/app/symbols.js b/interface/js/app/symbols.js
index cead52dc7..f1169e544 100644
--- a/interface/js/app/symbols.js
+++ b/interface/js/app/symbols.js
@@ -26,6 +26,47 @@ define(['jquery', 'datatables'],
function($) {
var interface = {}
+ function saveSymbols(rspamd, action, id, is_cluster) {
+ var inputs = $('#' + id + ' :input[data-role="numerictextbox"]');
+ var url = action;
+ var values = [];
+ $(inputs).each(function () {
+ values.push({
+ name: $(this).attr('id').substring(5),
+ value: parseFloat($(this).val())
+ });
+ });
+ if (is_cluster) {
+ rspamd.queryNeighbours(url, function () {
+ rspamd.alertMessage('alert-modal alert-success', 'Symbols successfully saved');
+ }, function (serv, qXHR, textStatus, errorThrown) {
+ rspamd.alertMessage('alert-modal alert-error',
+ 'Save symbols error on ' +
+ serv.name + ': ' + errorThrown);
+ }, "POST", {}, {
+ data: JSON.stringify(values),
+ dataType: "json",
+ });
+ }
+ else {
+ $.ajax({
+ data: JSON.stringify(values),
+ dataType: 'json',
+ type: 'POST',
+ url: url,
+ jsonp: false,
+ beforeSend: function (xhr) {
+ xhr.setRequestHeader('Password', rspamd.getPassword());
+ },
+ success: function () {
+ rspamd.alertMessage('alert-modal alert-success', 'Symbols successfully saved');
+ },
+ error: function (data) {
+ rspamd.alertMessage('alert-modal alert-error', data.statusText);
+ }
+ });
+ }
+ }
function decimalStep(number) {
var digits = ((+number).toFixed(20)).replace(/^-?\d*\.?|0+$/g, '').length;
if (digits === 0 || digits > 4) {