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

Development: Migrate client code for complaints #10085

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

maximiliansoelch
Copy link
Member

@maximiliansoelch maximiliansoelch commented Dec 27, 2024

Checklist

General

Client

Motivation and Context

For the client migration of the complaint components, the following files need to be updated:

-- Filepath Standalone Signals Inject
22 /complaints/complaint-response.service.ts
23 /complaints/complaint.service.ts
24 /complaints/complaints-for-students/complaints-student-view.component.html
25 /complaints/complaints-for-students/complaints-student-view.component.ts
26 /complaints/complaints-for-tutor/complaints-for-tutor.component.html
27 /complaints/complaints-for-tutor/complaints-for-tutor.component.ts
28 /complaints/form/complaints-form.component.html
29 /complaints/form/complaints-form.component.ts
30 /complaints/list-of-complaints/list-of-complaints.component.ts
31 /complaints/request/complaint-request.component.html
32 /complaints/request/complaint-request.component.ts
33 /complaints/response/complaint-response.component.html
34 /complaints/response/complaint-response.component.ts

Description

In this PR, we migrate the above-listed components to standalone and perform the inject migration. The signals migration is not part of this PR!

Steps for Testing

Prerequisites:

  • 1 Instructor
  • 1 Student
  • Two exercises with enabled complaints
  1. Participate in the exercises as a student
  2. After the exercises are over, make a manual assessment as the instructor
  3. As a student, view the results and make a complaint on each exercise
  4. As an instructor, review the complaints and accept one + reject one
  5. As a student, make sure the complaint resolution is displayed (accept/reject)

Tip

You can find more info about the complaint system and how it works here: https://docs.artemis.cit.tum.de/user/assessment.html#complaints

Exam Mode Testing

Prerequisites:

  • 1 Instructor
  • 1 Student
  • 1 Exam with two exercises with enabled complaints
  1. Participate in the exam as a student
  2. After the exam is over, make a manual assessment as the instructor
  3. As a student, view the results and make a complaint on each exercise
  4. As an instructor, review the complaints and accept one + reject one
  5. As a student, make sure the complaint resolution is displayed (accept/reject)

Testserver States

Note

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







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Exam Mode Test

  • Test 1
  • Test 2

Summary by CodeRabbit

Release Notes

  • New Features

    • Introduced standalone components for complaints functionality
    • Enhanced dependency injection using Angular's inject() function
  • Refactoring

    • Migrated complaint-related modules to use standalone components
    • Simplified service and component dependency management
    • Removed ArtemisComplaintsForTutorModule across multiple modules
  • Improvements

    • Updated component imports and configurations
    • Streamlined Angular module structure for complaints management

@github-actions github-actions bot added tests client Pull requests that update TypeScript code. (Added Automatically!) labels Dec 27, 2024
@maximiliansoelch maximiliansoelch marked this pull request as ready for review January 3, 2025 11:24
@maximiliansoelch maximiliansoelch requested a review from a team as a code owner January 3, 2025 11:24
Copy link

coderabbitai bot commented Jan 3, 2025

Walkthrough

This pull request focuses on modernizing the Angular module and component structure within the Artemis application, particularly in the complaints-related modules. The changes primarily involve converting components to standalone components, removing deprecated modules, and simplifying dependency injection using Angular's inject function. The modifications span multiple files across the complaints and assessment modules, streamlining the application's architecture and aligning with modern Angular development practices.

Changes

File Path Change Summary
src/main/webapp/app/assessment/assessment-shared.module.ts Replaced ArtemisComplaintsForTutorModule import with ComplaintsForTutorComponent
src/main/webapp/app/complaints/complaint-response.service.ts Migrated to inject() for dependency injection
src/main/webapp/app/complaints/complaint.service.ts Migrated to inject() for dependency injection
Multiple complaint-related components Converted to standalone components with direct imports
Multiple modules (e.g., complaints.module.ts, course-management.module.ts) Replaced module imports with component imports

Suggested labels

ready to merge, small, maintainer-approved

Suggested reviewers

  • JohannesStoehr
  • HawKhiem
  • sachmii
  • Malekos74
  • Feras797
  • Abus00
  • SimonEntholzer

Possibly related PRs


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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @coderabbitai title anywhere in the PR title to generate the title automatically.

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

🧹 Nitpick comments (2)
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (1)

