@@ -51,6 +51,7 @@ class ConnectionPickerScreen(ModalScreen):
5151 BINDINGS = [
5252 Binding ("escape" , "cancel_or_close_filter" , "Cancel" ),
5353 Binding ("enter" , "select" , "Select" ),
54+ Binding ("asterisk" , "toggle_star" , "Star" , show = False ),
5455 Binding ("s" , "save" , "Save" , show = False ),
5556 Binding ("n" , "new_connection" , "New" , show = False ),
5657 Binding ("f" , "refresh" , "Refresh" , show = False ),
@@ -538,6 +539,45 @@ def action_save(self) -> None:
538539 self ._save_connection_and_refresh (config , option_id )
539540 return
540541
542+ def action_toggle_star (self ) -> None :
543+ if self ._current_tab == TAB_CLOUD :
544+ return
545+
546+ option = self ._get_highlighted_option ()
547+ if not option or option .disabled :
548+ return
549+
550+ option_id = str (option .id ) if option .id else ""
551+ if not option_id or is_docker_option_id (option_id ):
552+ return
553+
554+ config = find_connection_by_name (self .connections , option_id )
555+ if not config :
556+ return
557+
558+ from sqlit .domains .connections .app .credentials import CredentialsPersistError
559+
560+ was_favorite = config .favorite
561+ config .favorite = not was_favorite
562+ try :
563+ self ._app ().services .connection_store .save_all (self .connections )
564+ except CredentialsPersistError as exc :
565+ self .notify (str (exc ), severity = "error" )
566+ except Exception as exc :
567+ config .favorite = was_favorite
568+ self .notify (f"Failed to update favorite: { exc } " , severity = "error" )
569+ self ._update_list ()
570+ return
571+
572+ if not self ._app ().services .connection_store .is_persistent :
573+ self .notify ("Connections are not persisted in this session" , severity = "warning" )
574+
575+ if config .favorite :
576+ self .notify ("Connection starred" )
577+ else :
578+ self .notify ("Connection unstarred" )
579+ self ._update_list ()
580+
541581 def _save_cloud_selection (self ) -> None :
542582 tree_node = self ._get_highlighted_tree_node ()
543583 if not tree_node or not tree_node .data :
0 commit comments