@@ -610,144 +610,6 @@ def _build_sqlite_rows(self, metadata: dict) -> list[list[ft.Control]]:
610610 return rows
611611
612612
613- # =============================================================================
614- # Connections Tab
615- # =============================================================================
616-
617-
618- class ConnectionsTab (ft .Container ):
619- """Connections tab showing database pool and Redis connection info."""
620-
621- def __init__ (
622- self ,
623- database_component : ComponentStatus ,
624- redis_component : ComponentStatus | None ,
625- page : ft .Page ,
626- ) -> None :
627- super ().__init__ ()
628- self .page = page
629- db_metadata = database_component .metadata or {}
630- implementation = db_metadata .get ("implementation" , "sqlite" )
631-
632- sections : list [ft .Control ] = []
633-
634- # Database connection pool section
635- db_rows = self ._build_db_connection_rows (db_metadata , implementation )
636- if db_rows :
637- db_table = DataTable (
638- columns = [
639- DataTableColumn ("Property" ),
640- DataTableColumn ("Value" , width = 200 ),
641- ],
642- rows = db_rows ,
643- row_padding = 6 ,
644- empty_message = "No connection info available" ,
645- )
646- sections .append (self ._create_section ("Database Pool" , db_table ))
647-
648- # Redis section
649- if redis_component :
650- redis_rows = self ._build_redis_rows (redis_component )
651- if redis_rows :
652- redis_table = DataTable (
653- columns = [
654- DataTableColumn ("Property" ),
655- DataTableColumn ("Value" , width = 200 ),
656- ],
657- rows = redis_rows ,
658- row_padding = 6 ,
659- empty_message = "No Redis info available" ,
660- )
661- sections .append (ft .Container (height = Theme .Spacing .LG ))
662- sections .append (self ._create_section ("Redis" , redis_table ))
663-
664- self .content = ft .Column (sections , scroll = ft .ScrollMode .AUTO )
665- self .padding = ft .padding .all (Theme .Spacing .MD )
666- self .expand = True
667-
668- def _create_section (self , title : str , content : ft .Control ) -> ft .Column :
669- """Create a labeled section."""
670- return ft .Column (
671- [
672- ft .Text (title , size = 14 , weight = ft .FontWeight .W_500 ),
673- ft .Container (height = Theme .Spacing .SM ),
674- content ,
675- ],
676- spacing = 0 ,
677- )
678-
679- def _build_db_connection_rows (
680- self , metadata : dict , implementation : str
681- ) -> list [list [ft .Control ]]:
682- """Build rows for database connection info."""
683- rows : list [list [ft .Control ]] = []
684-
685- pool_size = metadata .get ("connection_pool_size" , 0 )
686- rows .append ([TableNameText ("Pool Size" ), TableCellText (str (pool_size ))])
687-
688- if implementation == "postgresql" :
689- pg_settings = metadata .get ("pg_settings" , {})
690- active = metadata .get ("active_connections" , 0 )
691- max_conn = pg_settings .get ("max_connections" , "Unknown" )
692-
693- rows .append (
694- [TableNameText ("Active Connections" ), TableCellText (str (active ))]
695- )
696- rows .append (
697- [TableNameText ("Max Connections" ), TableCellText (str (max_conn ))]
698- )
699-
700- return rows
701-
702- def _build_redis_rows (
703- self , redis_component : ComponentStatus
704- ) -> list [list [ft .Control ]]:
705- """Build rows for Redis connection info."""
706- rows : list [list [ft .Control ]] = []
707- metadata = redis_component .metadata or {}
708-
709- # Connection info
710- host = metadata .get ("host" , "localhost" )
711- port = metadata .get ("port" , 6379 )
712- rows .append ([TableNameText ("Host" ), TableCellText (f"{ host } :{ port } " )])
713-
714- # Version
715- version = metadata .get ("version" , "Unknown" )
716- if version != "Unknown" :
717- rows .append ([TableNameText ("Version" ), TableCellText (version )])
718-
719- # Memory
720- used_memory = metadata .get ("used_memory_human" , metadata .get ("used_memory" ))
721- if used_memory :
722- rows .append ([TableNameText ("Used Memory" ), TableCellText (str (used_memory ))])
723-
724- max_memory = metadata .get ("maxmemory_human" , metadata .get ("maxmemory" ))
725- if max_memory and max_memory != "0" :
726- rows .append ([TableNameText ("Max Memory" ), TableCellText (str (max_memory ))])
727-
728- # Clients
729- connected_clients = metadata .get ("connected_clients" )
730- if connected_clients is not None :
731- rows .append (
732- [
733- TableNameText ("Connected Clients" ),
734- TableCellText (str (connected_clients )),
735- ]
736- )
737-
738- # Keys
739- total_keys = metadata .get ("total_keys" , metadata .get ("db0" , {}).get ("keys" ))
740- if total_keys is not None :
741- rows .append ([TableNameText ("Total Keys" ), TableCellText (f"{ total_keys :,} " )])
742-
743- # Uptime
744- uptime_days = metadata .get ("uptime_in_days" )
745- if uptime_days is not None :
746- rows .append ([TableNameText ("Uptime" ), TableCellText (f"{ uptime_days } days" )])
747-
748- return rows
749-
750-
751613# =============================================================================
752614# Main Dialog
753615# =============================================================================
@@ -760,7 +622,6 @@ def __init__(
760622 self ,
761623 database_component : ComponentStatus ,
762624 page : ft .Page ,
763- redis_component : ComponentStatus | None = None ,
764625 ) -> None :
765626 metadata = database_component .metadata or {}
766627 implementation = metadata .get ("implementation" , "sqlite" )
@@ -788,10 +649,6 @@ def __init__(
788649 ft .Tab (
789650 text = "Migrations" , content = MigrationsTab (database_component , page )
790651 ),
791- ft .Tab (
792- text = "Connections" ,
793- content = ConnectionsTab (database_component , redis_component , page ),
794- ),
795652 ft .Tab (text = "Settings" , content = SettingsTab (database_component , page )),
796653 ],
797654 expand = True ,
0 commit comments