From 62e3dede57f631cdb54a5bc3baae53497b75e2e2 Mon Sep 17 00:00:00 2001 From: Rohit Ashiwal Date: Wed, 27 Mar 2024 22:25:14 +0530 Subject: [PATCH] specify _all as target in ClearCacheModal When none of the indices are selected, ClearCacheModal makes call to `//_cache/clear` path. Here, the intention is to clear the cache for all indices, let's make it explicit by passing `_all` as target. New call: `/_all/_cache/clear` Signed-off-by: Rohit Ashiwal --- public/containers/ClearCacheModal/ClearCacheModal.tsx | 2 +- .../Indices/containers/IndicesActions/IndicesActions.test.tsx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/public/containers/ClearCacheModal/ClearCacheModal.tsx b/public/containers/ClearCacheModal/ClearCacheModal.tsx index 0855da739..6597c0d52 100644 --- a/public/containers/ClearCacheModal/ClearCacheModal.tsx +++ b/public/containers/ClearCacheModal/ClearCacheModal.tsx @@ -113,7 +113,7 @@ export default function ClearCacheModal(props: ClearCacheModalProps) { const result = await services.commonService.apiCaller({ endpoint: "indices.clearCache", data: { - index: unBlockedItems.join(","), + index: unBlockedItems.join(",") || "_all", }, }); if (result && result.ok) { diff --git a/public/pages/Indices/containers/IndicesActions/IndicesActions.test.tsx b/public/pages/Indices/containers/IndicesActions/IndicesActions.test.tsx index 2df5691b3..5af156c85 100644 --- a/public/pages/Indices/containers/IndicesActions/IndicesActions.test.tsx +++ b/public/pages/Indices/containers/IndicesActions/IndicesActions.test.tsx @@ -185,7 +185,7 @@ describe(" spec", () => { expect(browserServicesMock.commonService.apiCaller).toHaveBeenCalledWith({ endpoint: "indices.clearCache", data: { - index: "", + index: "_all", }, }); expect(coreServicesMock.notifications.toasts.addSuccess).toHaveBeenCalledTimes(1); @@ -238,7 +238,7 @@ describe(" spec", () => { expect(browserServicesMock.commonService.apiCaller).toHaveBeenCalledWith({ endpoint: "indices.clearCache", data: { - index: "", + index: "_all", }, }); expect(coreServicesMock.notifications.toasts.addError).toHaveBeenCalledTimes(1);