@@ -41,7 +41,7 @@ interface ConnectionSettingsPageProps {
4141
4242function LoadingState ( ) {
4343 return (
44- < div className = "mx-auto max-w-4xl space-y-6 p-6 " >
44+ < div className = "mx-auto max-w-[1600px] space-y-6 p-4 sm:p-6 lg:p-8 " >
4545 < div className = "space-y-2" >
4646 < div className = "h-8 w-64 animate-pulse rounded bg-muted" />
4747 < div className = "h-4 w-96 animate-pulse rounded bg-muted" />
@@ -314,7 +314,6 @@ export default function ConnectionSettingsPage({
314314 const [ upgradeDialog , setUpgradeDialog ] = useState ( false ) ;
315315 const [ deleteDialog , setDeleteDialog ] = useState ( false ) ;
316316 const [ success , setSuccess ] = useState < string | null > ( null ) ;
317- const [ debugUsers , setDebugUsers ] = useState < string [ ] > ( [ ] ) ;
318317
319318 const resolvedParams = use ( params ) ;
320319 const connectionId = resolvedParams . id ;
@@ -331,43 +330,7 @@ export default function ConnectionSettingsPage({
331330 setTimeout ( ( ) => setSuccess ( null ) , 5000 ) ;
332331 } ;
333332
334- // Debug functionality
335- const cleanupUsersMutation =
336- trpc . dbConnections . cleanupOrphanedUsers . useMutation ( {
337- onSuccess : ( data ) => {
338- handleSuccess ( data . summary ) ;
339- // Refresh the user list after cleanup
340- handleListUsers ( ) ;
341- } ,
342- onError : ( error ) => {
343- console . error ( 'Failed to cleanup users:' , error ) ;
344- } ,
345- } ) ;
346-
347- const grantPermissionMutation =
348- trpc . dbConnections . grantReadAllStatsPermission . useMutation ( {
349- onSuccess : ( data ) => {
350- handleSuccess ( data . message ) ;
351- } ,
352- onError : ( error ) => {
353- console . error ( 'Failed to grant permission:' , error ) ;
354- } ,
355- } ) ;
356-
357- const handleListUsers = async ( ) => {
358- try {
359- const result = await utils . dbConnections . listDatabuddyUsers . fetch ( {
360- id : connectionId ,
361- } ) ;
362- setDebugUsers ( result . users ) ;
363- handleSuccess ( `Found ${ result . users . length } databuddy users` ) ;
364- } catch ( error ) {
365- console . error ( 'Failed to list users:' , error ) ;
366- }
367- } ;
368-
369333 const handleDeleteSuccess = ( ) => {
370- // Redirect to connections list after deletion
371334 window . location . href = '/observability/database' ;
372335 } ;
373336
@@ -377,7 +340,7 @@ export default function ConnectionSettingsPage({
377340
378341 if ( ! connection ) {
379342 return (
380- < div className = "mx-auto max-w-4xl p-6 " >
343+ < div className = "mx-auto max-w-[1600px] space-y-6 p-4 sm:p-6 lg:p-8 " >
381344 < Alert className = "border-red-200 bg-red-50 dark:border-red-800 dark:bg-red-950/20" >
382345 < WarningIcon className = "h-4 w-4 text-red-600" />
383346 < AlertDescription className = "text-red-800 dark:text-red-200" >
@@ -391,7 +354,7 @@ export default function ConnectionSettingsPage({
391354 const isAdmin = connection . permissionLevel === 'admin' ;
392355
393356 return (
394- < div className = "mx-auto max-w-4xl space-y-6 p-6 " >
357+ < div className = "mx-auto max-w-[1600px] space-y-6 p-4 sm:p-6 lg:p-8 " >
395358 { /* Header */ }
396359 < div className = "space-y-2" >
397360 < div className = "flex items-center gap-2" >
@@ -656,85 +619,6 @@ export default function ConnectionSettingsPage({
656619
657620 < Separator />
658621
659- { /* Debug Section - Only show for admin connections */ }
660- { isAdmin && (
661- < >
662- < Card >
663- < CardHeader >
664- < CardTitle className = "flex items-center gap-2" >
665- < GearIcon className = "h-5 w-5" />
666- Database User Management
667- </ CardTitle >
668- < CardDescription >
669- Debug and manage database users created by Databuddy
670- </ CardDescription >
671- </ CardHeader >
672- < CardContent className = "space-y-4" >
673- < div className = "flex gap-2" >
674- < Button onClick = { handleListUsers } size = "sm" variant = "outline" >
675- List Users
676- </ Button >
677- < Button
678- disabled = { cleanupUsersMutation . isPending }
679- onClick = { ( ) =>
680- cleanupUsersMutation . mutate ( { id : connectionId } )
681- }
682- size = "sm"
683- variant = "outline"
684- >
685- { cleanupUsersMutation . isPending
686- ? 'Cleaning...'
687- : 'Cleanup Orphaned Users' }
688- </ Button >
689- </ div >
690-
691- { debugUsers . length > 0 && (
692- < div className = "rounded border p-3" >
693- < h4 className = "mb-2 font-medium text-sm" >
694- Databuddy Users ({ debugUsers . length } )
695- </ h4 >
696- < div className = "space-y-2" >
697- { debugUsers . map ( ( username ) => (
698- < div
699- className = "flex items-center justify-between rounded border p-2 text-sm"
700- key = { username }
701- >
702- < div className = "flex items-center gap-2" >
703- < code className = "rounded bg-muted px-2 py-1 text-xs" >
704- { username }
705- </ code >
706- < Badge className = "text-xs" variant = "secondary" >
707- { username . includes ( 'admin' ) ? 'Admin' : 'Readonly' }
708- </ Badge >
709- </ div >
710- < Button
711- className = "text-xs"
712- disabled = { grantPermissionMutation . isPending }
713- onClick = { ( ) =>
714- grantPermissionMutation . mutate ( {
715- id : connectionId ,
716- username,
717- } )
718- }
719- size = "sm"
720- variant = "outline"
721- >
722- { grantPermissionMutation . isPending
723- ? 'Granting...'
724- : 'Grant pg_read_all_stats' }
725- </ Button >
726- </ div >
727- ) ) }
728- </ div >
729- </ div >
730- ) }
731- </ CardContent >
732- </ Card >
733-
734- < Separator />
735- </ >
736- ) }
737-
738622 { /* Danger Zone */ }
739623 < Card className = "border-red-200 dark:border-red-800" >
740624 < CardHeader >
0 commit comments