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

Programming exercises: Add clone in IDE buttons #8735

Merged
merged 23 commits into from
Jun 24, 2024

Conversation

Strohgelaender
Copy link
Contributor

@Strohgelaender Strohgelaender commented Jun 4, 2024

Checklist

General

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.
  • Following the theming guidelines, I specified colors only in the theming variable files and checked that the changes look consistent in both the light and the dark theme.
  • 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

We want to provide students a direct way of cloning their repositories in IntelliJ instead of manuall copying the links.

Description

This adds a new "Clone in IntelliJ" button for programming exercises. This uses the JetBrains toolbox.
Thanks to @janthoXO for making me aware of this.

Steps for Testing

Prerequisites:

  • 2 Student
  • 1 Java Programming Exercise
  1. Start the exercise (if not already done) by clicking on "Start Exercise"
  2. Click on "Clone Repository" and see the new "Clone in IntelliJ" button
  3. Click the Button and see that it works. (Note: This needs IntelliJ to be installed via the Jetbrains Toolbox)

Exam Mode Testing

same but for an exam exercise

Testserver States

Note

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






Review Progress

Performance Review

  • I (as a reviewer) confirm that the client changes (in particular related to REST calls and UI responsiveness) are implemented with a very good performance

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Screenshots

image

Summary by CodeRabbit

  • New Features

    • Added a button for cloning IntelliJ projects specifically for Java and Kotlin exercises.
    • Introduced a help icon for IntelliJ cloning in the clone repository button.
  • Improvements

    • Enhanced German and English localization files with new options for cloning repositories directly in IntelliJ.

@Strohgelaender Strohgelaender requested a review from janthoXO June 4, 2024 12:17
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Jun 4, 2024
@Strohgelaender Strohgelaender marked this pull request as ready for review June 4, 2024 13:05
@Strohgelaender Strohgelaender requested a review from a team as a code owner June 4, 2024 13:05
Copy link

coderabbitai bot commented Jun 4, 2024

Walkthrough

The updates introduce a new ExternalCloningService to replace the SourceTreeService, allowing users to clone repositories directly into IntelliJ for Java and Kotlin exercises. This involves modifying service dependencies, updating HTML templates to include IntelliJ-specific buttons, and adding localization support for these new features.

Changes

File Path Summary of Changes
src/main/webapp/app/exercises/programming/shared/service/external-cloning.service.ts Introduced ExternalCloningService with methods to build URLs for source tree and IntelliJ cloning.
src/main/webapp/app/overview/exercise-details/exercise-details-student-actions.component.ts Replaced SourceTreeService with ExternalCloningService in ExerciseDetailsStudentActionsComponent.
src/main/webapp/app/shared/components/clone-repo-button/clone-repo-button.component.html Added conditional blocks for IntelliJ cloning buttons and refactored existing button structure.
src/main/webapp/i18n/de/exercise-actions.json, src/main/webapp/i18n/en/exercise-actions.json Added localization entries for IntelliJ cloning actions.
src/test/javascript/spec/service/external-cloning.service.spec.ts Added unit tests for ExternalCloningService methods.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CloneRepoButtonComponent
    participant ExternalCloningService
    participant IntelliJIDE

    User->>CloneRepoButtonComponent: Clicks IntelliJ Clone Button
    CloneRepoButtonComponent->>ExternalCloningService: buildJetbrainsUrl(cloneUrl, language)
    ExternalCloningService-->>CloneRepoButtonComponent: Returns IntelliJ URL
    CloneRepoButtonComponent-->>User: Redirects to IntelliJ URL
    User->>IntelliJIDE: Clones Repository
Loading

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.

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: 1

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

@janthoXO janthoXO left a comment

Choose a reason for hiding this comment

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

The button only works if the user has provided a ssh key. Meaning IntelliJ always tries to clone with ssh regardless if ssh or HTTP is toggled.
It would be good if the toggle between HTTP and ssh would also apply to the "open in IntelliJ" button

…repo-button.component.ts

Co-authored-by: Johannes Stöhr <38322605+JohannesStoehr@users.noreply.github.com>
coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 4, 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: 2

src/main/webapp/i18n/en/exercise-actions.json Outdated Show resolved Hide resolved
src/main/webapp/i18n/de/exercise-actions.json Outdated Show resolved Hide resolved
@janthoXO
Copy link
Contributor

janthoXO commented Jun 5, 2024

The button only works if the user has provided a ssh key. Meaning IntelliJ always tries to clone with ssh regardless if ssh or HTTP is toggled. It would be good if the toggle between HTTP and ssh would also apply to the "open in IntelliJ" button

I tested it again and that might not be the case. I think the error I got was not related to ssh. Im gonna retest it again, but for now ignore this change request

@janthoXO janthoXO dismissed their stale review June 5, 2024 08:30

needs retesting, might not be valid

Copy link
Member

@Hialus Hialus left a comment

Choose a reason for hiding this comment

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

This is optional, but if we add more and more buttons here it might make sense to also add icons in addition or as a replacement to the text. For IntelliJ this is not a problem, as long as we add a copyright notice somewhere. See the Jetbrains branding guidelines for infos and the logos.

Otherwise this is a very welcome addition 🚀

coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 5, 2024
@Strohgelaender Strohgelaender changed the title Programming exercises: Add clone in IntelliJ button Programming exercises: Add clone in IDE buttons Jun 23, 2024
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.

Tested in testing session on ts2. LGTM

Copy link
Contributor

@coolchock coolchock left a comment

Choose a reason for hiding this comment

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

works on mac 👍

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 with VS code, works as expected.
(Couldn't test Intellij since I don't have Toolbox)

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.

Tested during testing session on TS2. Works as described . Code looks good 👍

Clone via VSCode Button ✅
Clone via IntelliJ Button (installed via Jetbrains Toolbox) ✅

OS: Mac OS

Copy link
Contributor

@sarpsahinalp sarpsahinalp 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 ts3. Within an exam I was able to clone the exercise in Intellij and VSCode

@krusche krusche merged commit 30725cd into develop Jun 24, 2024
36 of 48 checks passed
@krusche krusche deleted the feature/programming/clone-in-intellij branch June 24, 2024 19:31
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 to merge tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.