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

Integrated code lifecycle: Improve SSH handling #8772

Merged
merged 23 commits into from
Jun 27, 2024

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Jun 10, 2024

Checklist

General

Server

  • Important: I implemented the changes with a very good performance and prevented too many (unnecessary) database calls.
  • I strictly followed the server coding and design guidelines.
  • I added pre-authorization annotations according to the guidelines and checked the course groups for all new REST Calls (security).
  • I documented the Java code using JavaDoc style.

Client

  • Important: I implemented the changes with a very good performance, prevented too many (unnecessary) REST calls and made sure the UI is responsive, even with large data.
  • I strictly followed the client coding and design guidelines.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added authorities to all new routes and checked the course groups for displaying navigation elements (links, buttons).
  • I documented the TypeScript code using JSDoc style.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

Users should use SSH to clone from localVC for programming exercise repositories.

Description

  • Added settings subpage to add, edit and remove the users SSH key
  • Added link in the copy clone link UI to the SSH key settings
  • Added documentation about SSH for new users

Link to SSH settings in the clone dialogue:
image
SSH settings page: - creating a new key
image
save the key:
image
edit or delete the key:
image

Steps for Testing

Prerequisites:

  1. Log in to Artemis as a student, go to Settings
  2. Test if you can add, edit and remove your SSH key, in the SSH Settings tab.
  3. Go to a programming exercise, copy the clone link, and check if you can clone the exercise with the key you set in the settings.

Testserver States

Note

These badges show the state of the test servers.
Green = Currently available, Red = Currently locked






Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

Summary by CodeRabbit

  • New Features

    • Added functionality to manage SSH public keys within user settings, including viewing, editing, and deleting keys.
    • Introduced new constants and configuration for GitLab version control support.
  • Bug Fixes

    • Updated conditions in the clone repository button component to correctly display warnings related to SSH key usage.
  • Documentation

    • Added new links for SSH setup in both English and German documentation.
  • Tests

    • Introduced tests for the SSH User Settings component, ensuring proper initialization, key saving, and edit mode toggling.

@SimonEntholzer SimonEntholzer requested a review from a team as a code owner June 10, 2024 06:04
Copy link

coderabbitai bot commented Jun 10, 2024

Walkthrough

Recent modifications enhance the application by introducing SSH key management features, such as adding, viewing, editing, and deleting SSH keys. Key additions include new methods in backend services, updates to the Angular frontend components, and relevant localization entries. These changes improve user management and security in repository interactions, especially for users utilizing GitLab version control.

Changes

Files Change Summary
UserResource.java Added a deleteSshPublicKey method to manage SSH keys for users.
app.constants.ts Introduced a new constant PROFILE_GITLAB.
account.service.ts Introduced a method deleteSshPublicKey to manage user SSH keys.
clone-repo-button.component.html, clone-repo-button.component.ts Updated conditions for SSH key usage warnings and set setupSshKeysUrl based on specific conditions.
documentation-button.component.ts Added SshSetup link in DocumentationLinks object.
ssh-user-settings.component.html, ssh-user-settings.component.ts Provided UI and component for managing SSH keys, including viewing, editing, saving, and deleting.
user-settings.module.ts Included SshUserSettingsComponent and necessary imports into UserSettingsModule.
de/documentationLinks.json, de/userSettings.json, en/documentationLinks.json, en/userSettings.json Added SSH setup documentation links and SSH settings content in both English and German.
ssh-user-settings.component.spec.ts Introduced tests for SshUserSettingsComponent, covering initialization and SSH key management functionalities.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant UserResource
    participant AccountService
    participant AngularComponent

    User->>AngularComponent: Interact with SSH Key Management UI
    AngularComponent->>AccountService: deleteSshPublicKey()
    AccountService->>UserResource: DELETE /api/users/sshpublickey
    UserResource->>AccountService: Confirm Deletion
    AccountService->>AngularComponent: Update UI
    AngularComponent->>User: Display updated SSH Key status
Loading

In this sequence diagram, a user interacts with the Angular component for SSH key management. The component calls the deleteSshPublicKey method in AccountService, which then performs a DELETE request to UserResource. Upon confirmation, the service updates the UI to reflect the changes, and the user can see the updated SSH key status.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@github-actions github-actions bot added tests server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels Jun 10, 2024
@SimonEntholzer SimonEntholzer changed the title ssh usability improvements Integrated code lifecycle: SSH usability improvements Jun 10, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 9

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 7

Outside diff range comments (1)
src/test/javascript/spec/component/account/account-information.component.spec.ts (1)

Line range hint 48-51: Disallow duplicate setup and teardown hooks.

The beforeEach block is duplicated inside the describe function. Consider combining them into a single beforeEach block to avoid redundancy and potential confusion during test execution.

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

Tested on TS2:

  • Can edit and delete ssh key
  • warning is visible and link redirects me to the settings

Should the warning still be visible even if the user has set an ssh key?
And I am not sure if this is related to your PR but I get a 500 error when I access any course
image
image

@Strohgelaender
Copy link
Contributor

Should the warning still be visible even if the user has set an ssh key?

Imo it would be better if the warning would disapear now, see also #6650. Before we were not able to know if the user has a ssh key setup, now we can test for that and should hide the message.

@SimonEntholzer
Copy link
Contributor Author

Should the warning still be visible even if the user has set an ssh key?

Imo it would be better if the warning would disapear now, see also #6650. Before we were not able to know if the user has a ssh key setup, now we can test for that and should hide the message.

Good point, I changed it so that the warning goes away when there is a SSH key available. 👍

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 11, 2024
Copy link
Contributor

@kaancayli kaancayli left a comment

Choose a reason for hiding this comment

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

Reapprove

Copy link
Contributor

@EneaGore EneaGore left a comment

Choose a reason for hiding this comment

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

re-approve

Copy link
Member

@BBesrour BBesrour left a comment

Choose a reason for hiding this comment

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

re-approve

Copy link
Contributor

@DominikRemo DominikRemo left a comment

Choose a reason for hiding this comment

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

Reapprove

Copy link
Contributor

@Strohgelaender Strohgelaender left a comment

Choose a reason for hiding this comment

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

code

@krusche krusche changed the title Integrated code lifecycle: SSH usability improvements Integrated code lifecycle: Improve SSH handling Jun 27, 2024
@krusche krusche added this to the 7.3.1 milestone Jun 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
client Pull requests that update TypeScript code. (Added Automatically!) ready for review server Pull requests that update Java code. (Added Automatically!) tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.