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: Improve angular control flow #8117

Merged
merged 6 commits into from
Mar 11, 2024

Conversation

milljoniaer
Copy link
Contributor

@milljoniaer milljoniaer commented Mar 2, 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.

Motivation and Context

There have been some control flow statements which could be simplified due to the migration to angulars new control flow syntax.

Description

This PR clears some of that up.

Steps for Testing

Prerequisites:

  • 1 Instructor
  1. Log in to Artemis
  2. Verify that Server Administration > Audits still work

Testserver States

Note

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







Review Progress

Code Review

  • Code Review 1
  • Code Review 2

Screenshots

Summary by CodeRabbit

  • New Features

    • Enhanced the display of table headers, pagination, and various components across the app based on user permissions and loading states.
    • Improved the visibility and arrangement of user management actions based on activation status.
    • Adjusted the display of text and information in assessment headers, metrics, and various dashboards to better reflect current states or modes (e.g., exam mode).
    • Streamlined the display logic for competency management, learning paths, and course discussions, focusing on loading states and user roles.
    • Refined the conditional rendering for exercise hints, scores, and code hints to improve user interaction and feedback based on the current state.
  • Bug Fixes

    • Corrected inconsistencies in the display logic across several components, ensuring information is presented accurately based on user roles, loading states, and specific conditions (e.g., exam mode, presence of inconsistencies).
    • Fixed the conditional rendering for buttons and information related to student exams and attendance checks, enhancing the user experience for instructors and students alike.

@milljoniaer milljoniaer requested a review from a team as a code owner March 2, 2024 17:06
Copy link

coderabbitai bot commented Mar 2, 2024

Walkthrough

The overall change focuses on enhancing the readability and maintainability of the codebase by refining conditional rendering logic across various components. Key adjustments include replacing switch statements with if-else blocks, removing unnecessary conditional checks, and shifting from using @if blocks to @else blocks for handling loading states and display logic. These modifications aim to streamline the control flow and improve the user interface's responsiveness and clarity.

Changes

File(s) Change Summary
.../audits/audits.component.html, .../audits/audits.component.ts Refactored conditional rendering logic for table headers and pagination, added canLoad boolean property, and renamed method to calculateCanLoad.
.../metrics-garbagecollector/metrics-garbagecollector.component.html Removed conditional check for displaying garbage collector metrics.
.../system-notification-management/system-notification-management.component.html Removed redundant @if (notifications) block.
.../user-management/user-management.component.html Restructured button placement and removed conditional logic for user activation status.
.../assessment-header/assessment-header.component.html, .../list-of-complaints/list-of-complaints.component.html, .../competency-management/competency-management.component.html, .../create-competency/create-competency.component.html, .../edit-competency/edit-competency.component.html, .../assessment-dashboard/assessment-dashboard-information.component.html, .../learning-path/learning-path.component.html, .../student-exams/student-exam-detail.component.html, .../student-exams/student-exams.component.html, .../students/verify-attendance-check/exam-students-attendance-check.component.html, .../code-hint-generation-step/code-hint-generation-step.component.html, .../treeview/treeview.component.html, .../exercise-hint-expandable/exercise-hint-expandable.component.html, .../exercise-scores/exercise-scores.component.html, .../create-exercise-unit/create-exercise-unit.component.html, .../lecture-unit-layout/lecture-unit-layout.component.html, .../course-discussion/course-discussion.component.html, .../course-registration/course-prerequisites-modal.component.html, .../consistency-check/consistency-check.component.html, .../loading-indicator-container/loading-indicator-container.component.html Altered conditional rendering logic across various components, including switching from @if to @else blocks, removing unnecessary checks, and refining display logic for better clarity and maintainability.

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-tests 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 tests 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 tests.
    • @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.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@github-actions github-actions bot added the client Pull requests that update TypeScript code. (Added Automatically!) label Mar 2, 2024
@artemis-bot artemis-bot added this to In progress in Artemis Development Mar 2, 2024
Copy link
Contributor

@matthiaslehnertum matthiaslehnertum left a comment

Choose a reason for hiding this comment

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

Looks good to me! Nice clean up of the control flow!

Depending on the outcome of the discussion around our preferred translation approach I guess you might need to adapt the translations but good for now.

Artemis Development automation moved this from In progress to Review in progress Mar 6, 2024
RY997
RY997 previously approved these changes Mar 11, 2024
Copy link
Contributor

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

Copy link
Contributor

@RY997 RY997 left a comment

Choose a reason for hiding this comment

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

Reapprove!

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

@rabeatwork rabeatwork added the maintainer-approved The feature maintainer has approved the PR label Mar 11, 2024
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.

Code 💯

@bassner bassner added this to the 6.9.2 milestone Mar 11, 2024
@bassner bassner merged commit bdb6d9b into develop Mar 11, 2024
45 of 49 checks passed
@bassner bassner deleted the chore/improve-html-control-flow branch March 11, 2024 13:55
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!) maintainer-approved The feature maintainer has approved the PR ready to merge
Projects
No open projects
Artemis Development
  
Review in progress
Development

Successfully merging this pull request may close these issues.

None yet

7 participants