@@ -797,79 +797,6 @@ def _update_visual_selection(self: ConnectionMixinHost) -> None:
797797
798798 self ._update_footer_bindings ()
799799
800- def action_toggle_connection_favorite (self : ConnectionMixinHost ) -> None :
801- from sqlit .domains .connections .app .credentials import CredentialsPersistError
802- from sqlit .shared .ui .screens .error import ErrorScreen
803-
804- selected = self ._get_selected_connection_configs ()
805- if selected :
806- previous = {c .name : c .favorite for c in selected }
807- set_favorite = not all (c .favorite for c in selected )
808- for conn in selected :
809- conn .favorite = set_favorite
810- credentials_error : CredentialsPersistError | None = None
811-
812- try :
813- self .services .connection_store .save_all (self .connections )
814- except CredentialsPersistError as exc :
815- credentials_error = exc
816- except Exception as exc :
817- for conn in selected :
818- conn .favorite = previous .get (conn .name , conn .favorite )
819- self .notify (f"Failed to update favorite: { exc } " , severity = "error" )
820- return
821-
822- if not self .services .connection_store .is_persistent :
823- self .notify ("Connections are not persisted in this session" , severity = "warning" )
824-
825- self ._get_selected_connection_names ().clear ()
826- setattr (self , "_tree_visual_mode_anchor" , None )
827- self ._refresh_connection_tree ()
828- action_label = "starred" if set_favorite else "unstarred"
829- if len (selected ) == 1 :
830- self .notify (f"Connection { action_label } " )
831- else :
832- self .notify (f"{ len (selected )} connections { action_label } " )
833- if credentials_error :
834- self .push_screen (ErrorScreen ("Keyring Error" , str (credentials_error )))
835- return
836-
837- node = self .object_tree .cursor_node
838- if not node :
839- return
840-
841- config = self ._get_connection_config_from_node (node )
842- if not config :
843- return
844-
845- if not any (c .name == config .name for c in self .connections ):
846- self .notify ("Only saved connections can be starred" , severity = "warning" )
847- return
848-
849- previous = config .favorite
850- config .favorite = not previous
851- credentials_error : CredentialsPersistError | None = None
852-
853- try :
854- self .services .connection_store .save_all (self .connections )
855- except CredentialsPersistError as exc :
856- credentials_error = exc
857- except Exception as exc :
858- config .favorite = previous
859- self .notify (f"Failed to update favorite: { exc } " , severity = "error" )
860- return
861-
862- if not self .services .connection_store .is_persistent :
863- self .notify ("Connections are not persisted in this session" , severity = "warning" )
864-
865- self ._refresh_connection_tree ()
866- if config .favorite :
867- self .notify ("Connection starred" )
868- else :
869- self .notify ("Connection unstarred" )
870- if credentials_error :
871- self .push_screen (ErrorScreen ("Keyring Error" , str (credentials_error )))
872-
873800 def action_move_connection_to_folder (self : ConnectionMixinHost ) -> None :
874801 from sqlit .domains .connections .app .credentials import CredentialsPersistError
875802 from sqlit .domains .connections .domain .config import normalize_folder_path
0 commit comments