Revert "revert: buggy pagination"

This reverts commit b2648645e8.
This commit is contained in:
2023-05-04 19:57:46 +02:00
parent b7a53960e5
commit dacb2f8ace
4 changed files with 75 additions and 28 deletions

View File

@@ -178,13 +178,26 @@
}
onMount(async () => {
const scans = await ScanService.scanControllerGetAll();
current_scans = scans;
options.update((options) => ({
...options,
data: current_scans,
}));
dataLoaded = true;
let page = 0;
let pagesize = 100;
while (page >= 0) {
const scans = await ScanService.scanControllerGetAll(page, pagesize);
if (scans.length == 0) {
page = -2;
}
current_scans = current_scans.concat(...scans);
options.update((options) => ({
...options,
data: current_scans,
}));
dataLoaded = true;
page++;
if (pagesize < 1000) {
pagesize += 100;
}
}
});
</script>