Skip to content

The Postgres development platform. Supabase gives you a dedicated Postgres database to build your web, mobile, and AI applications.

Fix connection details analytics buckets, remove go to vault CTA for fields that aren't in vault (#40138)

Joshen Lima00fdc1c71b3
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/DecryptedReadOnlyInput.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/DecryptedReadOnlyInput.tsx
index ad4d675eaa4..86c6a519f93 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/DecryptedReadOnlyInput.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/DecryptedReadOnlyInput.tsx
@@ -49,21 +49,23 @@ export const DecryptedReadOnlyInput = ({
label={
<div className="flex items-center gap-x-2">
<span>{label}</span>
- <Tooltip>
- <TooltipTrigger asChild>
- <a
- target="_blank"
- rel="noreferrer noopener"
- href={`/project/${ref}/integrations/vault/secrets?search=${value}`}
- >
- <ExternalLink
- size={14}
- className="text-foreground-muted hover:text-foreground-lighter transition"
- />
- </a>
- </TooltipTrigger>
- <TooltipContent side="bottom">Open in Vault</TooltipContent>
- </Tooltip>
+ {secureEntry && (
+ <Tooltip>
+ <TooltipTrigger asChild>
+ <a
+ target="_blank"
+ rel="noreferrer noopener"
+ href={`/project/${ref}/integrations/vault/secrets?search=${value}`}
+ >
+ <ExternalLink
+ size={14}
+ className="text-foreground-muted hover:text-foreground-lighter transition"
+ />
+ </a>
+ </TooltipTrigger>
+ <TooltipContent side="bottom">Open in Vault</TooltipContent>
+ </Tooltip>
+ )}
</div>
}
description={descriptionText}
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/SimpleConfigurationDetails.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/SimpleConfigurationDetails.tsx
index 622121118c7..24b069cb8a1 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/SimpleConfigurationDetails.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/SimpleConfigurationDetails.tsx
@@ -1,7 +1,6 @@
-import {
- getCatalogURI,
- getConnectionURL,
-} from 'components/interfaces/Storage/StorageSettings/StorageSettings.utils'
+import { INTEGRATIONS } from 'components/interfaces/Integrations/Landing/Integrations.constants'
+import { WrapperMeta } from 'components/interfaces/Integrations/Wrappers/Wrappers.types'
+import { convertKVStringArrayToJson } from 'components/interfaces/Integrations/Wrappers/Wrappers.utils'
import {
ScaffoldHeader,
ScaffoldSection,
@@ -9,41 +8,20 @@ import {
ScaffoldSectionTitle,
} from 'components/layouts/Scaffold'
import { InlineLink } from 'components/ui/InlineLink'
-import { getKeys, useAPIKeysQuery } from 'data/api-keys/api-keys-query'
-import { useProjectSettingsV2Query } from 'data/config/project-settings-v2-query'
-import { useSelectedProjectQuery } from 'hooks/misc/useSelectedProject'
import { DOCS_URL } from 'lib/constants'
import { Card } from 'ui'
-import { DESCRIPTIONS } from './constants'
+import { DESCRIPTIONS, LABELS, OPTION_ORDER } from './constants'
import { CopyEnvButton } from './CopyEnvButton'
import { DecryptedReadOnlyInput } from './DecryptedReadOnlyInput'
-
-const wrapperMeta = {
- options: [
- { name: 'vault_token', label: 'Vault token', secureEntry: false },
- { name: 'warehouse', label: 'Warehouse name', secureEntry: false },
- { name: 's3.endpoint', label: 'S3 endpoint', secureEntry: false },
- { name: 'catalog_uri', label: 'Catalog URI', secureEntry: false },
- ],
-}
+import { useAnalyticsBucketWrapperInstance } from './useAnalyticsBucketWrapperInstance'
export const SimpleConfigurationDetails = ({ bucketName }: { bucketName?: string }) => {
- const { data: project } = useSelectedProjectQuery()
-
- const { data: apiKeys } = useAPIKeysQuery({ projectRef: project?.ref })
- const { data: settings } = useProjectSettingsV2Query({ projectRef: project?.ref })
- const protocol = settings?.app_config?.protocol ?? 'https'
- const endpoint = settings?.app_config?.storage_endpoint || settings?.app_config?.endpoint
-
- const { serviceKey } = getKeys(apiKeys)
- const serviceApiKey = serviceKey?.api_key ?? 'SUPABASE_CLIENT_SERVICE_KEY'
+ const integration = INTEGRATIONS.find((i) => i.id === 'iceberg_wrapper' && i.type === 'wrapper')
+ const wrapperMeta = (integration?.type === 'wrapper' && integration.meta) as WrapperMeta
- const values: Record<string, string> = {
- vault_token: serviceApiKey,
- warehouse: bucketName ?? '',
- 's3.endpoint': getConnectionURL(project?.ref ?? '', protocol, endpoint),
- catalog_uri: getCatalogURI(project?.ref ?? '', protocol, endpoint),
- }
+ /** The wrapper instance is the wrapper that is installed for this Analytics bucket. */
+ const { data: wrapperInstance } = useAnalyticsBucketWrapperInstance({ bucketId: bucketName })
+ const wrapperValues = convertKVStringArrayToJson(wrapperInstance?.server_options ?? [])
return (
<ScaffoldSection isFullWidth>
@@ -57,23 +35,32 @@ export const SimpleConfigurationDetails = ({ bucketName }: { bucketName?: string
>
Learn more
</InlineLink>
+ .
</ScaffoldSectionDescription>
</div>
- <CopyEnvButton serverOptions={wrapperMeta.options} values={values} />
+ <CopyEnvButton
+ serverOptions={wrapperMeta.server.options.filter(
+ (option) => !option.hidden && wrapperValues[option.name]
+ )}
+ values={wrapperValues}
+ />
</ScaffoldHeader>
<Card>
- {wrapperMeta.options.map((option) => {
- return (
- <DecryptedReadOnlyInput
- key={option.name}
- label={option.label}
- value={values[option.name]}
- secureEntry={option.secureEntry}
- descriptionText={DESCRIPTIONS[option.name]}
- />
- )
- })}
+ {wrapperMeta.server.options
+ .filter((option) => !option.hidden && wrapperValues[option.name])
+ .sort((a, b) => OPTION_ORDER.indexOf(a.name) - OPTION_ORDER.indexOf(b.name))
+ .map((option) => {
+ return (
+ <DecryptedReadOnlyInput
+ key={option.name}
+ label={LABELS[option.name]}
+ value={wrapperValues[option.name]}
+ secureEntry={option.secureEntry}
+ descriptionText={DESCRIPTIONS[option.name]}
+ />
+ )
+ })}
</Card>
</ScaffoldSection>
)
diff --git a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
index e993bf67e83..d01c01c5581 100644
--- a/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
+++ b/apps/studio/components/interfaces/Storage/AnalyticsBuckets/AnalyticsBucketDetails/index.tsx
@@ -36,9 +36,6 @@ import { Admonition } from 'ui-patterns/admonition'
import { GenericSkeletonLoader } from 'ui-patterns/ShimmeringLoader'
import { DeleteAnalyticsBucketModal } from '../DeleteAnalyticsBucketModal'
import { ConnectTablesDialog } from './ConnectTablesDialog'
-import { DESCRIPTIONS, LABELS, OPTION_ORDER } from './constants'
-import { CopyEnvButton } from './CopyEnvButton'
-import { DecryptedReadOnlyInput } from './DecryptedReadOnlyInput'
import { NamespaceWithTables } from './NamespaceWithTables'
import { SimpleConfigurationDetails } from './SimpleConfigurationDetails'
import { useAnalyticsBucketWrapperInstance } from './useAnalyticsBucketWrapperInstance'
@@ -199,44 +196,7 @@ export const AnalyticBucketDetails = () => {
)}
</ScaffoldSection>
- <ScaffoldSection isFullWidth>
- <ScaffoldHeader className="flex flex-row justify-between items-end gap-x-8">
- <div>
- <ScaffoldSectionTitle>Connection details</ScaffoldSectionTitle>
- <ScaffoldSectionDescription>
- Connect an Iceberg client to this bucket.{' '}
- <InlineLink
- href={`${DOCS_URL}/guides/storage/analytics/connecting-to-analytics-bucket`}
- >
- Learn more
- </InlineLink>
- </ScaffoldSectionDescription>
- </div>
- <CopyEnvButton
- serverOptions={wrapperMeta.server.options.filter(
- (option) => !option.hidden && wrapperValues[option.name]
- )}
- values={wrapperValues}
- />
- </ScaffoldHeader>
-
- <Card>
- {wrapperMeta.server.options
- .filter((option) => !option.hidden && wrapperValues[option.name])
- .sort((a, b) => OPTION_ORDER.indexOf(a.name) - OPTION_ORDER.indexOf(b.name))
- .map((option) => {
- return (
- <DecryptedReadOnlyInput
- key={option.name}
- label={LABELS[option.name]}
- value={wrapperValues[option.name]}
- secureEntry={option.secureEntry}
- descriptionText={DESCRIPTIONS[option.name]}
- />
- )
- })}
- </Card>
- </ScaffoldSection>
+ <SimpleConfigurationDetails bucketName={bucket?.id} />
</>
)}
{state === 'missing' && <WrapperMissing bucketName={bucket?.id} />}