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: Fix locking and error handling of new code editor for students #8365

Merged
merged 7 commits into from
Apr 11, 2024

Conversation

pzdr7
Copy link
Contributor

@pzdr7 pzdr7 commented Apr 10, 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.
  • I added multiple integration tests (Jest) related to the features (with a high test coverage), while following the test guidelines.
  • I added multiple screenshots/screencasts of my UI changes.

Changes affecting Programming Exercises

  • High priority: I tested all changes and their related features with all corresponding user types on a test server configured with the integrated lifecycle setup (LocalVC and LocalCI).
  • I tested all changes and their related features with all corresponding user types on a test server configured with Gitlab and Jenkins.

Motivation and Context

  • Sometimes, the new code editor would not be locked when it should be (e.g. when the repository was locked but no assessment was available)
  • It didn't notify its parent component of errors during the loading of files, which could lead to confusion for the user

While typical uses of the code editor didn't trigger this behavior, these exceptional cases should be covered.

Description

  • The code editor is now locked
    • When viewing a tutor assessment
    • When the repository is locked (it relies on the parent component for this information via disableActions)
    • When no file is selected or the selected file couldn't be loaded
  • There is now an error message when the loading of a file fails due to a connection error or another error

Steps for Testing

Prerequisites:

  • 1 Student
  • 1 Programming Exercise with the online code editor enabled. Its due date should be in a few minutes.
  1. Log in to Artemis as the student.
  2. Navigate to the programming exercise

Error handling

  1. Open the code editor but don't select any files yet
  2. Go offline (e.g. by going to the developer tools > network > Throttling: offline in Chrome)
  3. Select a file and verify that (aside from the standard "server not reachable" message), you get a message about the file not being loaded.
  4. Verify that you cannot edit the (empty) file.
  5. Go back online and select a different file (or refresh your files). Ensure the file loads and is editable.
  6. Go back to the file that didn't load. Ensure the file loads and is editable.
  7. Make a submission.

Readonly when the repository is locked

  1. Leave the page and wait for the due date to pass.
  2. Once the due date has passed, open the code editor again. You should see an indicator about the repository being locked.
  3. Verify that the code editor is in readonly mode.

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

Test Coverage

Client

Class/File Line Coverage Confirmation (assert/expect)
code-editor-monaco.component.ts 92.63%

Screenshots

grafik

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Apr 10, 2024
@pzdr7 pzdr7 marked this pull request as ready for review April 10, 2024 13:36
@pzdr7 pzdr7 requested a review from a team as a code owner April 10, 2024 13:36
Copy link

coderabbitai bot commented Apr 10, 2024

Walkthrough

The modifications in the code editor components focus on enhancing functionality and error handling. Key changes include disabling actions based on the editable flag, introducing a new variable editorLocked for read-only conditions, and improving error handling mechanisms by adding an onError event.

Changes

File Path Change Summary
.../code-editor-container.component.html Added attributes to disable actions and handle errors based on editable flag.
.../code-editor/monaco/code-editor-monaco.component.html Replaced commitState with editorLocked to control read-only state.
.../code-editor/monaco/code-editor-monaco.component.ts Enhanced error handling, added editorLocked and disableActions, updated file selection logic.
.../spec/component/code-editor-monaco.component.spec.ts Updated tests to reflect new functionality and error handling in the Monaco editor component.

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.

@pzdr7 pzdr7 temporarily deployed to artemis-test2.artemis.cit.tum.de April 10, 2024 14:23 — with GitHub Actions Inactive
@pzdr7 pzdr7 temporarily deployed to artemis-test6.artemis.cit.tum.de April 10, 2024 14:34 — with GitHub Actions Inactive
@pzdr7 pzdr7 changed the title Programming exercises: Fix locking and error handling of code editor in student view Programming exercises: Fix locking and error handling of new code editor for students Apr 10, 2024
@pzdr7 pzdr7 added this to the 7.0.0 milestone Apr 10, 2024
@coolchock coolchock temporarily deployed to artemis-test3.artemis.cit.tum.de April 10, 2024 22:26 — with GitHub Actions Inactive
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.

tested on ts3, works as described. Code LGTM

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, code also LGTM

Copy link
Contributor

@undernagruzez undernagruzez 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 a testing session, lgtm

Copy link
Contributor

@muradium muradium 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, works as expected

@krusche krusche merged commit 9dde57d into develop Apr 11, 2024
42 of 48 checks passed
@krusche krusche deleted the bugfix/programming-exercises/monaco-editor-locking branch April 11, 2024 15:27
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.

None yet

7 participants