From 218f1f57c7ece0e8418641f5cbbd7fc8d17b831b Mon Sep 17 00:00:00 2001 From: Alexander Moisseev Date: Sun, 5 Aug 2018 13:07:59 +0300 Subject: [Minor] Use query function to get maps --- interface/js/app/config.js | 75 ++++++++++++++++++++-------------------------- interface/js/app/rspamd.js | 2 +- 2 files changed, 34 insertions(+), 43 deletions(-) (limited to 'interface/js') diff --git a/interface/js/app/config.js b/interface/js/app/config.js index b98aed4c3..19bc234ec 100644 --- a/interface/js/app/config.js +++ b/interface/js/app/config.js @@ -57,35 +57,6 @@ define(["jquery"], }); } - // @get map by id - function getMapById(rspamd, item) { - return $.ajax({ - dataType: "text", - url: "getmap", - jsonp: false, - beforeSend: function (xhr) { - xhr.setRequestHeader("Password", rspamd.getPassword()); - xhr.setRequestHeader("Map", item.map); - }, - error: function () { - rspamd.alertMessage("alert-error", "Cannot receive maps data"); - }, - success: function (text) { - var disabled = ""; - if ((item.editable === false || rspamd.read_only)) { - disabled = "disabled=\"disabled\""; - } - - $("#" + item.map).remove(); - $("
" + - "" + - "" + + "" + + "
").appendTo("#modalBody"); + + $("#modalTitle").html(item.uri); + $("#" + item.map).first().show(); + $("#modalDialog .progress").hide(); + $("#modalDialog").modal({backdrop: true, keyboard: "show", show: true}); + if (item.editable === false) { + $("#modalSave").hide(); + $("#modalSaveAll").hide(); + } else { + $("#modalSave").show(); + $("#modalSaveAll").show(); + } + }, + errorMessage: "Cannot receive maps data", + server: (checked_server === "All SERVERS") ? "local" : checked_server }); return false; }); diff --git a/interface/js/app/rspamd.js b/interface/js/app/rspamd.js index 70f6fbfd5..e983e4074 100644 --- a/interface/js/app/rspamd.js +++ b/interface/js/app/rspamd.js @@ -286,7 +286,7 @@ function ($, d3pie, visibility, tab_stat, tab_graph, tab_config, tabClick("#status_nav"); } }); - tab_config.setup(ui); + tab_config.setup(ui, checked_server); tab_symbols.setup(ui); tab_upload.setup(ui); selData = tab_graph.setup(); -- cgit v1.2.3