From 85d1ad8a56c72ee448f60c166b734540e6419fc0 Mon Sep 17 00:00:00 2001 From: Bhargav Date: Sun, 30 Jun 2024 05:49:40 +0530 Subject: [PATCH] fix: partial result (#3851) ## Summary by CodeRabbit - **New Features** - Enhanced data processing in paginated views, including updated field values, grid columns, and histogram chart titles. - **Bug Fixes** - Improved data extraction and filtering for more accurate query responses in paginated data. --- web/src/composables/useLogs.ts | 56 ++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 27 deletions(-) diff --git a/web/src/composables/useLogs.ts b/web/src/composables/useLogs.ts index bad3cc6a33..90d9343dc7 100644 --- a/web/src/composables/useLogs.ts +++ b/web/src/composables/useLogs.ts @@ -1811,6 +1811,20 @@ const useLogs = () => { }); }; + const processPostPaginationData = () => { + updateFieldValues(); + + //extract fields from query response + extractFields(); + + //update grid columns + updateGridColumns(); + + filterHitsColumns(); + + searchObj.data.histogram.chartParams.title = getHistogramTitle(); + } + const getPaginatedData = async ( queryReq: any, appendResult: boolean = false @@ -1982,34 +1996,21 @@ const useLogs = () => { searchObj.data.queryResults.subpage++; + setTimeout(async () => { + processPostPaginationData(); + + searchObj.data.functionError = ""; + if ( + res.data.hasOwnProperty("function_error") && + res.data.function_error + ) { + searchObj.data.functionError = res.data.function_error; + } + }, 0); await getPaginatedData(queryReq, true); } - - updateFieldValues(); - - //extract fields from query response - extractFields(); - - //update grid columns - updateGridColumns(); - - filterHitsColumns(); - - // disabled histogram case, generate histogram histogram title - // also calculate the total based on the partitions total - // if ( - // searchObj.meta.showHistogram == false || - // searchObj.meta.sqlMode == true - // ) { - // searchObj.data.queryResults.total = 0; - // for (const totalNumber of searchObj.data.queryResults - // .partitionDetail.partitionTotal) { - // if (totalNumber > 0) { - // searchObj.data.queryResults.total += totalNumber; - // } - // } - // } - searchObj.data.histogram.chartParams.title = getHistogramTitle(); + + await processPostPaginationData(); searchObj.data.functionError = ""; if ( @@ -2026,7 +2027,8 @@ const useLogs = () => { searchObjDebug["paginatedDataReceivedEndTime"] - searchObjDebug["paginatedDataReceivedStartTime"] } milliseconds to complete` - ); + ); + resolve(true); }) .catch((err) => {