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 repository breadcrumbs #10383

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

Conversation

SimonEntholzer
Copy link
Contributor

@SimonEntholzer SimonEntholzer commented Feb 22, 2025

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 (e.g. using paging).
  • 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 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 breadcrumbs for the repository view are not working correctly.

Description

Fixes the breadcrumbs for the repository view.

Steps for Testing

  1. As an instructor go to the repository view (code button -> grey link button on the right) of the different exercise repository types (auxiliary, assignment, template, solution and tests)
  2. Check that the displayed breadcrumbs make sense

Exam Mode Testing

Check the breadcrumbs work for exam routes too.

Testserver States

You can manage test servers using Helios. Check environment statuses in the environment list. To deploy to a test server, go to the CI/CD page, find your PR or branch, and trigger the deployment.

Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Manual Tests

  • Test 1
  • Test 2

Test Coverage

Screenshots

image
image
image

Summary by CodeRabbit

  • New Features
    • Improved the main navigation by adding distinct breadcrumb labels for different repository types.
    • Enhanced localization with updated repository titles in both English and German, ensuring clearer display of assignment, template, solution, test, and auxiliary repositories.
  • Tests
    • Added a new test suite for breadcrumb functionality, covering special repository route cases to ensure accurate breadcrumb display.

@SimonEntholzer SimonEntholzer requested a review from a team as a code owner February 22, 2025 15:16
@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Feb 22, 2025
Copy link

coderabbitai bot commented Feb 22, 2025

Walkthrough

This pull request enhances the breadcrumb navigation in the application by integrating support for various repository types within the NavbarComponent. It introduces new translations for user, template, solution, tests, and auxiliary repositories in both German and English localization files. Additionally, a new test suite is added to ensure correct breadcrumb creation for repository-specific routes.

Changes

File Change Summary
src/.../navbar.component.ts Updated breadcrumb logic in NavbarComponent by importing RepositoryType, adding cases for 'USER' and 'AUXILIARY', and introducing a new method addRepositoryViewBreadcrumb to handle template, solution, and test repositories.
src/.../i18n/de/repository.json Added new German translation entries: "userRepository", "templateRepository", "solutionRepository", "testsRepository", and "auxiliaryRepository", each with their respective title strings.
src/.../i18n/en/repository.json Added new English translation entries: "userRepository", "templateRepository", "solutionRepository", "testsRepository", and "auxiliaryRepository", each with their respective title strings.
src/.../navbar.component.spec.ts Added a new test suite for repository route breadcrumb cases using parameterized tests to verify the breadcrumb array and its last element based on specific repository URLs.

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant R as Router
    participant N as NavbarComponent
    participant T as Translation Service
    U->>R: Navigate to repository URL
    R->>N: Update URL segments
    N->>N: Parse URL to identify repository type
    N->>T: Retrieve translation for repository type
    T-->>N: Return translated title
    N->>N: Update and render breadcrumbs
    N-->>U: Display updated navigation
Loading

Possibly related PRs

Suggested labels

bugfix, small, ready to merge

Suggested reviewers

  • BBesrour
  • EneaGore
  • HawKhiem
  • JohannesStoehr

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 5b50b6d and 462ffe2.

📒 Files selected for processing (1)
  • src/main/webapp/i18n/en/repository.json (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/main/webapp/i18n/en/repository.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: Analyse

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 (1)
src/main/webapp/i18n/de/repository.json (1)

35-49: Consider using consistent German terminology.

The translations mix English and German terms. Consider using German terms consistently:

  • "Assignment-Repository" → "Aufgaben-Repository"
  • "Template-Repository" → "Vorlagen-Repository"
-            "userRepository": {
-                "title": "Assignment-Repository"
-            },
-            "templateRepository": {
-                "title": "Template-Repository"
+            "userRepository": {
+                "title": "Aufgaben-Repository"
+            },
+            "templateRepository": {
+                "title": "Vorlagen-Repository"
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 07318ff and 5b50b6d.

📒 Files selected for processing (4)
  • src/main/webapp/app/shared/layouts/navbar/navbar.component.ts (6 hunks)
  • src/main/webapp/i18n/de/repository.json (1 hunks)
  • src/main/webapp/i18n/en/repository.json (1 hunks)
  • src/test/javascript/spec/component/shared/navbar.component.spec.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
`src/main/webapp/**/*.ts`: angular_style:https://angular.io/...

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/shared/layouts/navbar/navbar.component.ts
`src/test/javascript/spec/**/*.ts`: jest: true; mock: NgMock...

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/shared/navbar.component.spec.ts
`src/main/webapp/i18n/de/**/*.json`: German language transla...

src/main/webapp/i18n/de/**/*.json: German language translations should be informal (dutzen) and should never be formal (sietzen). So the user should always be addressed with "du/dein" and never with "sie/ihr".

  • src/main/webapp/i18n/de/repository.json
⏰ Context from checks skipped due to timeout of 90000ms (6)
  • GitHub Check: Call Build Workflow / Build and Push Docker Image
  • GitHub Check: Call Build Workflow / Build .war artifact
  • GitHub Check: Codacy Static Code Analysis
  • GitHub Check: client-tests
  • GitHub Check: server-tests
  • GitHub Check: Analyse
🔇 Additional comments (5)
src/test/javascript/spec/component/shared/navbar.component.spec.ts (1)

697-728: LGTM! Well-structured test suite for repository breadcrumbs.

The test suite effectively covers all repository types using parameterized tests, making it maintainable and comprehensive.

Some notable strengths:

  • Uses it.each for concise testing of multiple cases
  • Verifies both URL and label for each repository type
  • Consistent assertion pattern across all test cases
src/main/webapp/app/shared/layouts/navbar/navbar.component.ts (3)

409-414: LGTM! Well-organized translation keys.

The new translation keys follow the established naming pattern and are properly organized.


531-536: LGTM! Proper handling of USER and AUXILIARY repositories.

The implementation correctly handles repositories with IDs by adding appropriate translation crumbs.


971-992: LGTM! Well-implemented repository breadcrumb logic.

The addRepositoryViewBreadcrumb method:

  • Handles repository types consistently
  • Uses proper switch-case structure
  • Has clear documentation
src/main/webapp/i18n/en/repository.json (1)

36-50: LGTM! Clear and consistent translations.

The English translations follow a consistent pattern and are clearly understandable.

coderabbitai[bot]
coderabbitai bot previously approved these changes Feb 22, 2025
@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de February 22, 2025 18:25 Inactive
Copy link
Contributor

@ole-ve ole-ve 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, but there seems to be an issue with the script determining whether translations are consistent. it seems that the translation keys are not correctly picked up (always starting with a dot)

@SimonEntholzer
Copy link
Contributor Author

code looks good, but there seems to be an issue with the script determining whether translations are consistent. it seems that the translation keys are not correctly picked up (always starting with a dot)

aah good point, there was a mistake in the indentation of the translation .json files. Fixed it 👍

Copy link
Contributor

@ole-ve ole-ve 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 after adapting translation files 👍

Copy link
Contributor

@jfr2102 jfr2102 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

@helios-aet helios-aet bot temporarily deployed to artemis-test3.artemis.cit.tum.de February 25, 2025 09:36 Inactive
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