diff --git a/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx b/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx index e39273fb376..a0061a3015c 100644 --- a/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx +++ b/studio/components/interfaces/Settings/Database/SSLConfiguration.tsx @@ -2,7 +2,7 @@ import Link from 'next/link' import { useState, useEffect } from 'react' import { useParams, useStore } from 'hooks' import * as Tooltip from '@radix-ui/react-tooltip' -import { Button, IconDownload, Toggle, IconExternalLink, IconLoader } from 'ui' +import { Button, IconDownload, Toggle, IconExternalLink, IconLoader, Alert } from 'ui' import { FormHeader, FormPanel, @@ -25,6 +25,7 @@ const SSLConfiguration = () => { }) const { mutateAsync: updateSSLEnforcement } = useSSLEnforcementUpdateMutation() + const hasAccessToSSLEnforcement = !sslEnforcementConfiguration?.isNotAllowed const env = process.env.NEXT_PUBLIC_ENVIRONMENT === 'prod' ? 'prod' : 'staging' const hasSSLCertificate = projectSettings?.project !== undefined && @@ -39,8 +40,6 @@ const SSLConfiguration = () => { } }, [isLoading]) - // [Joshen] What is applied successfully = false? - const toggleSSLEnforcement = async () => { if (!ref) return console.error('Project ref is required') @@ -63,6 +62,8 @@ const SSLConfiguration = () => { } } + if (!hasAccessToSSLEnforcement) return <> + return (
@@ -81,17 +82,35 @@ const SSLConfiguration = () => { - Reject connections made to your database without a valid certificate -

+
+

+ Reject connections made to your database without a valid certificate +

+ {!sslEnforcementConfiguration?.appliedSuccessfully && ( + + Please try updating again, or contact{' '} + + + support + + {' '} + if this error persists + + )} +
} > Enforce SSL } > - +
{isSubmitting && }