diff --git a/src/components/scans/ScansOverview.svelte b/src/components/scans/ScansOverview.svelte index f19f5e1a..35b05bc6 100644 --- a/src/components/scans/ScansOverview.svelte +++ b/src/components/scans/ScansOverview.svelte @@ -30,6 +30,7 @@ $table?.getSelectedRowModel().rows.map((row) => row.index) || []; $: active_delete = undefined; + $: dataLoaded = false; export let current_scans = []; export const addScans = (scans) => { current_scans = current_scans.concat(...scans); @@ -39,15 +40,6 @@ })); }; - const scans_promise = ScanService.scanControllerGetAll().then((val) => { - current_scans = val; - // handler.setRows(val); - current_scans = val; - options.update((options) => ({ - ...options, - data: current_scans, - })); - }); let allTracks = []; TrackService.trackControllerGetAll().then((val) => { allTracks = val; @@ -99,7 +91,7 @@ accessorKey: "timestamp", header: () => $_("timestamp"), cell: (info) => { - return (new Date(parseInt(info.getValue())*1000)).toLocaleString() + return new Date(parseInt(info.getValue()) * 1000).toLocaleString(); }, enableColumnFilter: false, }, @@ -183,6 +175,29 @@ backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)", }).showToast(); } + + onMount(async () => { + let page = 0; + while (page >= 0) { + const scans = await ScanService.scanControllerGetAll(page, 500); + if (scans.length == 0) { + page = -2; + dataLoaded = true; + } + + current_scans = current_scans.concat(...scans); + options.update((options) => ({ + ...options, + data: current_scans, + })); + + if (page == 0) { + dataLoaded = true; + } + page++; + } + console.log("All scans loaded"); + }); {#if store.state.jwtinfo.userdetails.permissions.includes("SCAN:GET")} - {#await scans_promise} + {#if !dataLoaded} - {:then} - {#if current_scans.length === 0} - - {:else} - {#if selected.length > 0} - - {/if} -
- - - {#each $table.getHeaderGroups() as headerGroup} - - - {#each headerGroup.headers as header} - - {/each} - - {/each} - - - {#each $table.getRowModel().rows as row} - - + {/each} + +
- $table.toggleAllRowsSelected()} - /> -
- row.toggleSelected()} + + + + {/if} +
+ + + {#each $table.getHeaderGroups() as headerGroup} + + + {#each headerGroup.headers as header} + + {/each} + + {/each} + + + {#each $table.getRowModel().rows as row} + + + {#each row.getVisibleCells() as cell} + - {#each row.getVisibleCells() as cell} - - {/each} - - {/each} - -
+ $table.toggleAllRowsSelected()} + /> +
+ row.toggleSelected()} + /> + + - -
-
- - {/if} - {:catch error} -
- - {$_("general_promise_error")} - {error} - + {/each} +
- {/await} + + {/if} {/if}