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

Admin UI: display error in quota dialog #514

Merged
merged 52 commits into from
Feb 14, 2024
Merged

Conversation

stamenione
Copy link
Contributor

@stamenione stamenione commented Feb 1, 2024

Readiness checklist

  • I added/updated unit tests.
  • I added/updated integration tests.
  • I ensured that the PR title is good enough for the changelog.
  • I labeled the PR.

Description

image

image

Summary by CodeRabbit

  • New Features
    • Introduced error handling in quota assignment with user-friendly messages.
    • Added a client secret warning indicator for better security awareness.
  • Bug Fixes
    • Corrected quota creation logic to prevent quotas with non-positive max values.
    • Enhanced quota assignment dialog to improve data handling and user interaction.
  • Style
    • Implemented new styling for error and warning messages in the quota management interface.
  • Refactor
    • Streamlined quota assignment processes and improved data refresh mechanism for immediate feedback.

@stamenione stamenione added the chore Some routine work like updating dependencies label Feb 1, 2024
@stamenione stamenione self-assigned this Feb 1, 2024
@stamenione stamenione requested a review from tnotheis as a code owner February 1, 2024 15:31
Copy link
Member

@tnotheis tnotheis left a comment

Choose a reason for hiding this comment

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

The error message in your screenshot shows some random JS error. I don't know where exactly it comes from, but it's definitely not the one coming from the backbone (there is no undefined in C#)

@tnotheis
Copy link
Member

tnotheis commented Feb 2, 2024

@coderabbitai review

Copy link

coderabbitai bot commented Feb 2, 2024

Important

Auto Review Skipped

Auto reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository.

To trigger a single review, invoke the @coderabbitai review command.

Walkthrough

The updates focus on enhancing error handling and user feedback in the quota assignment dialog within an admin UI. They introduce a system to display error messages, refine quota creation logic with better conditions and error messages, and add a mechanism for refreshing data upon quota assignment. These changes aim to improve usability and ensure that quotas are only created with valid parameters.

Changes

File Path Change Summary
.../assign-quotas-dialog.component.css Added styling for a new error message container.
.../assign-quotas-dialog.component.html Included a div for displaying error messages.
.../assign-quotas-dialog.component.ts Enhanced quota creation with error handling; added errorMessage and isAllOk properties.
.../identity-details.component.ts Streamlined quota dialog opening and integrated data refresh trigger.
.../quotas.service.ts Introduced refreshDataSubject and related observable for data refresh.
Modules/Quotas/src/.../Identity.cs, Tier.cs Corrected conditions for quota max value checks.
Modules/Quotas/src/Quotas.Domain/DomainErrors.cs Updated an error message for clarity on quota max value constraints.

🐇✨
In the realm of code, where logic is king,
A rabbit hopped in, making systems sing.
With tweaks and fixes, a smoother flow,
Quotas set right, in the admin show. 🌟
🐇✨

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.
  • 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 from git 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.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 759679f and f00b2b8.
Files selected for processing (8)
  • AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.css (1 hunks)
  • AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.html (1 hunks)
  • AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.ts (5 hunks)
  • AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/identity/identity-details/identity-details.component.ts (3 hunks)
  • AdminUi/src/AdminUi/ClientApp/src/app/services/quotas-service/quotas.service.ts (2 hunks)
  • Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs (1 hunks)
  • Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs (1 hunks)
  • Modules/Quotas/src/Quotas.Domain/DomainErrors.cs (1 hunks)
Additional comments: 10
AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.css (1)
  • 12-23: The CSS for .client-secret-warning-container and .client-secret-warning is well-defined, ensuring that error messages will be visually distinct and attention-grabbing for users. The choice of colors, padding, and font weight enhances readability and user experience.
Modules/Quotas/src/Quotas.Domain/DomainErrors.cs (1)
  • 14-14: The updated error message in MaxValueCannotBeLowerOrEqualToZero method now accurately reflects the validation logic, clarifying that the max value for a quota cannot be lower than zero. This change improves the clarity of error messages presented to the user or developer, aligning with the validation rules enforced in the domain logic.
AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.html (1)
  • 34-36: The addition of a div element for displaying error messages when errorMessage is not empty is a good practice for enhancing user feedback. This ensures that any issues encountered during the quota assignment process are communicated clearly to the user, improving the overall user experience.
Modules/Quotas/src/Quotas.Domain/Aggregates/Tiers/Tier.cs (1)
  • 23-23: The adjustment of the condition for max from <= 0 to < 0 in the CreateQuota method is a logical correction that aligns with the updated validation rule. This ensures that quotas cannot be created with a max value of zero, which is consistent with the domain's validation requirements.
AdminUi/src/AdminUi/ClientApp/src/app/services/quotas-service/quotas.service.ts (1)
  • 13-22: The introduction of refreshDataSubject with a corresponding refreshData$ observable and a triggerRefresh method in the QuotasService class is a well-implemented feature for enabling reactive data refreshes in the UI. This pattern allows components to react to changes and refresh their data accordingly, enhancing the responsiveness and interactivity of the application.
AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/assign-quotas-dialog/assign-quotas-dialog.component.ts (2)
  • 24-25: The addition of errorMessage and isAllOk properties to the component is a good practice for managing component state, especially in the context of asynchronous operations like quota assignment. These properties facilitate better error handling and success feedback within the UI.
  • 69-99: The enhancements to the createIdentityQuota method, including comprehensive error handling and success messaging, significantly improve the user experience by providing clear feedback on the outcome of quota assignments. The use of triggerRefresh to update the UI after a successful operation is a good practice, ensuring that the UI reflects the latest state.
Modules/Quotas/src/Quotas.Domain/Aggregates/Identities/Identity.cs (1)
  • 37-37: Adjusting the condition for max from <= 0 to < 0 in the CreateIndividualQuota method correctly enforces the validation rule that the maximum value cannot be zero. This change ensures consistency in validation logic across different parts of the domain model, enhancing the robustness of the system.
AdminUi/src/AdminUi/ClientApp/src/app/components/quotas/identity/identity-details/identity-details.component.ts (2)
  • 82-84: Subscribing to refreshData$ from quotasService to trigger loadIdentityAndTiers upon data refresh is an effective way to ensure that the identity details component remains up-to-date with the latest data. This reactive approach enhances the user experience by automatically updating the UI in response to changes.
  • 189-192: The simplification of the openAssignQuotaDialog method, specifically the streamlined way of passing address data to AssignQuotasDialogComponent, improves the readability and maintainability of the code. This change ensures that only necessary data is passed to the dialog, reducing complexity and potential for errors.

@stamenione stamenione changed the title Display error in quota dialog Admin UI: display error in quota dialog Feb 5, 2024
@stamenione stamenione requested a review from tnotheis February 7, 2024 07:04
Copy link
Member

@tnotheis tnotheis left a comment

Choose a reason for hiding this comment

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

What's the state of this PR again? Is the error message problem fixed by now? If so, update the screenshot in the description please

@stamenione stamenione requested review from tnotheis and NikolaDmitrasinovic and removed request for NikolaDmitrasinovic February 13, 2024 13:06
tnotheis
tnotheis previously approved these changes Feb 14, 2024
@stamenione stamenione merged commit abaf8dc into main Feb 14, 2024
14 checks passed
@stamenione stamenione deleted the assign-quota-dialog branch February 14, 2024 13:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Some routine work like updating dependencies
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants