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

Adaptive learning: Improve layout of competency relation graph #8443

Conversation

rstief
Copy link
Contributor

@rstief rstief commented Apr 19, 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

The relation graph had some shortcomings that were fixed in this PR.

Description

  • Removed the long overdue BETA label from the relation graph
  • Improved layout of create relation form
  • Added zoom function & center button
  • Added a minimap
  • Added a delete confirmation for relations (before they would just be deleted by clicking on them)

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Log in to Artemis
  2. Navigate to Course Management -> Competencies
  3. Create competencies if none exist
  4. See that the relation graph now supports zooming
  5. Create relations if none exist
  6. Delete a relation (click on its text)
  7. See that a confirmation dialog shows up

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)
competency-management.component.ts 92.56%
competency-relation-graph.component.ts 93.39%

Screenshots

image

Summary by CodeRabbit

  • New Features
    • Enhanced the competency management interface with better event handling and a new button to center the competency relation graph view.
    • Added a mini-map feature to the competency relation graph for improved navigation.
  • Enhancements
    • Updated the layout and interactive elements of the competency relation graph.
  • Internationalization
    • Introduced new localization keys for deletion confirmation in German and English.
  • Bug Fixes
    • Improved the removal process of competency relations with added confirmation steps.
  • Tests
    • Extended test coverage for competency management functionalities, including graph centering and relation removal.

@rstief rstief requested a review from a team as a code owner April 19, 2024 13:47
Copy link

coderabbitai bot commented Apr 19, 2024

Walkthrough

This update enhances the competency management features in a web application, focusing on user interaction improvements such as better event handling, modal confirmations for deletions, and a more intuitive UI for the competency relation graph. It also includes localization updates and corresponding unit tests to ensure functionality.

Changes

Files Changes
.../competency-management.component.html
.../competency-management.component.ts
Updated event bindings; added imports and methods for handling relation removals.
.../competency-relation-graph.component.html
.../competency-relation-graph.component.ts
Enhanced UI elements and graph functionality; added methods for centering and zooming the graph view.
.../i18n/de/competency.json
.../i18n/en/competency.json
Added localization keys for deletion confirmation modals.
.../spec/.../competency-management.component.spec.ts
.../spec/.../competency-relation-graph.component.spec.ts
Added tests for new functionalities and UI behaviors in competency management components.

Possibly related issues


Recent Review Details

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 520cd65 and 8a69e15.
Files selected for processing (8)
  • src/main/webapp/app/course/competencies/competency-management/competency-management.component.html (1 hunks)
  • src/main/webapp/app/course/competencies/competency-management/competency-management.component.ts (3 hunks)
  • src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.html (2 hunks)
  • src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.ts (3 hunks)
  • src/main/webapp/i18n/de/competency.json (1 hunks)
  • src/main/webapp/i18n/en/competency.json (1 hunks)
  • src/test/javascript/spec/component/competencies/competency-management/competency-management.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/competencies/competency-management/competency-relation-graph.component.spec.ts (1 hunks)
Additional Context Used
Path-based Instructions (6)
src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/test/javascript/spec/component/competencies/competency-management/competency-relation-graph.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

src/main/webapp/app/course/competencies/competency-management/competency-management.component.html (1)

Pattern src/main/webapp/**/*.html: @if and @for are new and valid Angular syntax replacing *ngIf and *ngFor. They should always be used over the old style.

src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/main/webapp/app/course/competencies/competency-management/competency-management.component.ts (1)

Pattern src/main/webapp/**/*.ts: angular_style:https://angular.io/guide/styleguide;methods_in_html:false;lazy_loading:true;code_reuse:true;tests:meaningful;types:PascalCase;enums:PascalCase;funcs:camelCase;props:camelCase;no_priv_prefix:true;strings:single_quotes;localize:true;btns:functionality;links:navigation;icons_text:newline;labels:associate;code_style:arrow_funcs,curly_braces,open_braces_same_line,indent_4;memory_leak_prevention:true;routes:naming_schema;chart_framework:ngx-charts;responsive_layout:true

