From cd70c1dd762db6ff9020a05462f82d2453d01239 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=A4=E6=9C=88?= <17949154+yazhouio@users.noreply.github.com> Date: Wed, 25 Sep 2024 17:13:17 +0800 Subject: [PATCH] fix: Filter clusters by status of ready in kubectl modal (#4317) fix: Filter ready clusters in KubectlModal onSuccess callback Signed-off-by: yazhou --- packages/shared/src/components/Modals/KubeCtl/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/shared/src/components/Modals/KubeCtl/index.tsx b/packages/shared/src/components/Modals/KubeCtl/index.tsx index 31396d9ba78..fa4572f9080 100644 --- a/packages/shared/src/components/Modals/KubeCtl/index.tsx +++ b/packages/shared/src/components/Modals/KubeCtl/index.tsx @@ -50,7 +50,8 @@ export function KubectlModal({ visible, title, params, onCancel }: KubectlModalP } = fetchGrantedList( { limit: -1 }, { - onSuccess: (arr: FormattedCluster[]) => { + onSuccess: (list: FormattedCluster[]) => { + const arr = list.filter(({ isReady }) => isReady); if (!selectedCluster || arr.findIndex(({ name }) => name === selectedCluster) === -1) { setSelectedCluster(arr[0]?.name); }