-
Notifications
You must be signed in to change notification settings - Fork 297
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
Communication
: Add loading indicator when adding users to channel
#10032
Communication
: Add loading indicator when adding users to channel
#10032
Conversation
WalkthroughThis pull request introduces loading state management for the conversation add users dialog in an Angular application. The changes span multiple files in the course conversations module, adding a new Changes
Sequence DiagramsequenceDiagram
participant User
participant Dialog
participant Form
participant Service
User->>Dialog: Initiate Add Users
Dialog->>Form: Set isLoading = false
User->>Form: Select Users
User->>Form: Submit
Form->>Dialog: Trigger addUsers()
Dialog->>Dialog: Set isLoading = true
Dialog->>Service: Add Users
Service-->>Dialog: Users Added
Dialog->>Dialog: Set isLoading = false
Dialog->>Form: Update UI
Possibly related PRs
Suggested labels
Suggested reviewers
Tip CodeRabbit's docstrings feature is now available as part of our Early Access Program! Simply use the command 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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
🧹 Nitpick comments (1)
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.ts (1)
32-32
: Consider using a signal for loading stateSince this component manages an async operation state, consider using an Angular signal for better reactivity and state management.
- protected isLoading: boolean = false; + protected isLoading = signal<boolean>(false);
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (5)
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html
(1 hunks)src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts
(3 hunks)src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html
(1 hunks)src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.ts
(4 hunks)src/test/javascript/spec/component/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.spec.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (5)
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.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/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.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/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.ts (1)
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts (1)
src/test/javascript/spec/component/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.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 (5)
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.html (1)
20-20
: LGTM! Loading state properly propagated to form component
The loading state is correctly bound to the child component, following Angular's input binding pattern.
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.ts (2)
28-29
: LGTM! Modern input() syntax used for loading state
The loading state is implemented using Angular's new input() syntax, which is the recommended approach.
46-49
: LGTM! Submit button state properly managed
The isSubmitPossible getter correctly considers the loading state to prevent multiple submissions while maintaining existing validation logic.
src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/conversation-add-users-form.component.html (1)
66-68
: LGTM! Clean implementation of loading indicator
The implementation follows Angular's new syntax guidelines with @if
and provides good user feedback with the spinner animation. The margin spacing (ms-2) ensures clean visual separation between text and spinner.
Let's verify the FontAwesome spinner icon import:
✅ Verification successful
FontAwesome spinner icon is properly imported
The faSpinner
icon is correctly imported from @fortawesome/free-solid-svg-icons
in the component's TypeScript file, ensuring the loading indicator will work as expected.
🏁 Scripts executed
The following scripts were executed for the analysis:
Script:
#!/bin/bash
# Check if the faSpinner icon is properly imported in the component
rg "import.*faSpinner.*from.*@fortawesome/free-solid-svg-icons" src/main/webapp/app/overview/course-conversations/dialogs/conversation-add-users-dialog/add-users-form/
Length of output: 376
src/test/javascript/spec/component/overview/course-conversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.spec.ts (1)
32-32
: LGTM! Clean implementation of loading state input
The implementation correctly uses Angular's new input() syntax and maintains appropriate access level.
...nversations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.ts
Show resolved
Hide resolved
...ations/dialogs/conversation-add-users-dialog/conversation-add-users-dialog.component.spec.ts
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS2. Upon adding users, the loading indicator is displayed and the "Add users" button is disabled. However other buttons are not disabled. Should they also be disabled to avoid overhead?
test.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[Tested on TS5]
Functionality works as described. Thought I have some concerns:
-
While users are still being added, the add more users button loads, but user can still exit and go to add users again. I fear that this could in extreme cases lead to synchronize issues.
-
In similar fashion, when deleting a course, the user can also exit the loading dialogue while it is still loading. When I tried this and tried to add another channel it did not work. Maybe this would belong to another issue to be opened since it does not only affect user adding functionality.
Hi! This PR serves as a quick fix to prevent users from spamming the button. So this functionality, while not ideal, is still kind of intended to be there. It only affects the client and does not do any uneccesary calls to the server 😄 |
…el-button-while-loading
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested on TS1, everything works as described
Hi, Thanks for the review! The purpose of the PR mainly is to avoid that users make a lot of uneccesary heavy server requests. Currently they do that because there is no indicator whatsoever that their button click did something. I was trying to tackle that issue specifically. I don't think that the other buttons are a big problem since they do not send any request to the server. 😊 |
…el-button-while-loading
Checklist
General
Client
Motivation and Context
Currently, when adding a lot of users to a channel it may load for a while. The button does not show a loading indicator, leading to users clicking it repeatedly, sending various heavy requests to the server.
Description
I added a loading indicator when adding users to a channel and disabled the button while loading.
Steps for Testing
Prerequisites:
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
Manual Tests
Test Coverage
Client
Screenshots
Summary by CodeRabbit
New Features
Bug Fixes
Tests