diff options
author | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-10-21 21:53:15 +0300 |
---|---|---|
committer | Alexander Moisseev <moiseev@mezonplus.ru> | 2018-10-21 21:53:15 +0300 |
commit | 1bbc384db6a6798800c04292820ab503121db918 (patch) | |
tree | 0f30b7c500a7322f56552d4135a9408b3c6ca440 /interface/js | |
parent | 82f687439412e6dc3268239fca0798f586d15cc6 (diff) | |
download | rspamd-1bbc384db6a6798800c04292820ab503121db918.tar.gz rspamd-1bbc384db6a6798800c04292820ab503121db918.zip |
[WebUI] Add history rows per page control
Diffstat (limited to 'interface/js')
-rw-r--r-- | interface/js/app/history.js | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/interface/js/app/history.js b/interface/js/app/history.js index 8717d2e8e..fda16e245 100644 --- a/interface/js/app/history.js +++ b/interface/js/app/history.js @@ -27,7 +27,22 @@ define(["jquery", "footable", "humanize"], function ($, _, Humanize) { "use strict"; - var rows_per_page = 25; + var page_size = { + errors: 25, + history: 25 + }; + + function set_page_size(n, callback) { + if (n !== page_size.history && n > 0) { + page_size.history = n; + if (callback) { + return callback(n); + } + } + return null; + } + + set_page_size($("#history_page_size").val()); var ui = {}; var prevVersion = null; @@ -611,7 +626,7 @@ define(["jquery", "footable", "humanize"], paging: { enabled: true, limit: 5, - size: rows_per_page + size: page_size.history }, filtering: { enabled: true, @@ -652,7 +667,7 @@ define(["jquery", "footable", "humanize"], function waitForRowsDisplayed(rows_total, callback, iteration) { var i = (typeof iteration === "undefined") ? 10 : iteration; var num_rows = $("#historyTable > tbody > tr").length; - if (num_rows === rows_per_page || + if (num_rows === page_size.history || num_rows === rows_total) { return callback(); } else if (--i) { @@ -742,6 +757,9 @@ define(["jquery", "footable", "humanize"], var order = this.value; change_symbols_order(order); }); + $("#history_page_size").change(function () { + set_page_size(this.value, function (n) { tables.history.pageSize(n); }); + }); $(document).on("click", ".btn-sym-order button", function () { var order = this.value; $("#selSymOrder").val(order); @@ -782,7 +800,7 @@ define(["jquery", "footable", "humanize"], paging: { enabled: true, limit: 5, - size: rows_per_page + size: page_size.errors }, filtering: { enabled: true, |