From 5d686c2c86a1db4ce2c2c807edf6cb4dab839b49 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Mon, 4 Nov 2024 16:15:38 -0800 Subject: [PATCH 1/3] fix to get correct getSavedQueryCount Signed-off-by: Riya Saxena --- .../data/public/query/saved_query/saved_query_service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/data/public/query/saved_query/saved_query_service.ts b/src/plugins/data/public/query/saved_query/saved_query_service.ts index 92af9b7c024..8014d21e9f9 100644 --- a/src/plugins/data/public/query/saved_query/saved_query_service.ts +++ b/src/plugins/data/public/query/saved_query/saved_query_service.ts @@ -202,7 +202,7 @@ export const createSavedQueryService = ( const getSavedQueryCount = async (): Promise => { const response = await savedObjectsClient.find({ type: 'query', - perPage: 0, + perPage: 1, page: 1, }); return response.total; From 6294e96445e311b281bef304ded60831064a0e49 Mon Sep 17 00:00:00 2001 From: Riya <69919272+riysaxen-amzn@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:21:12 -0800 Subject: [PATCH 2/3] Update src/plugins/data/public/query/saved_query/saved_query_service.ts Co-authored-by: Miki Signed-off-by: Riya <69919272+riysaxen-amzn@users.noreply.github.com> --- src/plugins/data/public/query/saved_query/saved_query_service.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/data/public/query/saved_query/saved_query_service.ts b/src/plugins/data/public/query/saved_query/saved_query_service.ts index 8014d21e9f9..5d5863752d8 100644 --- a/src/plugins/data/public/query/saved_query/saved_query_service.ts +++ b/src/plugins/data/public/query/saved_query/saved_query_service.ts @@ -202,6 +202,7 @@ export const createSavedQueryService = ( const getSavedQueryCount = async (): Promise => { const response = await savedObjectsClient.find({ type: 'query', + // ToDo: Revert this back to `0` when Neo reports the count correctly irrespective of perPage. perPage: 1, page: 1, }); From 1b103bb9c9d5f69cae1209f46b144c4e3a72e484 Mon Sep 17 00:00:00 2001 From: Riya Saxena Date: Mon, 4 Nov 2024 20:13:47 -0800 Subject: [PATCH 3/3] fixed UTs Signed-off-by: Riya Saxena --- .../data/public/query/saved_query/saved_query_service.test.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/data/public/query/saved_query/saved_query_service.test.ts b/src/plugins/data/public/query/saved_query/saved_query_service.test.ts index b50c47f8040..47e04a91dad 100644 --- a/src/plugins/data/public/query/saved_query/saved_query_service.test.ts +++ b/src/plugins/data/public/query/saved_query/saved_query_service.test.ts @@ -457,7 +457,7 @@ describe('saved query service', () => { ); expect(mockSavedObjectsClient.find).toHaveBeenCalledWith({ page: 1, - perPage: 0, + perPage: 1, type: 'query', }); });