32-36: Good switch to service injection.

Using Angular's inject function declutters the constructor and clarifies dependencies. As a best practice, remember to handle subscription cleanup, especially for any streams to prevent potential memory leaks.

src/main/webapp/app/complaints/complaint-response.service.ts (1)

15-16: Modernize service injection.

Eliminating the constructor in favor of inject() is a neat approach to reduce boilerplate. Confirm consistency across other services—mixing constructor injection and inject() can lead to confusion if used inconsistently.

📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 82bf67c and 31cbbf4.

📒 Files selected for processing (20)
  • src/main/webapp/app/assessment/assessment-shared.module.ts (1 hunks)
  • src/main/webapp/app/complaints/complaint-response.service.ts (2 hunks)
  • src/main/webapp/app/complaints/complaint.service.ts (2 hunks)
  • src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (2 hunks)
  • src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts (2 hunks)
  • src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts (0 hunks)
  • src/main/webapp/app/complaints/complaints.module.ts (1 hunks)
  • src/main/webapp/app/complaints/form/complaints-form.component.ts (1 hunks)
  • src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts (2 hunks)
  • src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts (1 hunks)
  • src/main/webapp/app/complaints/request/complaint-request.component.ts (1 hunks)
  • src/main/webapp/app/complaints/response/complaint-response.component.ts (1 hunks)
  • src/main/webapp/app/course/manage/course-management.module.ts (2 hunks)
  • src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts (2 hunks)
  • src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts (2 hunks)
  • src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts (2 hunks)
  • src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts (2 hunks)
  • src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts (1 hunks)
  • src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts (2 hunks)
💤 Files with no reviewable changes (1)
  • src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.module.ts
✅ Files skipped from review due to trivial changes (1)
  • src/test/javascript/spec/component/complaints/complaints-form.component.spec.ts
🧰 Additional context used
📓 Path-based instructions (18)
src/main/webapp/app/complaints/complaints.module.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/complaints/complaint-response.service.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/exercises/programming/assess/programming-assessment.module.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/complaints/response/complaint-response.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/complaints/list-of-complaints/list-of-complaints.module.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/manage/course-management.module.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/complaints/complaint.service.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/exercises/programming/participate/programming-repository.module.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/assessment/assessment-shared.module.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/complaints/complaints-for-tutor.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/test/javascript/spec/component/assessment-shared/assessment-layout.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/complaints/request/complaint-request.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/complaints/list-of-complaints/list-of-complaints.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/complaints/list-of-complaints.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/complaints/complaints-for-students/complaints-student-view.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/exercises/text/assess/text-submission-assessment.module.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/complaints/complaints-for-tutor/complaints-for-tutor.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/complaints/form/complaints-form.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

🔇 Additional comments (40)
src/main/webapp/app/complaints/complaints-for-students/complaints-student-view.component.ts (3)

1-1: Nice use of Angular's inject in the imports.

This aligns well with modern Angular architecture and improves the clarity of dependencies by removing constructor parameters.


28-29: Correct standalone component declaration.

Declaring the component as stand-alone with its own imports is a best practice in modern Angular, allowing more self-contained and modular code.


17-22: Imports properly configured for a standalone component.

These newly imported directives and components are consistent with Angular's standalone approach. Make sure each is used or needed to minimize unnecessary imports.

✅ Verification successful

All imported components and directives are properly used in the standalone component

Based on the search results, all the imported components and directives in complaints-student-view.component.ts are correctly used in its imports array:

imports: [TranslateDirective, FaIconComponent, ComplaintsFormComponent, ComplaintRequestComponent, ComplaintResponseComponent, ArtemisTranslatePipe]

Each imported component/directive is:

  • Properly declared as standalone
  • Used within the component's imports array
  • Part of the complaints feature module functionality
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Checking usage of newly imported directives & components
rg -A 5 "TranslateDirective|FaIconComponent|ComplaintsFormComponent|ComplaintRequestComponent|ComplaintResponseComponent|ArtemisTranslatePipe" src/main/webapp/app/complaints

Length of output: 13918

src/main/webapp/app/complaints/response/complaint-response.component.ts (2)

3-6: Validate necessity of newly imported modules.
While these modules (NgbTooltip, FormsModule, ArtemisSharedCommonModule, ArtemisTranslatePipe) are often used in templates, verify each is truly needed. If any are unused, consider removing them to reduce bundle size and complexity.


