Files
supabase/apps/studio/components/interfaces/Organization/OAuthApps/Consent/DatabaseAccessProjectIssues.tsx

58 lines
1.9 KiB
TypeScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
import { XIcon } from 'lucide-react'
import { Admonition } from 'ui-patterns/Admonition'
import { ButtonTooltip } from '@/components/ui/ButtonTooltip'
import type { OAuthDatabaseAccessIssue } from '@/data/oauth-apps/oauth-apps-database-access-readiness-query'
const issueMessages: Record<OAuthDatabaseAccessIssue, string> = {
postgres_upgrade_required: 'Needs Postgres 17 or later.',
project_unavailable: 'Database is currently unavailable.',
platform_unsupported: 'Database token access is not supported on this project’s platform.',
unknown: 'This project can’t be checked right now. Contact support if this persists.',
}
export function DatabaseAccessProjectIssues({
projects,
onRemove,
}: {
projects: {
ref: string
name: string
issues: OAuthDatabaseAccessIssue[]
}[]
onRemove?: (ref: string) => void
}) {
return (
<Admonition
type="warning"
title="These projects require changes"
description={onRemove ? 'Fix or remove them to continue.' : 'Fix them to continue.'}
>
<div className="mt-1 divide-y text-xs">
{projects.map(({ ref, name, issues }) => (
<div key={ref} className="flex items-center justify-between gap-2 py-2">
<div className="min-w-0 leading-normal">
<div className="font-medium text-foreground">{name}</div>
<ul className="list-disc pl-4">
{issues.map((issue) => (
<li key={issue}>{issueMessages[issue]}</li>
))}
</ul>
</div>
{onRemove && (
<ButtonTooltip
variant="text"
size="tiny"
aria-label={`Remove ${name}`}
onClick={() => onRemove(ref)}
icon={<XIcon />}
tooltip={{ content: { side: 'top', text: 'Remove project' } }}
/>
)}
</div>
))}
</div>
</Admonition>
)
}