src/test/javascript/spec/component/competencies/competency-management/competency-management.component.spec.ts (1)

Pattern src/test/javascript/spec/**/*.ts: jest: true; mock: NgMocks; bad_practices: avoid_full_module_import; perf_improvements: mock_irrelevant_deps; service_testing: mock_http_for_logic; no_schema: avoid_NO_ERRORS_SCHEMA; expectation_specificity: true; solutions: {boolean: toBeTrue/False, reference: toBe, existence: toBeNull/NotNull, undefined: toBeUndefined, class_obj: toContainEntries/toEqual, spy_calls: {not_called: not.toHaveBeenCalled, once: toHaveBeenCalledOnce, with_value: toHaveBeenCalledWith|toHaveBeenCalledExactlyOnceWith}}

Additional comments not posted (15)
src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.html (4)

12-12: Ensure the form layout is accessible and user-friendly as intended.


65-71: Verify that the button for creating a relation is correctly disabled based on the required conditions.


74-85: Confirm that the centering functionality of the button works as expected and adheres to accessibility standards.


92-99: Check the configuration of the ngx-graph component, especially the mini-map feature, to ensure it enhances the graph's usability.

src/test/javascript/spec/component/competencies/competency-management/competency-relation-graph.component.spec.ts (1)

167-174: Ensure the new test case adequately covers the functionality of the centerView method, including both zooming and centering aspects.

src/main/webapp/app/course/competencies/competency-management/competency-management.component.html (1)

43-48: Confirm that the updated event binding (onRemoveRelation)="onRemoveRelation($event)" correctly triggers the intended method in the TypeScript component.

src/main/webapp/app/course/competencies/competency-management/competency-relation-graph.component.ts (3)

2-2: Confirm that the faArrowsToEye icon is correctly imported and used for the centering button.


49-50: Check the initialization and usage of the center$ and zoomToFit$ subjects to ensure they are correctly implemented for the graph's zooming and centering features.


87-90: Review the centerView method to ensure it correctly triggers the zooming and centering actions in the ngx-graph component.

src/main/webapp/app/course/competencies/competency-management/competency-management.component.ts (2)

26-27: Verify the correct import and usage of ConfirmAutofocusModalComponent and TranslateService for localization and confirmation dialogs.


263-282: Review the new onRemoveRelation method to ensure it correctly handles the confirmation dialog and calls the removeRelation method upon confirmation.

src/test/javascript/spec/component/competencies/competency-management/competency-management.component.spec.ts (2)

259-272: Ensure the new test case adequately mocks the modal service and verifies the removal of a relation through the onRemoveRelation method.


274-280: Check that the removeRelation method correctly updates the component's state by removing the specified relation.

src/main/webapp/i18n/en/competency.json (1)

52-53: The new keys for the delete relation modal are clear and contextually appropriate.

src/main/webapp/i18n/de/competency.json (1)

52-53: The German translations for the delete relation modal are accurate and maintain the intended meaning.


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.

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Apr 19, 2024
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.

Demonstrated in testing session. Worked as expected

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.

demonstrated in testing session, looks good

Copy link
Contributor

@florian-glombik florian-glombik left a comment

Choose a reason for hiding this comment

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

Tested together on ts1, worked as described

The code looks good to me aswell

Copy link
Contributor

@JohannesWt JohannesWt left a comment

Choose a reason for hiding this comment

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

Code looks good

Copy link
Contributor

@MaximilianAnzinger MaximilianAnzinger left a comment

Choose a reason for hiding this comment

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

Maintainer approved

@krusche krusche added this to the 7.0.2 milestone Apr 22, 2024
@krusche krusche merged commit 6cedfa9 into develop Apr 22, 2024
82 of 88 checks passed
@krusche krusche deleted the enhancement/adaptive-learning/improve-competency-relation-graph branch April 22, 2024 19:34
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!) component:AdaptiveLearning enhancement small tests
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

7 participants