]> source.dussan.org Git - rspamd.git/commitdiff
[WebUI] Check if neighbours' history backend versions match 1583/head
authorAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 8 Apr 2017 07:58:14 +0000 (10:58 +0300)
committerAlexander Moisseev <moiseev@mezonplus.ru>
Sat, 8 Apr 2017 07:58:14 +0000 (10:58 +0300)
interface/js/app/history.js

index 779ed685549ff796a055993baff595e401bd4b99..8c3db7b9d89dd61083c92e05cfd35f1ab14eaee0 100644 (file)
@@ -417,10 +417,21 @@ function($, _, Humanize) {
 
         if (checked_server === "All SERVERS") {
             rspamd.queryNeighbours("history", function (req_data) {
+                function differentVersions() {
+                    const dv = neighbours_data.some(function (e) {
+                        return e.version !== neighbours_data[0].version;
+                    });
+                    if (dv) {
+                        rspamd.alertMessage('alert-error',
+                            'Neighbours history backend versions do not match. Cannot display history.');
+                        return true;
+                    }
+                }
+
                 var neighbours_data = req_data
                     .filter(function (d) { return d.status }) // filter out unavailable neighbours
                     .map(function (d){ return d.data; });
-                if (neighbours_data.length > 0) {
+                if (neighbours_data.length && !differentVersions()) {
                     var data = {};
                     if (neighbours_data[0].version) {
                         data.rows = [].concat.apply([], neighbours_data
@@ -455,8 +466,12 @@ function($, _, Humanize) {
                             filtering: FooTable.actionFilter
                         }
                     });
+                } else {
+                    if (ft.history) {
+                        ft.history.destroy();
+                        ft.history = undefined;
+                    }
                 }
-
             });
         }
         else {