11-12: Good use of Angular standalone components.
Defining standalone: true and adding necessary imports aligns with modern Angular best practices. Just ensure that other modules referencing this component remove any redundant declarations.

src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.component.ts (5)

1-1: Good use of standalone injection.

Using inject directly in your imports clarifies dependencies and aligns well with modern Angular best practices, as recommended by the style guide.


11-11: Tooltip import looks good.

Your addition of NgbTooltip is consistent with ng-bootstrap usage. Ensure you're referencing it in the template for clarity and keep track of possible memory leaks only if tooltips persist across routes.


18-22: Expansion of imports for standalone usage is correct.

Bringing in TranslateDirective, FormsModule, ArtemisSharedCommonModule, FaIconComponent, and ArtemisTranslatePipe enables the necessary functionality within this component. This change respects the Angular style guide's recommended approach for standalone components.


27-28: Properly declared standalone component.

Defining standalone: true and including these modules in imports is fully compliant with the new Angular standalone pattern.


31-40: Appropriate usage of inject.

All service injections look clean and consistent with the recommended Angular approach. This pattern reduces constructor boilerplate.

src/main/webapp/app/complaints/list-of-complaints/list-of-complaints.module.ts (1)

10-10: Correct module configuration for the standalone component.

Importing ListOfComplaintsComponent in the imports array instead of the declarations array is the right move for a standalone component. This setup matches Angular best practices.

src/main/webapp/app/complaints/request/complaint-request.component.ts (2)

3-7: Enhanced imports for expanded functionality.

The addition of NgbTooltip, TranslateDirective, FormsModule, ArtemisSharedCommonModule, and ArtemisTranslatePipe ensures a robust feature set for your component. The single-quote style and usage conform to the guidelines.


12-13: Refactor to a standalone component is successful.

Declaring standalone: true and specifying necessary dependencies in imports is consistent with the recommended approach for Angular standalone components.

src/main/webapp/app/complaints/complaints.module.ts (1)

12-12: Switch to importing standalone components.

Replacing declarations with imports for ComplaintsFormComponent, ComplaintsStudentViewComponent, ComplaintRequestComponent, and ComplaintResponseComponent is in line with your migration strategy toward standalone components.

src/main/webapp/app/assessment/assessment-shared.module.ts (2)

20-20: Direct import of ComplaintsForTutorComponent recognized.

Adding ComplaintsForTutorComponent ensures the tutor complaint functionality is available. Make sure to re-check routing references if you removed a related module.


27-27: Module imports revised correctly.

Importing the standalone ComplaintsForTutorComponent in place of the previous module is consistent with the new architecture pattern.

src/main/webapp/app/exercises/programming/assess/programming-assessment.module.ts (2)

20-20: Confirm import consistency and single quote usage.

Importing the ComplaintsForTutorComponent directly is consistent with the single-quote requirement from the styleguide. Ensure that this path is correct and that any reusability or shared logic is factored into a shared location if it’s used widely across multiple modules.


29-29: Validate standalone component import.

By adding ComplaintsForTutorComponent to the imports array, you’re presumably treating it as a standalone component. Confirm that it is indeed declared as standalone in its own file. If it requires additional Angular modules (e.g. CommonModule), ensure these are included in the component’s standalone imports.

src/main/webapp/app/exercises/text/assess/text-submission-assessment.module.ts (2)

23-23: Check that the new import path is correct.

The import path for the ComplaintsForTutorComponent looks valid. Verify that the directory structure and naming conventions conform to the Angular styleguide.
[approve]


33-33: Assess standalone usage.

Adding ComplaintsForTutorComponent to the imports array suggests it is a standalone component. Ensure that all necessary providers, pipes, and modules are globally accessible if the component depends on them.

src/main/webapp/app/exercises/programming/participate/programming-repository.module.ts (2)

22-22: Import path and single quotes are consistent.

The import statement for ComplaintsForTutorComponent is aligned with the single-quote standard. Verify that the referenced file complaints-for-tutor.component.ts is indeed the correct location.


31-31: Ensure standalone correctness.

Placing the ComplaintsForTutorComponent in the imports array is correct if the component is truly standalone. Double-check nested dependencies and any relevant entry components or dynamic module imports.

