import { useTranslation } from 'react-i18next' import { Alert, AlertDescription } from '@/components/ui/alert' import { Skeleton } from '@/components/ui/skeleton' import { useDatabaseNetwork } from '../../queries/databaseAccess' import { AllowedSourcesCard } from './AllowedSourcesCard' import { ReachabilityCard } from './ReachabilityCard' import { ScopeCard } from './ScopeCard' import { TlsCard } from './TlsCard' /** NetworkPanel is the database detail Network tab: reachability first, then the controls that change it. */ export function NetworkPanel({ databaseName }: { databaseName: string }) { const { t } = useTranslation('databaseAccess') const { data, isLoading, error } = useDatabaseNetwork(databaseName) // The server decides root on this database, policies included. const canEdit = data?.can_edit === true return (

{t('network.title')}

{t('network.description')}

{isLoading ? ( ) : error || !data ? ( {t('network.loadFailed', { error: error?.message ?? '' })} ) : ( <> {!canEdit ? (

{t('network.readOnlyNotice')}

) : null}
)}
) }