1414 * limitations under the License.
1515 */
1616
17- import { APIResponseHandler , ClusterProviderType , noop , useQuery } from '@devtron-labs/devtron-fe-common-lib'
17+ import { APIResponseHandler , noop , useQuery } from '@devtron-labs/devtron-fe-common-lib'
1818
1919import { importComponentFromFELibrary } from '@Components/common'
2020import { URLS } from '@Config/routes'
2121
2222import ClusterForm from './ClusterForm/ClusterForm'
23- import { getCluster } from './cluster.service'
23+ import { getEditClusterDrawerMetadata } from './cluster.service'
2424import { EditClusterDrawerContentProps , EditClusterDrawerMetadataType , EditClusterFormProps } from './cluster.type'
2525
2626const getSSHConfig : (
2727 ...props
2828) => Pick < EditClusterFormProps , 'sshUsername' | 'sshPassword' | 'sshAuthKey' | 'sshServerAddress' > =
2929 importComponentFromFELibrary ( 'getSSHConfig' , noop , 'function' )
3030
31- const getCloudProviderForCluster : ( clusterId : number ) => Promise < ClusterProviderType > = importComponentFromFELibrary (
32- 'getCloudProviderForCluster' ,
33- null ,
34- 'function' ,
35- )
36-
3731const EditClusterDrawerContent = ( {
3832 handleModalClose,
3933 sshTunnelConfig,
@@ -50,26 +44,14 @@ const EditClusterDrawerContent = ({
5044 insecureSkipTlsVerify,
5145 costModuleConfig,
5246} : EditClusterDrawerContentProps ) => {
53- const getClusterMetadata = async ( ) : Promise < EditClusterDrawerMetadataType > => {
54- if ( ! clusterId ) {
55- return { prometheusAuthResult : null , clusterProvider : null }
56- }
57-
58- const [ prometheusAuthResult , clusterProvider ] = await Promise . all ( [
59- getCluster ( + clusterId ) ,
60- getCloudProviderForCluster ? getCloudProviderForCluster ( + clusterId ) : null ,
61- ] )
62- return { prometheusAuthResult, clusterProvider }
63- }
64-
6547 const {
6648 isFetching : isMetadataLoading ,
6749 data : metadata ,
6850 error : metadataError ,
6951 refetch : reloadMetadata ,
7052 } = useQuery < EditClusterDrawerMetadataType , EditClusterDrawerMetadataType , [ string , number ] , false > ( {
7153 queryKey : [ 'get-cluster-metadata' , clusterId ] ,
72- queryFn : ( ) => getClusterMetadata ( ) ,
54+ queryFn : ( ) => getEditClusterDrawerMetadata ( clusterId ) ,
7355 enabled : ! ! clusterId ,
7456 } )
7557
0 commit comments