src/main/webapp/app/complaints/complaint-response.service.ts (1)

1-1: Confirm Angular version compatibility.

Using inject requires Angular 14+. Ensure that the project’s Angular version is at least 14 before adopting the new injection mechanism.

src/test/javascript/spec/component/assessment-shared/assessment-layout.component.spec.ts (1)

25-25: Ensure mock usage in imports is aligned with best practices.
Moving ComplaintsForTutorComponent from declarations to imports is correct for a standalone component mock. This helps prevent potential conflicts in the test environment. No further changes needed.

src/main/webapp/app/complaints/form/complaints-form.component.ts (3)

2-2: Confirm usage of new imports for standalone approach.
The direct import of TranslateDirective, FormsModule, TextareaModule, and ArtemisTranslatePipe is valid for a standalone component. Ensure each imported module or directive is strictly needed to prevent bloat.

Also applies to: 10-13


19-20: Standalone component configuration is properly adopted.
Enabling standalone: true and specifying imports for the component fosters clearer, localized dependencies. This aligns with the Angular style guideline on standalone components.


23-25: Validate usage of the Angular inject function for services.
Switching to inject() clarifies dependency usage. Ensure that any side effects or initialization steps formerly in the constructor are still properly handled (if applicable).

src/main/webapp/app/course/manage/course-management.module.ts (1)

71-71: Standalone complaints component usage.
Importing ComplaintsForTutorComponent in place of the former module is consistent with the new standalone component structure. Double-check that all references to the old module have been removed to avoid dead code.

Also applies to: 100-100

src/main/webapp/app/complaints/complaints-for-tutor/complaints-for-tutor.component.ts (3)

1-1: Review added imports for form and translation handling.
Using TranslateDirective, FormsModule, and TextareaModule in a standalone component is appropriate. Confirm that ArtemisSharedCommonModule has no conflicting providers with the new approach.

Also applies to: 16-20


27-28: Properly declaring the component as standalone.
The use of standalone: true and explicitly listing imports fosters a self-contained component design.


31-36: Check lifecycle dependencies after constructor removal.
Injecting all services via inject() is fine, but verify that any logic previously handled in a constructor is adequately moved to ngOnInit or other lifecycle hooks, if needed.

src/main/webapp/app/complaints/complaint.service.ts (3)

34-34: Use of standalone inject approach
Replacing the constructor with inject(HttpClient) is a valid approach for newer Angular versions. Ensure consumers of this service align with Angular >= v14 to avoid compatibility issues.


35-35: Direct injection of ComplaintResponseService
This is consistent with the updated Angular injection style. Verify that no legacy usage patterns rely on constructor injection for testing or reflection-based libraries.


37-37: Maintain consistent naming for resourceUrl
Using a well-defined property like resourceUrl is consistent with existing patterns. No further issues found.

src/test/javascript/spec/component/complaints/list-of-complaints.component.spec.ts (3)

27-27: Importing shared module
You added ArtemisSharedCommonModule import but then removed it in the override. Confirm whether the module is actually needed in tests or if using direct imports for its components/pipes is more optimal.


67-67: Declarations array clarifications
Here, you only declare mocks and pipe stubs. Verify that the component under test doesn’t require additional declarations or imports after the override removal of ArtemisSharedCommonModule.
[approve]


79-81: Selective override for component
Removing ArtemisSharedCommonModule import from ListOfComplaintsComponent in the test environment can help isolate tests. Ensure that none of the shared services/pipes are inadvertently needed.

src/test/javascript/spec/component/complaints/complaints-for-tutor.component.spec.ts (3)

21-22: New TranslateService import and mock
Including TranslateService from @ngx-translate/core and MockTranslateService ensures translation behavior is isolated in tests. Looks good.


35-36: Standalone component test declarations
Declaring only mocks and pipes is consistent with the standalone component approach. Make sure no other dependencies are missing for the test scenario.


37-44: Provider configuration
Registering provideRouter([]) and mocking the relevant services is a best practice. Confirm that you do not need to import the real ComplaintResponseService in providers if the tested logic depends on any real method calls.

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 on ts4 with text exercises. Complaints work for normal text exercises and for exam text exercises. The status of the complaint (rejected / accepted) is correctly show to the student

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 for review tests
Projects
Status: Ready For Review
Development

Successfully merging this pull request may close these issues.

3 participants