The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.
TypeScript aialternativeauthdatabasedenoembeddingsexamplefirebasenextjsoauth2pgvectorpostgispostgrespostgresqlpostgrestrealtimesupabasevectorswebsockets
Clean up storage s3 protocol settings dynamic rendering (#32601)
Joshen Lim9eb3c22e9991
diff --git a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/CreateCredentialModal.tsx b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/CreateCredentialModal.tsxindex 2df994c711e..db7a0b4d03d 100644--- a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/CreateCredentialModal.tsx+++ b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/CreateCredentialModal.tsx@@ -42,8 +42,7 @@ export const CreateCredentialModal = ({ visible, onOpenChange }: CreateCredentiaconst canCreateCredentials = useCheckPermissions(PermissionAction.STORAGE_ADMIN_WRITE, '*')const { data: config } = useProjectStorageConfigQuery({ projectRef })- // [Joshen clean up] Remove ?? true once storage BE changes are deployed- const isS3ConnectionEnabled = config?.features.s3Protocol?.enabled ?? true+ const isS3ConnectionEnabled = config?.features.s3Protocol.enabledconst disableCreation = !isProjectActive || !canCreateCredentials || !isS3ConnectionEnabledconst FormSchema = z.object({diff --git a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/S3Connection.tsx b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/S3Connection.tsxindex 21feb7436f7..80616b30845 100644--- a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/S3Connection.tsx+++ b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/S3Connection.tsx@@ -84,9 +84,6 @@ export const S3Connection = () => {const hasStorageCreds = storageCreds?.data && storageCreds.data.length > 0const s3connectionUrl = getConnectionURL(projectRef ?? '', protocol, endpoint)- // [Joshen clean up]: Can remove this boolean check once storage changes are deployed- const hasS3ProtocolFeature = config?.features.s3Protocol !== undefined-const onSubmit: SubmitHandler<z.infer<typeof FormSchema>> = async (data) => {if (!projectRef) return console.error('Project ref is required')if (!config) return console.error('Storage config is required')@@ -100,9 +97,8 @@ export const S3Connection = () => {}useEffect(() => {- if (hasS3ProtocolFeature) {- form.reset({ s3ConnectionEnabled: config?.features.s3Protocol.enabled })- }+ form.reset({ s3ConnectionEnabled: config?.features.s3Protocol.enabled })+// eslint-disable-next-line react-hooks/exhaustive-deps}, [isSuccessStorageConfig])@@ -119,43 +115,39 @@ export const S3Connection = () => {<GenericSkeletonLoader />) : isProjectActive ? (<Panel className="!mb-0">- {hasS3ProtocolFeature && (- <>- <FormField_Shadcn_- name="s3ConnectionEnabled"- control={form.control}- render={({ field }) => (- <FormItemLayout- layout="horizontal"- className="px-8 py-8 [&>*>label]:text-foreground"- label="Enable connection via S3 protocol"- description="Allow clients to connect to Supabase Storage via the S3 protocol"- >- <FormControl_Shadcn_>- <Switch- size="large"- checked={field.value}- onCheckedChange={field.onChange}- disabled={!isSuccessStorageConfig || field.disabled}- />- </FormControl_Shadcn_>- </FormItemLayout>- )}- />-- {isErrorStorageConfig && (- <div className="px-8 pb-8">- <AlertError- subject="Failed to retrieve storage configuration"- error={configError}+ <FormField_Shadcn_+ name="s3ConnectionEnabled"+ control={form.control}+ render={({ field }) => (+ <FormItemLayout+ layout="horizontal"+ className="px-8 py-8 [&>*>label]:text-foreground"+ label="Enable connection via S3 protocol"+ description="Allow clients to connect to Supabase Storage via the S3 protocol"+ >+ <FormControl_Shadcn_>+ <Switch+ size="large"+ checked={field.value}+ onCheckedChange={field.onChange}+ disabled={!isSuccessStorageConfig || field.disabled}/>- </div>- )}+ </FormControl_Shadcn_>+ </FormItemLayout>+ )}+ />- <Separator className="bg-border" />- </>+ {isErrorStorageConfig && (+ <div className="px-8 pb-8">+ <AlertError+ subject="Failed to retrieve storage configuration"+ error={configError}+ />+ </div>)}+ <Separator className="bg-border" />+<div className="flex flex-col gap-y-4 py-8"><FormItemLayoutlayout="horizontal"@@ -177,43 +169,35 @@ export const S3Connection = () => {)}</div>- {hasS3ProtocolFeature && (- <>- <Separator />+ <Separator />- <div className="flex items-center justify-between w-full gap-2 px-8 py-4">- {!canUpdateStorageSettings ? (- <p className="text-sm text-foreground-light">- You need additional permissions to update storage settings- </p>- ) : (- <div />- )}- <div className="flex gap-2">- <Button- type="default"- htmlType="reset"- onClick={() => form.reset()}- disabled={- !form.formState.isDirty || !canUpdateStorageSettings || isUpdating- }- >- Cancel- </Button>- <Button- type="primary"- htmlType="submit"- loading={isUpdating}- disabled={- !form.formState.isDirty || !canUpdateStorageSettings || isUpdating- }- >- Save- </Button>- </div>- </div>- </>- )}+ <div className="flex items-center justify-between w-full gap-2 px-8 py-4">+ {!canUpdateStorageSettings ? (+ <p className="text-sm text-foreground-light">+ You need additional permissions to update storage settings+ </p>+ ) : (+ <div />+ )}+ <div className="flex gap-2">+ <Button+ type="default"+ htmlType="reset"+ onClick={() => form.reset()}+ disabled={!form.formState.isDirty || !canUpdateStorageSettings || isUpdating}+ >+ Cancel+ </Button>+ <Button+ type="primary"+ htmlType="submit"+ loading={isUpdating}+ disabled={!form.formState.isDirty || !canUpdateStorageSettings || isUpdating}+ >+ Save+ </Button>+ </div>+ </div></Panel>) : (<Alert_Shadcn_ variant="warning">diff --git a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsxindex b93787e3534..cabedb71ae5 100644--- a/apps/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx+++ b/apps/studio/components/to-be-cleaned/Storage/StorageSettings/StorageSettings.tsx@@ -131,12 +131,9 @@ const StorageSettings = () => {updateStorageConfig({projectRef,fileSizeLimit: convertToBytes(data.fileSizeLimit, data.unit),- // @ts-ignore [Joshen clean up] Remove this once storage changes are deployed'features: {imageTransformation: { enabled: data.imageTransformationEnabled },- ...(config.features.s3Protocol !== undefined- ? { s3Protocol: config?.features.s3Protocol }- : {}),+ s3Protocol: { enabled: config.features.s3Protocol.enabled },},})}