feat: prevent adding connection when app is disabled

This commit is contained in:
kasia.oczkowska
2025-03-31 15:21:42 +01:00
parent 59256480c6
commit 56a2839504
2 changed files with 10 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ import AppConnectionRow from 'components/AppConnectionRow';
import NoResultFound from 'components/NoResultFound';
import Can from 'components/Can';
import useFormatMessage from 'hooks/useFormatMessage';
import useAppConfig from 'hooks/useAppConfig.ee';
import * as URLS from 'config/urls';
import useAppConnections from 'hooks/useAppConnections';
@@ -12,6 +13,8 @@ function AppConnections(props) {
const { appKey } = props;
const formatMessage = useFormatMessage();
const { data } = useAppConnections(appKey);
const { data: appConfig } = useAppConfig(appKey);
const appConnections = data?.data || [];
const hasConnections = appConnections?.length;
@@ -22,7 +25,10 @@ function AppConnections(props) {
<NoResultFound
text={formatMessage('app.noConnections')}
data-test="connections-no-results"
{...(allowed && { to: URLS.APP_ADD_CONNECTION(appKey) })}
{...(allowed &&
!appConfig?.data?.disabled && {
to: URLS.APP_ADD_CONNECTION(appKey),
})}
/>
)}
</Can>