Skip to content

Commit

Permalink
fix: Filter ready clusters in KubectlModal onSuccess callback
Browse files Browse the repository at this point in the history
Signed-off-by: yazhou <[email protected]>
  • Loading branch information
yazhouio committed Sep 25, 2024
1 parent 603ce47 commit 1d9777b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/shared/src/components/Modals/KubeCtl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit 1d9777b

Please sign in to comment.