From 0e51c4d2ff5f788d818d287e6ab9127d6d12e9ee Mon Sep 17 00:00:00 2001 From: "opensearch-trigger-bot[bot]" <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com> Date: Tue, 21 May 2024 20:50:36 +0530 Subject: [PATCH] specify _all as target in ClearCacheModal (#1020) (#1027) 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` (cherry picked from commit 134f23f17cfec83c8f74a640c95cf54a64235dde) Signed-off-by: Rohit Ashiwal Signed-off-by: github-actions[bot] Co-authored-by: github-actions[bot] --- 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);