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: Display error message for title and shortname conflicts on localVCS #8523

Conversation

florian-glombik
Copy link
Contributor

@florian-glombik florian-glombik commented May 1, 2024

Checklist

General

Server

Client

  • I strictly followed the client coding and design guidelines.
  • I added multiple screenshots/screencasts of my UI changes.
  • I translated all newly inserted strings into English and German.

Motivation and Context

In a previous Artemis version (7.0.3 right now), it was possible that when an error occurred during creating/importing/deleting a programming exercise the respective folders for that programming exercise were not cleaned up.
This means that the short names that are related to the folder names stay blocked, however, there was no error message shown in this case, for the blocked short names.

Description

  • This PR adds adjusts the error message thrown from the server, so that the client displays an alert.
  • adds translations for error message on validation of programming exercise title and short title
  • adds a scroll to top when saving course details

Steps for Testing Locally

Prerequisites:

  • 1 Instructor
  1. Create a programming exercise with title and short name "blockedShortName"
  2. See that in local-vcs-repos and repos a folder coursePrefix + BLOCKEDSHORTNAME will be created
  3. Duplicate the folder from step 2 in local-vcs-repos and rename it to coursePrefix + BLOCKEDSHORTNAME1
  4. Try to import a programming exercise with the shortname coursePrefix + BLOCKEDSHORTNAME1 and see that an error message is displayed that explains that the shortname is already taken

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

Now using actual translations instead of hardcoded english messages
image

@florian-glombik florian-glombik added this to the 7.0.3 milestone May 1, 2024
@florian-glombik florian-glombik self-assigned this May 1, 2024
@github-actions github-actions bot added server Pull requests that update Java code. (Added Automatically!) client Pull requests that update TypeScript code. (Added Automatically!) labels May 1, 2024
@florian-glombik florian-glombik changed the title Programming exercises: Display error message for existing exercises von LocalVCS Programming exercises: Display error message for title and shortname conflicts on localVCS May 1, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 1, 2024
@florian-glombik florian-glombik marked this pull request as ready for review May 1, 2024 23:29
@florian-glombik florian-glombik requested a review from a team as a code owner May 1, 2024 23:29
Copy link

coderabbitai bot commented May 1, 2024

Walkthrough

This update introduces a new method for alert parameter construction in HttpStatusException, extends exception handling capabilities with new constructors in InternalServerErrorAlertException, refactors exception handling in the ProgrammingExerciseExportImportResource, and enhances user experience in the CourseUpdateComponent by adding a utility function for scrolling.

Changes

Files Change Summary
.../web/rest/errors/HttpStatusException.java
.../web/rest/errors/InternalServerErrorAlertException.java
Added methods for alert parameter construction and new constructors for handling internal server errors.
.../web/rest/programming/ProgrammingExerciseExportImportResource.java Refactored exception handling and updated variable declaration.
.../app/course/manage/course-update.component.ts Added import and usage of scrollToTopOfPage for improved navigation.

Possibly related issues


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.

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 a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @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: 5

Out of diff range and nitpick comments (2)
src/main/java/de/tum/in/www1/artemis/web/rest/errors/InternalServerErrorAlertException.java (1)

18-20: Review exception handling strategy.

Consider whether it's appropriate to handle all internal server errors with this new exception class. Depending on the application's error handling strategy, it might be beneficial to differentiate between different types of internal server errors.

src/main/java/de/tum/in/www1/artemis/web/rest/programming/ProgrammingExerciseExportImportResource.java (1)

Line range hint 241-264: Review error handling in importProgrammingExercise.

The method importProgrammingExercise uses a generic Exception catch block. Consider using more specific exception types to handle different scenarios more effectively. This will also help in providing more descriptive error messages to the client.

coderabbitai[bot]
coderabbitai bot previously approved these changes May 1, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
coderabbitai[bot]
coderabbitai bot previously approved these changes May 2, 2024
@florian-glombik
Copy link
Contributor Author

florian-glombik commented May 2, 2024

The failing server LocalVCIntegrationTest testUserTriesToDeleteBranch() test is flaky, the Cypress E2E tests are known failing E2E tests

Copy link
Contributor

@rstief rstief left a comment

Choose a reason for hiding this comment

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

Demonstrated in Testing Session, LGTM

Copy link
Contributor

@laurenzfb laurenzfb left a comment

Choose a reason for hiding this comment

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

demontrated in testing - code also lgtm

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.

code lgtm!

@krusche krusche merged commit f9b8df3 into develop May 3, 2024
23 of 28 checks passed
@krusche krusche deleted the bugfix/programming-exercises/display-alert-if-exercise-folder-exists-before-import branch May 3, 2024 10:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix client Pull requests that update TypeScript code. (Added Automatically!) component:Programming ready for review server Pull requests that update Java code. (Added Automatically!)
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

5 participants