From b6cdd82ed24734a3c0ce1696f897a1c7a6c5d5fe Mon Sep 17 00:00:00 2001 From: Boris Sekachev <40690378+bsekachev@users.noreply.github.com> Date: Mon, 15 Apr 2019 10:48:44 +0300 Subject: [PATCH] Fixed dashboard pagination (#399) --- .../static/dashboard/js/dashboard.js | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/cvat/apps/dashboard/static/dashboard/js/dashboard.js b/cvat/apps/dashboard/static/dashboard/js/dashboard.js index 53f3865dc7b3..3ac96c8deef1 100644 --- a/cvat/apps/dashboard/static/dashboard/js/dashboard.js +++ b/cvat/apps/dashboard/static/dashboard/js/dashboard.js @@ -315,9 +315,26 @@ class DashboardView { const dashboardPagination = $('#dashboardPagination'); const baseURL = this._baseURL; + let overlay = null; dashboardPagination.pagination({ - dataSource: this._dashboardList, + dataSource: '/api/v1/tasks', + locator: 'results', + alias: { + pageNumber: 'page', + }, + totalNumberLocator: function(response) { + return response.count; + }, + ajax: { + beforeSend() { + overlay = showOverlay('Loading..'); + }, + }, callback: function(pageList) { + if (overlay) { + overlay.remove(); + overlay = null; + } dashboardList.empty(); for (let details of pageList) { const detailsCopy = JSON.parse(JSON.stringify(details));