diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-01 15:25:11 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-09-01 15:25:11 +0300 |
commit | c0195310bbf2d836f047dcb5691577da79ad88b9 (patch) | |
tree | adaaa264819acc5549391598efae87204f06861a /interface/js/app/history.js | |
parent | c9d823157837c2aff14e4db978109f6298e4409d (diff) | |
download | rspamd-c0195310bbf2d836f047dcb5691577da79ad88b9.tar.gz rspamd-c0195310bbf2d836f047dcb5691577da79ad88b9.zip |
[WebUI] Fix tables destroying
It seems there is a bug in Footable.
FooTable doesn't remove the table body if the table was initialized without contents.
Diffstat (limited to 'interface/js/app/history.js')
-rw-r--r-- | interface/js/app/history.js | 38 |
1 files changed, 15 insertions, 23 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 3863fece4..a6c080253 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -705,22 +705,7 @@ define(["jquery", "footable", "humanize"], }); }; - function updateErrorsTable(tables, data) { - var neighbours_data = data - .filter(function (d) { - return d.status; - }) // filter out unavailable neighbours - .map(function (d) { - return d.data; - }); - var flattened_data = [].concat.apply([], neighbours_data); - $.each(flattened_data, function (i, item) { - item.ts = unix_time_format(item.ts); - }); - tables.errors.rows.load(flattened_data); - } - - function initErrorsTable(tables, data) { + function initErrorsTable(tables, rows) { tables.errors = FooTable.init("#errorsLog", { columns: [ {sorted: true, direction: "DESC", name:"ts", title:"Time", style:{"font-size":"11px", "width":300, "maxWidth":300}}, @@ -730,6 +715,7 @@ define(["jquery", "footable", "humanize"], {name:"id", title:"Internal ID", style:{"font-size":"11px"}}, {name:"message", title:"Message", breakpoints:"xs sm", style:{"font-size":"11px"}}, ], + rows: rows, paging: { enabled: true, limit: 5, @@ -742,11 +728,6 @@ define(["jquery", "footable", "humanize"], }, sorting: { enabled: true - }, - on: { - "ready.ft.table": function () { - updateErrorsTable(tables, data); - } } }); } @@ -756,10 +737,21 @@ define(["jquery", "footable", "humanize"], rspamd.query("errors", { success: function (data) { + var neighbours_data = data + .filter(function (d) { + return d.status; + }) // filter out unavailable neighbours + .map(function (d) { + return d.data; + }); + var rows = [].concat.apply([], neighbours_data); + $.each(rows, function (i, item) { + item.ts = unix_time_format(item.ts); + }); if (Object.prototype.hasOwnProperty.call(tables, "errors")) { - updateErrorsTable(tables, data); + tables.errors.rows.load(rows); } else { - initErrorsTable(tables, data); + initErrorsTable(tables, rows); } } }); |