Skip to content

Commit

Permalink
fix: Filter clusters by status of ready in kubectl modal
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 05f2c91
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/shared/src/components/Modals/KubeCtl/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function KubectlModal({ visible, title, params, onCancel }: KubectlModalP
const ref = useRef<TerminalRef>(null);
const [selectedCluster, setSelectedCluster] = useState(cluster);

console.log(cluster, selectedCluster);
const enableClustersQuery = (!cluster && isMultiCluster() && !isEdgeNode) || isClusterQuery;

const {
Expand All @@ -50,7 +51,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 05f2c91

Please sign in to comment.