Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add UI for the Remote client plugin #22079

Merged
merged 49 commits into from
May 15, 2024
Merged
Changes from 1 commit
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
26f07a3
Stylesheet: Fix height of lineedits
ccordoba12 Mar 10, 2024
d7ae44a
Widgets: Add a way to create vertical browse dir/file config widgets
ccordoba12 Mar 11, 2024
763c40a
Widgets: Standardize icon size for icons in config pages
ccordoba12 Mar 11, 2024
97f839f
Widgets: Save options if not loaded from config in SpyderConfigPage
ccordoba12 Mar 12, 2024
6d391cf
Widgets: Add method to reset widgets tracked in SpyderConfigPage
ccordoba12 Mar 12, 2024
ffd5891
Widgets: Initialize pages by default when adding them in SidebarDialog
ccordoba12 Mar 14, 2024
50f4a17
Widgets: Allow to set a status icon in lineedits of SpyderConfigPage
ccordoba12 Mar 16, 2024
4c55d05
Remote client: Add UI to enter SSH credentials and monitor server status
ccordoba12 Mar 23, 2024
4c71352
API: Allow to save, get and remove options securely
ccordoba12 Mar 24, 2024
d5a596a
Widgets: Allow to save passwords in lineedits of SpyderConfigPage
ccordoba12 Mar 24, 2024
134e7ce
Remote client: Save password/passphrase securely in connection dialog
ccordoba12 Mar 24, 2024
3c60d04
Remote client: Change "Save connection" button state with new info
ccordoba12 Mar 25, 2024
e109aba
Remote client: Change some methods in ConnectionDialog to be private
ccordoba12 Mar 25, 2024
40fde8c
Remote client: Make host_id an attribute of BaseConnectionPage
ccordoba12 Mar 26, 2024
e6956d9
Widgets: Add method to hide pages to SidebarDialog
ccordoba12 Mar 26, 2024
46c6016
Remote client: Add remove/clear connection buttons to ConnectionDialog
ccordoba12 Mar 26, 2024
d57d4f6
Remote client: Add action to show connection dialog to the Tools menu
ccordoba12 Apr 10, 2024
5582c81
Remote client: Add missing info when saving server options
ccordoba12 Apr 10, 2024
d6298f1
Rename connection icons to give them more explicit names
ccordoba12 Apr 12, 2024
0497886
Remote client: Make Connect button in connection dialog start a server
ccordoba12 Apr 12, 2024
2765381
Remote client: Add docstrings to all methods of ConnectionDialog
ccordoba12 Apr 12, 2024
4b7da8e
Remote client: Allow to stop a server from the connection dialog
ccordoba12 Apr 13, 2024
612f9e0
Remote client: Show ConnectionInfo messages in ConnectionStatusWidget
ccordoba12 Apr 13, 2024
0228aef
Remote client: Make ConnectionDialog show current status when reopened
ccordoba12 Apr 13, 2024
c8ce814
Remote client: Report a successful connection when the server is started
ccordoba12 Apr 15, 2024
07755ca
Remote client: Add menu to start remote consoles to the Consoles menu
ccordoba12 Apr 16, 2024
445dc22
Remote client: Allow to start remote consoles from their respective menu
ccordoba12 Apr 20, 2024
39c108b
Remote client: Open tunnel to remote kernel in a worker
ccordoba12 Apr 21, 2024
8b4a9ce
Remote client: Fix showing error when it's not possible to open a tunnel
ccordoba12 Apr 22, 2024
08bad38
Remote client: Rename MissingInfoLabel to ValidationLabel
ccordoba12 Apr 22, 2024
6619dbc
Remote client: Check users can't create connections with a repeated name
ccordoba12 Apr 22, 2024
6a6952d
Remote client: Check provided address in ConnectionDialog is valid
ccordoba12 Apr 22, 2024
5e59906
Remote client: Rename items in ConnectionDialog if users change conne…
ccordoba12 Apr 22, 2024
a0d66a8
Remote client: Update remote consoles menu when connections are changed
ccordoba12 Apr 23, 2024
5e066ef
Remote client: Add intro label to ConnectionDialog's new connection page
ccordoba12 Apr 24, 2024
0cb48b3
Widgets: Allow validation of SpyderConfigPage lineedits in focus out
ccordoba12 Apr 25, 2024
4fb3657
Remote client: Validate connection name and address in focus out
ccordoba12 Apr 25, 2024
7b845be
Remote client: Shutdown remote kernel when closing its respective client
ccordoba12 Apr 30, 2024
cba80ed
Remote client: Close remote console clients when server is stopped
ccordoba12 Apr 30, 2024
95fdf8c
Remote client: Make interrupts work for remote kernels
ccordoba12 Apr 30, 2024
f98e35f
Remote client: Make restarts work for remote kernels
ccordoba12 May 1, 2024
66ae631
Remote client: Show error message when we can't start a remote kernel
ccordoba12 May 1, 2024
cb605a7
Remote client: Reconnect to remote kernels after they die
ccordoba12 May 7, 2024
b2c8d8a
IPython console: Fix reporting Spyder-kernels version error for exter…
ccordoba12 May 8, 2024
0425919
Remote client: Prevent to close consoles immediately after creation
ccordoba12 May 14, 2024
31d5ed0
Remote client: Rename consoles associated to a server when it's renamed
ccordoba12 May 14, 2024
72d0904
Fix style for buttons in our most important dialogs
ccordoba12 May 14, 2024
0f38c88
Testing: Fix test_old_kernel_version
ccordoba12 May 14, 2024
d07d9f4
Widgets: Fix saving options associated to lineedits in SpyderConfigPage
ccordoba12 May 15, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remote client: Validate connection name and address in focus out
- That way we'll give users immediate feedback about incorrect data in
those fields.
- Also, don't validate repeated name against the same server.
  • Loading branch information
ccordoba12 committed May 14, 2024
commit 4fb3657280dbd77253635e316fee054273e853ae
44 changes: 30 additions & 14 deletions spyder/plugins/remoteclient/widgets/connectiondialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
from spyder.widgets.sidebardialog import SidebarDialog


# =============================================================================
# ---- Constants
# =============================================================================
class ValidationReasons(TypedDict):
repeated_name: bool | None
missing_info: bool | None
Expand Down Expand Up @@ -183,27 +186,20 @@ def validate_page(self):
if not widget.textbox.text():
# Validate that the required fields are not empty
widget.status_action.setVisible(True)
widget.status_action.setToolTip("")
reasons["missing_info"] = True
elif widget == self._name_widgets[auth_method]:
# Validate the server name is different from the ones already
# introduced
widget.status_action.setVisible(False)
current_name = widget.textbox.text()

servers = self.get_option("servers", default={})
for server in servers:
names = [
self.get_option(f"{server}/{method}/name")
for method in get_class_values(AuthenticationMethod)
]
if current_name in names:
reasons["repeated_name"] = True
widget.status_action.setVisible(True)
if not self._validate_name(current_name):
reasons["repeated_name"] = True
widget.status_action.setVisible(True)
elif widget == self._address_widgets.get(auth_method):
# Validate address
widget.status_action.setVisible(False)
address = widget.textbox.text()

if not self._validate_address(address):
reasons["invalid_address"] = True
widget.status_action.setVisible(True)
Expand Down Expand Up @@ -312,7 +308,8 @@ def _create_common_elements(self, auth_method):
text=_("Name *"),
option=f"{self.host_id}/{auth_method}/name",
tip=_("Introduce a name to identify your connection"),
status_icon=ima.icon("error"),
validate_callback=self._validate_name,
validate_reason=_("This connection name is already taken"),
)

address = self.create_lineedit(
Expand All @@ -321,7 +318,8 @@ def _create_common_elements(self, auth_method):
tip=_(
"This is the IP address or domain name of your remote machine"
),
status_icon=ima.icon("error"),
validate_callback=self._validate_address,
validate_reason=_("The address is not a valid IP or domain name"),
)

port = self.create_spinbox(
Expand Down Expand Up @@ -522,6 +520,24 @@ def _create_configfile_subpage(self):

return configfile_widget

def _validate_name(self, name):
"""Check connection name is not taken by a previous connection."""
servers = self.get_option("servers", default={})
for server in servers:
# Don't check repeated name with the same server
if server == self.host_id:
continue

names = [
self.get_option(f"{server}/{method}/name")
for method in get_class_values(AuthenticationMethod)
]

if name in names:
return False

return True

def _validate_address(self, address):
"""Validate if address introduced by users is correct."""
# Regex pattern for a valid domain name (simplified version)
Expand Down Expand Up @@ -882,7 +898,7 @@ def _start_server(self):
# _save_connection_info generates a new id fo that page at the end).
host_id = page.host_id

if page.NEW_CONNECTION or self._button_save_connection.isEnabled():
if page.NEW_CONNECTION or page.is_modified:
# Save connection info if necessary
self._save_connection_info()

Expand Down