diff --git a/src/ui/common/src/components/resources/dialogs/deleteResourceDialog.tsx b/src/ui/common/src/components/resources/dialogs/deleteResourceDialog.tsx index bdb85bffc..d34987e3c 100644 --- a/src/ui/common/src/components/resources/dialogs/deleteResourceDialog.tsx +++ b/src/ui/common/src/components/resources/dialogs/deleteResourceDialog.tsx @@ -6,6 +6,7 @@ import React, { useEffect, useState } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import { useNavigate } from 'react-router-dom'; +import { useResourceOperatorsGetQuery } from '../../../handlers/AqueductApi'; import { handleGetServerConfig } from '../../../handlers/getServerConfig'; import { handleDeleteResource, @@ -86,6 +87,15 @@ const DeleteResourceDialog: React.FC = ({ (state: RootState) => state.serverConfigReducer ); + const { + data: resourceOperators, + isLoading: resourceOperatorsIsLoading, + error: resourceOperatorsError, + } = useResourceOperatorsGetQuery({ + apiKey: user.apiKey, + resourceId: resourceId, + }); + useEffect(() => { async function fetchServerConfig() { await dispatch(handleGetServerConfig({ apiKey: user.apiKey })); @@ -123,10 +133,6 @@ const DeleteResourceDialog: React.FC = ({ ); }; - const operatorsState = useSelector((state: RootState) => { - return state.resourceReducer.operators; - }); - const isStorage = config.use_as_storage === 'true'; let isCurrentStorage = isStorage; if (isStorage && serverConfig) { @@ -138,7 +144,6 @@ const DeleteResourceDialog: React.FC = ({ // Check deep equality isCurrentStorage = isEqual(storageConfig, serverConfig.config); } - if (isCurrentStorage) { return ( = ({ ); } else if ( - isSucceeded(operatorsState.status) && - !operatorsState.operators.some((op) => op.is_active) + !resourceOperatorsIsLoading && + !resourceOperatorsError && + resourceOperators.length === 0 ) { return ( <> @@ -208,7 +214,7 @@ const DeleteResourceDialog: React.FC = ({ } else { return ( diff --git a/src/ui/common/src/components/resources/dialogs/onDemandKubernetesDialog.tsx b/src/ui/common/src/components/resources/dialogs/onDemandKubernetesDialog.tsx index 34c194af2..e5e80460d 100644 --- a/src/ui/common/src/components/resources/dialogs/onDemandKubernetesDialog.tsx +++ b/src/ui/common/src/components/resources/dialogs/onDemandKubernetesDialog.tsx @@ -217,7 +217,6 @@ const OndemandK8sAWSDialog: React.FC> = ({ }) => { const { register, setValue, handleSubmit } = useFormContext(); const dispatch: AppDispatch = useDispatch(); - console.log(resourceToEdit); const editMode = !!resourceToEdit; if (resourceToEdit) { Object.entries(resourceToEdit).forEach(([k, v]) => {