From 4a69e2854ef892cf04f36d6ed168f9af6ac78c45 Mon Sep 17 00:00:00 2001 From: Mattia Franchetto Date: Wed, 9 Nov 2022 10:54:38 +0100 Subject: [PATCH] Fix a bug crashing the wizard when there's a cluster in deletion --- frontend/src/old-pages/Configure/Source.tsx | 37 +++++++++++++-------- 1 file changed, 23 insertions(+), 14 deletions(-) diff --git a/frontend/src/old-pages/Configure/Source.tsx b/frontend/src/old-pages/Configure/Source.tsx index 6176300b..29d8ab6a 100644 --- a/frontend/src/old-pages/Configure/Source.tsx +++ b/frontend/src/old-pages/Configure/Source.tsx @@ -136,36 +136,45 @@ function ClusterSelect() { const selectedPath = ['app', 'wizard', 'source', 'selectedCluster'] const apiVersion = useState(['app', 'version', 'full']) const clusters = useState(['clusters', 'list']) || [] - const filteredClusters = clusters.filter((cluster: ClusterInfoSummary) => - checkMinorVersion(cluster.version, apiVersion), - ) + const selectableClusters = clusters + .filter( + (cluster: ClusterInfoSummary) => + cluster.clusterStatus != ClusterStatus.DeleteInProgress, + ) + .filter((cluster: ClusterInfoSummary) => + checkMinorVersion(cluster.version, apiVersion), + ) + const selected = useState(selectedPath) const errors = useState([...sourceErrorsPath, 'sourceClusterName']) let source = useState([...sourcePath, 'type']) let validated = useState([...sourceErrorsPath, 'validated']) - const itemToOption = (item: ClusterInfoSummary) => { - if (item && item.clusterStatus != ClusterStatus.DeleteInProgress) - return {label: item.clusterName, value: item.clusterName} - else return null - } + const itemToOption = (item: ClusterInfoSummary) => ({ + label: item.clusterName, + value: item.clusterName, + }) return (