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: Allow instructors to edit programming exercises in the new code editor #8389

Merged
merged 14 commits into from
Apr 22, 2024

Conversation

pzdr7
Copy link
Contributor

@pzdr7 pzdr7 commented Apr 12, 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 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

The Monaco editor, which was introduced in PR #8130, is currently only available to students in two views. This PR contributes to our gradual removal of Ace from the Artemis client.

Description

  • Monaco editor for instructors: Uses Monaco in the "Edit in Editor" view, which allows instructors to edit the template, solution, assignment, and test repositories.
  • Earlier initialization of the monaco editor: The MonacoEditorComponent now initializes its editor in the constructor (rather than ngOnInit) by injecting its container into the DOM using Renderer2. This ensures that the _editor instance is always available when methods of the component are called and avoids having.

Known issues:

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Programming exercise
  1. Log in to Artemis
  2. Navigate to Course management > Your course > Exercises
  3. Click "Edit in Editor" for your programming exercise
  4. Verify that you can switch between & edit each repository: Template, Solution, Tests, and Assignment (create if necessary).
  5. Ensure that your changes are saved.

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.7%
monaco-editor.component.ts 97.4%

Screenshots

grafik

Summary by CodeRabbit

  • New Features

    • Integrated Monaco Editor for enhanced code editing experience in programming exercises.
  • Bug Fixes

    • Improved editor reset functionality to ensure consistent behavior when reverting changes.
  • Refactor

    • Optimized the initialization and rendering process of the Monaco Editor to improve performance and user interaction.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Apr 12, 2024
@pzdr7 pzdr7 changed the title Programming exercises: Allow editing programming exercises in the Monaco editor Programming exercises: Allow instructors to edit programming exercises in the Monaco editor Apr 12, 2024
@github-actions github-actions bot added deployment-error Added by deployment workflows if an error occured and removed deploy:artemis-test3 labels Apr 12, 2024
@pzdr7 pzdr7 removed the deployment-error Added by deployment workflows if an error occured label Apr 12, 2024
@pzdr7 pzdr7 marked this pull request as ready for review April 14, 2024 09:27
@pzdr7 pzdr7 requested a review from a team as a code owner April 14, 2024 09:27
Copy link

coderabbitai bot commented Apr 14, 2024

Walkthrough

This update integrates the Monaco Editor across various components in an Angular application, enhancing the code editor's functionality with conditions for resetting and refreshing the editor, and simplifying the editor's instantiation and configuration.

Changes

Files Change Summary
.../code-editor-instructor-and-editor-container.component.html Added attribute to enable Monaco Editor.
.../code-editor/monaco/code-editor-monaco.component.ts Added condition for resetting the editor based on commitState.
.../shared/monaco-editor/monaco-editor.component.ts Major refactor including immediate editor creation, simplified readOnly setting, and layout adjustments.
.../integration/code-editor/code-editor-instructor.integration.spec.ts Updated integration tests to support Monaco Editor components.

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
Contributor

@mateusmm01 mateusmm01 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 ts5. Works as expected

Copy link
Contributor

@Jan-Thurner Jan-Thurner 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

coolchock
coolchock previously approved these changes Apr 16, 2024
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 ts4, works as expected

@coolchock coolchock dismissed their stale review April 17, 2024 07:06

re-test necessary

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.

re-tested on ts2, works as expected 👍

@pzdr7 pzdr7 changed the title Programming exercises: Allow instructors to edit programming exercises in the Monaco editor Programming exercises: Allow instructors to edit programming exercises in the new code editor Apr 21, 2024
@krusche krusche added this to the 7.0.2 milestone Apr 22, 2024
@krusche krusche merged commit c9843f7 into develop Apr 22, 2024
23 of 28 checks passed
@krusche krusche deleted the feature/programming-exercises/monaco-instructors branch April 22, 2024 19:24
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

6 participants