aboutsummaryrefslogtreecommitdiffstats
path: root/interface
diff options
context:
space:
mode:
authormoisseev <moiseev@mezonplus.ru>2021-06-17 19:35:34 +0300
committermoisseev <moiseev@mezonplus.ru>2021-06-17 19:35:34 +0300
commit93fd947ffac759c2c40a0b3994c5a10356cbee2c (patch)
treede099b2cd53269c3b8174172cb7f29c94ce4e618 /interface
parent4fc0603777c50df3783220316ba0e954baffb061 (diff)
downloadrspamd-93fd947ffac759c2c40a0b3994c5a10356cbee2c.tar.gz
rspamd-93fd947ffac759c2c40a0b3994c5a10356cbee2c.zip
[Minor] Refactor scan history auto-scrolling
Diffstat (limited to 'interface')
-rw-r--r--interface/js/app/upload.js22
1 files changed, 11 insertions, 11 deletions
diff --git a/interface/js/app/upload.js b/interface/js/app/upload.js
index 88b7da423..39e85640d 100644
--- a/interface/js/app/upload.js
+++ b/interface/js/app/upload.js
@@ -135,6 +135,15 @@ define(["jquery"],
},
method: "POST",
success: function (neighbours_status) {
+ function scrollTop(rows_total) {
+ // Is there a way to get an event when all rows are loaded?
+ rspamd.waitForRowsDisplayed("scan", rows_total, function () {
+ $("html, body").animate({
+ scrollTop: $("#scanResult").offset().top
+ }, 1000);
+ });
+ }
+
var json = neighbours_status[0].data;
if (json.action) {
rspamd.alertMessage("alert-success", "Data successfully scanned");
@@ -146,22 +155,13 @@ define(["jquery"],
if (Object.prototype.hasOwnProperty.call(tables, "scan")) {
tables.scan.rows.load(items, true);
- // Is there a way to get an event when all rows are loaded?
- rspamd.waitForRowsDisplayed("scan", rows_total, function () {
- $("html, body").animate({
- scrollTop: $("#scanResult").offset().top
- }, 1000);
- });
+ scrollTop(rows_total);
} else {
rspamd.destroyTable("scan");
// Is there a way to get an event when the table is destroyed?
setTimeout(function () {
rspamd.initHistoryTable(rspamd, data, items, "scan", columns_v2(), true);
- rspamd.waitForRowsDisplayed("scan", rows_total, function () {
- $("html, body").animate({
- scrollTop: $("#scanResult").offset().top
- }, 1000);
- });
+ scrollTop(rows_total);
}, 200);
}
} else {