diff --git a/apps/studio/components/interfaces/Realtime/RealtimeSettings.tsx b/apps/studio/components/interfaces/Realtime/RealtimeSettings.tsx index d67c11d4599..19ecef90236 100644 --- a/apps/studio/components/interfaces/Realtime/RealtimeSettings.tsx +++ b/apps/studio/components/interfaces/Realtime/RealtimeSettings.tsx @@ -6,7 +6,6 @@ import { toast } from 'sonner' import * as z from 'zod' import { useParams } from 'common' -import { ScaffoldSection } from 'components/layouts/Scaffold' import AlertError from 'components/ui/AlertError' import { FormSection, FormSectionContent, FormSectionLabel } from 'components/ui/Forms/FormSection' import { ToggleSpendCapButton } from 'components/ui/ToggleSpendCapButton' @@ -145,446 +144,422 @@ export const RealtimeSettings = () => { return ( <> - - -
- {isError ? ( - - ) : ( - - - ( - Enable Realtime service} + + + {isError ? ( + + ) : ( + + + ( + Enable Realtime service} + > + - - + field.onChange(!checked)} + disabled={!canUpdateConfig} + /> + + + + {(isRealtimeDisabled || isDisablingRealtime || isEnablingRealtime) && ( + - - field.onChange(!checked)} - disabled={!canUpdateConfig} - /> - - - - {(isRealtimeDisabled || isDisablingRealtime || isEnablingRealtime) && ( - -
-
-
- {isDisablingRealtime - ? 'Realtime service will be disabled' - : isEnablingRealtime - ? 'Realtime service will be re-enabled' - : isRealtimeDisabled - ? 'Realtime service is disabled' - : null} -
-

- {isDisablingRealtime - ? 'Clients will no longer be able to connect to your project’s realtime service once saved' - : isEnablingRealtime - ? "Clients will be able to connect to your project's realtime service again once saved" - : isRealtimeDisabled - ? 'You will need to enable it to continue using Realtime' - : null} -

-
+
+
+
+ {isDisablingRealtime + ? 'Realtime service will be disabled' + : isEnablingRealtime + ? 'Realtime service will be re-enabled' + : isRealtimeDisabled + ? 'Realtime service is disabled' + : null} +
+

+ {isDisablingRealtime + ? 'Clients will no longer be able to connect to your project’s realtime service once saved' + : isEnablingRealtime + ? "Clients will be able to connect to your project's realtime service again once saved" + : isRealtimeDisabled + ? 'You will need to enable it to continue using Realtime' + : null} +

- - )} - - - )} - /> - - - {!suspend && ( - <> - - ( - Channel restrictions} - > - - - - - - - - {isSuccessPolicies && - !hasRealtimeMessagesPolicies && - !allow_public && - !isRealtimeDisabled && ( - -

- Private mode is {isSettingToPrivate ? 'being ' : ''} - enabled, but no RLS policies exists on the{' '} - - realtime.messages - {' '} - table. No messages will be received by users. -

- - - - } - /> - )} -
-
+
+ )} - /> - - - ( - - Realtime Authorization uses this database pool to check client - access -

- } - > - Database connection pool size - - } + +
+ )} + /> +
+ + {!suspend && ( + <> + + ( + Channel restrictions} + > + - - - - {!!maxConn && field.value > maxConn.maxConnections * 0.5 && ( + + + {isSuccessPolicies && + !hasRealtimeMessagesPolicies && + !allow_public && + !isRealtimeDisabled && ( - )} - - - )} - /> - - - ( - - Sets maximum number of concurrent clients that can connect to - your Realtime service -

- } - > - Max concurrent clients - - } - > - - - - - - -
- )} - /> -
- - ( - - Sets maximum number of events per second that can be sent to - your Realtime service -

- } - > - Max events per second - - } - > - - - - - - {isSuccessOrganization && !isUsageBillingEnabled && ( - -
-
-
- Spend cap needs to be disabled to configure this value -
-

- {isFreePlan - ? 'Upgrade to the Pro plan first to disable spend cap' - : 'You may adjust this setting in the organization billing settings'} + title="No Realtime RLS policies found" + description={ + <> +

+ Private mode is {isSettingToPrivate ? 'being ' : ''} + enabled, but no RLS policies exists on the{' '} + + realtime.messages + {' '} + table. No messages will be received by users.

-
-
- {isFreePlan ? ( - - ) : ( - - )} -
-
-
- )} -
-
- )} - /> -
- - ( - - Sets maximum number of presence events per second that can be - sent to your Realtime service -

- } - > - Max presence events per second - - } - > - - - - - - {isSuccessOrganization && !isUsageBillingEnabled && ( - -
-
-
- Spend cap needs to be disabled to configure this value -
-

- {isFreePlan - ? 'Upgrade to the Pro plan first to disable spend cap' - : 'You may adjust this setting in the organization billing settings'} -

-
-
- {isFreePlan ? ( - - ) : ( - - )} -
-
-
- )} -
-
- )} - /> -
- - ( - - Sets maximum number of payload size in KB that can be sent to - your Realtime service -

- } - > - Max payload size in KB - - } - > - - - - - - {isSuccessOrganization && !isUsageBillingEnabled && ( - -
-
-
- Spend cap needs to be disabled to configure this value -
-

- {isFreePlan - ? 'Upgrade to the Pro plan first to disable spend cap' - : 'You may adjust this setting in the organization billing settings'} -

-
-
- {isFreePlan ? ( - - ) : ( - - )} -
-
-
- )} -
-
- )} - /> -
- - )} - -
- {isPermissionsLoaded && !canUpdateConfig && ( -

- You need additional permissions to update realtime settings -

- )} -
-
- {form.formState.isDirty && ( - - )} - + + } + /> + )} + + + )} + /> + + + ( + + Realtime Authorization uses this database pool to check client + access +

+ } + > + Database connection pool size + + } + > + + + + + + {!!maxConn && field.value > maxConn.maxConnections * 0.5 && ( + + )} + +
+ )} + /> +
+ + ( + + Sets maximum number of concurrent clients that can connect to your + Realtime service +

+ } + > + Max concurrent clients + + } + > + + + + + + +
+ )} + /> +
+ + ( + + Sets maximum number of events per second that can be sent to your + Realtime service +

+ } + > + Max events per second + + } + > + + + + + + {isSuccessOrganization && !isUsageBillingEnabled && ( + +
+
+
+ Spend cap needs to be disabled to configure this value +
+

+ {isFreePlan + ? 'Upgrade to the Pro plan first to disable spend cap' + : 'You may adjust this setting in the organization billing settings'} +

+
+
+ {isFreePlan ? ( + + ) : ( + + )} +
+
+
+ )} +
+
+ )} + /> +
+ + ( + + Sets maximum number of presence events per second that can be sent + to your Realtime service +

+ } + > + Max presence events per second + + } + > + + + + + + {isSuccessOrganization && !isUsageBillingEnabled && ( + +
+
+
+ Spend cap needs to be disabled to configure this value +
+

+ {isFreePlan + ? 'Upgrade to the Pro plan first to disable spend cap' + : 'You may adjust this setting in the organization billing settings'} +

+
+
+ {isFreePlan ? ( + + ) : ( + + )} +
+
+
+ )} +
+
+ )} + /> +
+ + ( + + Sets maximum number of payload size in KB that can be sent to your + Realtime service +

+ } + > + Max payload size in KB + + } + > + + + + + + {isSuccessOrganization && !isUsageBillingEnabled && ( + +
+
+
+ Spend cap needs to be disabled to configure this value +
+

+ {isFreePlan + ? 'Upgrade to the Pro plan first to disable spend cap' + : 'You may adjust this setting in the organization billing settings'} +

+
+
+ {isFreePlan ? ( + + ) : ( + + )} +
+
+
+ )} +
+
+ )} + /> +
+ + )} + + +
+ {isPermissionsLoaded && !canUpdateConfig && ( +

+ You need additional permissions to update realtime settings +

+ )} +
+
+ {form.formState.isDirty && ( + -
-
- - )} - - - + )} + +
+
+ + )} + + { return ( - - - - - + <> + + + + Policies + Control access to your realtime channels + + + + + + + + + + + + + + ) } RealtimePoliciesPage.getLayout = (page) => ( - - } - size="large" - > - {page} - - + {page} ) diff --git a/apps/studio/pages/project/[ref]/realtime/settings.tsx b/apps/studio/pages/project/[ref]/realtime/settings.tsx index 5cffb3785b0..4c0e1ee4385 100644 --- a/apps/studio/pages/project/[ref]/realtime/settings.tsx +++ b/apps/studio/pages/project/[ref]/realtime/settings.tsx @@ -1,29 +1,51 @@ -import type { NextPageWithLayout } from 'types' - -import { RealtimeSettings } from 'components/interfaces/Realtime/RealtimeSettings' import DefaultLayout from 'components/layouts/DefaultLayout' -import { PageLayout } from 'components/layouts/PageLayout/PageLayout' import RealtimeLayout from 'components/layouts/RealtimeLayout/RealtimeLayout' -import { ScaffoldContainer } from 'components/layouts/Scaffold' import { DocsButton } from 'components/ui/DocsButton' import { DOCS_URL } from 'lib/constants' +import type { NextPageWithLayout } from 'types' +import { RealtimeSettings } from 'components/interfaces/Realtime/RealtimeSettings' +import { PageContainer } from 'ui-patterns/PageContainer' +import { + PageHeader, + PageHeaderAside, + PageHeaderDescription, + PageHeaderMeta, + PageHeaderSummary, + PageHeaderTitle, +} from 'ui-patterns/PageHeader' +import { PageSection, PageSectionContent } from 'ui-patterns/PageSection' -const RealtimePoliciesPage: NextPageWithLayout = () => { - return +const RealtimeSettingsPage: NextPageWithLayout = () => { + return ( + <> + + + + Realtime Settings + + Configure your project's Realtime settings + + + + + + + + + + + + + + + + ) } -RealtimePoliciesPage.getLayout = (page) => ( +RealtimeSettingsPage.getLayout = (page) => ( - - } - > - {page} - - + {page} ) -export default RealtimePoliciesPage +export default RealtimeSettingsPage