ComplianceConfig() — supabase Function Reference
Architecture documentation for the ComplianceConfig() function in ProjectComplianceMode.tsx from the supabase codebase.
Entity Profile
Relationship Graph
Source Code
apps/studio/components/interfaces/Settings/General/ComplianceConfig/ProjectComplianceMode.tsx lines 25–126
export const ComplianceConfig = () => {
const { ref } = useParams()
const { data: project } = useSelectedProjectQuery()
const [isSensitive, setIsSensitive] = useState(false)
const { can: canUpdateComplianceConfig } = useAsyncCheckPermissions(
PermissionAction.UPDATE,
'projects',
{
resource: { project_id: project?.id },
}
)
const {
data: settings,
error,
isError,
isPending: isLoading,
isSuccess,
} = useProjectSettingsV2Query({ projectRef: ref })
const initialIsSensitive = settings?.is_sensitive || false
const { mutate: updateComplianceConfig, isPending: isSubmitting } =
useComplianceConfigUpdateMutation({
onSuccess: () => {
toast.success('Successfully updated project compliance configuration')
},
onError: (error) => {
setIsSensitive(initialIsSensitive)
toast.error(`Failed to update project compliance configuration: ${error.message}`)
},
})
const toggleIsSensitive = async () => {
if (!ref) return console.error('Project ref is required')
setIsSensitive(!isSensitive)
updateComplianceConfig({ projectRef: ref, isSensitive: !isSensitive })
}
useEffect(() => {
if (!isLoading) setIsSensitive(initialIsSensitive)
}, [isLoading])
return (
<PageSection id="compliance-configuration">
<PageSectionMeta>
<div className="flex flex-col gap-3 @lg:flex-row @lg:items-center @lg:justify-between">
<PageSectionSummary>
<PageSectionTitle>High Compliance Configuration</PageSectionTitle>
<PageSectionDescription>
For projects storing and processing sensitive data (HIPAA).
</PageSectionDescription>
</PageSectionSummary>
<DocsButton href={`${DOCS_URL}/guides/platform/hipaa-projects`} />
</div>
</PageSectionMeta>
<PageSectionContent>
<Card>
<CardContent className="flex flex-col gap-4 @lg:flex-row @lg:items-center @lg:justify-between">
<div className="space-y-2 max-w-2xl">
<p className="text-sm">Apply additional compliance controls to project</p>
<p className="text-sm text-foreground-light">
Enable security warnings in the{' '}
<InlineLink href={`/project/${ref}/advisors/security`}>Security Advisor</InlineLink>{' '}
to enforce requirements for managing sensitive data.
</p>
</div>
<div className="flex items-center justify-end space-x-2">
{(isLoading || isSubmitting) && (
<Loader2 className="animate-spin" strokeWidth={1.5} size={16} />
)}
{isError && (
<AlertError error={error} subject="Failed to retrieve project settings" />
)}
{isSuccess && (
<Tooltip>
<TooltipTrigger asChild>
{/* [Joshen] Added div as tooltip is messing with data state property of toggle */}
<div>
<Switch
size="large"
checked={isSensitive}
disabled={isLoading || isSubmitting || !canUpdateComplianceConfig}
onCheckedChange={toggleIsSensitive}
/>
</div>
</TooltipTrigger>
{!canUpdateComplianceConfig && (
<TooltipContent side="bottom" className="w-64 text-center">
You need additional permissions to update the compliance configuration for
your project
</TooltipContent>
)}
</Tooltip>
)}
</div>
</CardContent>
</Card>
</PageSectionContent>
</PageSection>
)
}
Domain
Subdomains
Source
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free