19851: Don't rely on the API.MaxItemsPerResponse setting for calculations. 19851-log-panel-fix
authorLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 13 Dec 2022 19:22:21 +0000 (20:22 +0100)
committerLucas Di Pentima <lucas.dipentima@curii.com>
Tue, 13 Dec 2022 19:22:21 +0000 (20:22 +0100)
Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima <lucas.dipentima@curii.com>

src/store/process-logs-panel/process-logs-panel-actions.ts

index e0f5a14e2e716361f30e8855f3c99265dff8eed2..16177f18a62edaba2db7ee12f75e921dd6ebe946 100644 (file)
@@ -87,8 +87,8 @@ const loadContainerLogs = async (containerUuid: string, logService: LogService,
         order: requestOrderAsc,
     });
 
-    // Request the remaining, or the last 'maxPageSize' logs if necessary
-    const remainingLogs = itemsAvailable - maxPageSize;
+    // Request additional logs if necessary
+    const remainingLogs = itemsAvailable - items.length;
     if (remainingLogs > 0) {
         const { items: itemsLast } = await logService.list({
             limit: min([maxPageSize, remainingLogs]),
@@ -96,7 +96,7 @@ const loadContainerLogs = async (containerUuid: string, logService: LogService,
             order: requestOrderDesc,
             count: 'none',
         })
-        if (remainingLogs > maxPageSize) {
+        if (remainingLogs - itemsLast.length > 0) {
             const snipLine = {
                 ...items[items.length - 1],
                 eventType: LogEventType.SNIP,