Thanks to visit codestin.com
Credit goes to github.com

Skip to content

refactor: Extract ssh logic from auth service #5670

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

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

BrunoQuaresma
Copy link
Collaborator

SSH can be a separated machine since it is not related to the authentication at all.

@BrunoQuaresma BrunoQuaresma requested a review from a team as a code owner January 11, 2023 13:36
@BrunoQuaresma BrunoQuaresma self-assigned this Jan 11, 2023
@BrunoQuaresma BrunoQuaresma requested review from code-asher and Kira-Pilot and removed request for a team January 11, 2023 13:36
confirmLoading={authState.matches(
"signedIn.ssh.loaded.regeneratingSSHKey",
)}
open={sshState.matches("confirmSSHKeyRegenerate")}
Copy link
Member

Choose a reason for hiding this comment

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

Sometimes we're making variables for sshState keys and sometimes we aren't - can we choose one and be consistent?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The matches function only return true or false. Unfortunately, xstate v4 does not have a way to bind a context type with a specific state so, sometimes, we have to check the state with match and pass the value in the context. Buuut, after these minor refactoring, I think we can remove some xstate machines and use just use fetch directly.

}),
notifySuccessSSHKeyRegenerated: () => {
displaySuccess(Language.successRegenerateSSHKey)
},
Copy link
Member

Choose a reason for hiding this comment

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

:D we love to see it

},
},
notLoaded: {
type: "final",
Copy link
Member

Choose a reason for hiding this comment

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

Thinking about our conversation about simplifying XState machines by having less granularity: instead of making a separate error, getSSHKeyError, can we instead look at sshState.matches("notLoaded")?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

In this case we store this because we want to display the error.

Copy link
Member

Choose a reason for hiding this comment

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

Oh, I didn't see the separate loading state - makes sense!

Copy link
Member

@Kira-Pilot Kira-Pilot left a comment

Choose a reason for hiding this comment

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

What a pleasant cleanup.

@BrunoQuaresma BrunoQuaresma enabled auto-merge (squash) January 11, 2023 17:00
@BrunoQuaresma BrunoQuaresma merged commit a5d39ad into main Jan 11, 2023
@BrunoQuaresma BrunoQuaresma deleted the bq/extract-ssh-from-auth-service branch January 11, 2023 17:04
@github-actions github-actions bot locked and limited conversation to collaborators Jan 11, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants