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

'Add SSH Key' Improvements #1802

Merged
merged 11 commits into from
Sep 26, 2023
Merged

'Add SSH Key' Improvements #1802

merged 11 commits into from
Sep 26, 2023

Conversation

bigtedde
Copy link
Collaborator

@bigtedde bigtedde commented Sep 2, 2023

Description

Issue described here: #1801

In addition to fixing the issue of adding keys to the dropdown right away, I tweaked the process for adding a key such that now when the user adds a new key, they receive a QMessageBox alert informing them and the SSH dialogue box closes. Previously, the SSH dialogue box would not close unless the user clicked 'cancel', which seems counterintuitive. Here is a demo of the changes:

ssh

Related Issue

#1801

Motivation and Context

Greater consistency and (hopefully) improved user experience.

How Has This Been Tested?

Locally

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • I have read the CONTRIBUTING guide.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing tests passed.

I provide my contribution under the terms of the license of this repository and I affirm the Developer Certificate of Origin.

@bigtedde
Copy link
Collaborator Author

bigtedde commented Sep 2, 2023

@m3nu @real-yfprojects What do you think of these changes? Is this a better experience for the user than the current behavior?

For now, the these changes break a couple tests. If we like the changes then I will be happy to refactor those tests accordingly.

@m3nu
Copy link
Contributor

m3nu commented Sep 2, 2023

Shouldn't it close after the key is added.

But yes, the SSH stuff can be a barrier for new users, so any improvement is welcome.

Still need to try this locally.

@bigtedde
Copy link
Collaborator Author

bigtedde commented Sep 5, 2023

Shouldn't it close after the key is added.

Yes, I believe it should. However, in the current implementation it does not

Still need to try this locally.

Please do - I'd appreciate hearing how to further improve it.

@real-yfprojects
Copy link
Collaborator

they receive a QMessageBox alert informing them

I don't think we need that since the button already states what is going to happen.

@bigtedde
Copy link
Collaborator Author

bigtedde commented Sep 6, 2023

I don't think we need that since the button already states what is going to happen.

Good point. Maybe only show a message if the key creation fails?

@real-yfprojects
Copy link
Collaborator

Sounds reasonable 👍

@bigtedde
Copy link
Collaborator Author

bigtedde commented Sep 7, 2023

@real-yfprojects I made those changes. Here is a demo of the latest changes below. What do you think? With your approval of the final design, I will refactor the tests 👍

ssh

@bigtedde bigtedde marked this pull request as ready for review September 11, 2023 22:00
@@ -11,6 +11,8 @@


class SSHAddWindow(SSHAddBase, SSHAddUI):
create_ssh_key_failure = QtCore.pyqtSignal(int)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
create_ssh_key_failure = QtCore.pyqtSignal(int)
failure = QtCore.pyqtSignal(int)

@@ -68,15 +70,16 @@ def generate_key(self):
self.sshproc.finished.connect(self.generate_key_result)
self.sshproc.start('ssh-keygen', ['-t', format, '-b', length, '-f', output_path, '-N', ''])

def generate_key_result(self, exitCode, exitStatus):
if exitCode == 0:
def generate_key_result(self, exit_code):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def generate_key_result(self, exit_code):
@pyqtSlot(int)
def generate_key_result(self, exit_code):

Not sure whether that is needed. But it might be since the finished signal can be emitted with two values.

@bigtedde
Copy link
Collaborator Author

@real-yfprojects @m3nu I included the changes for the signal, and added tests for a ssh key add success and failure. PR is ready for review 👍

@m3nu
Copy link
Contributor

m3nu commented Sep 26, 2023

Thanks, @bigtedde! Works as promised locally. 👏

@m3nu m3nu merged commit 15fa46f into borgbase:master Sep 26, 2023
11 checks passed
@bigtedde bigtedde deleted the ssh branch September 26, 2023 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants