-
Notifications
You must be signed in to change notification settings - Fork 305
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
Lectures
: Disable submit button on invalid form and add tooltip
#10129
Lectures
: Disable submit button on invalid form and add tooltip
#10129
Conversation
6947d0d
to
549166b
Compare
@florian-glombik I am very sorry for the pings, but here is the newly opend PR about the tooltip. |
WalkthroughThe pull request involves modifications to the attachment unit form in the Artemis application, focusing on enhancing validation and user experience. Changes include updates to the HTML structure, TypeScript component logic, and internationalization files. Specifically, the form now requires both a name and a file for submission, incorporates tooltips for better user guidance, and improves error messaging to inform users of validation issues. Changes
Assessment against linked issues
Possibly related PRs
Suggested labels
Suggested reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms (8)
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.
tested on TS4, works as described for editing file units in the Lecture > Units
view.
Pbl out-of-scope, but I noticed that updating lecture units from within the edit-lecture view does not work. see attached video
Screen.Recording.2025-01-12.at.17.27.43.mov
I also noticed that the tooltip is misplaced when there is a |
7af6ddb
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
There hasn't been any activity on this pull request recently. Therefore, this pull request has been automatically marked as stale and will be closed if no further activity occurs within seven days. Thank you for your contributions. |
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.
Some suggestions
tooltipText = computed(() => { | ||
this.currentLanguage(); | ||
if (!this.fileName() && !this.name()) { | ||
return this.translateService.instant('artemisApp.attachmentUnit.createAttachmentUnit.nameAndFileRequiredValidationError'); | ||
} | ||
if (!this.fileName()) { | ||
return this.translateService.instant('artemisApp.attachmentUnit.createAttachmentUnit.fileRequiredValidationError'); | ||
} | ||
if (!this.name()) { | ||
return this.translateService.instant('artemisApp.attachmentUnit.createAttachmentUnit.nameRequiredValidationError'); | ||
} | ||
return undefined; | ||
}); |
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.
You can use the stream()
method of the translateService to subscribe to language changes directly. Wrap the observables returned by stream()
in a signal and use them here. No manual currentLanguage
subscription required.
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.
I made the changes to the manual subscription. Did you mean it like that?
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.
You used stream()
in the same way as the previous method.
This is calling the signal just to create a dependency on change notifications and then calling the translateService to get the new translation.
Instead, we can use the provided value of stream()
, which already includes the translation. This way we can subscribe to changes and receive the translation with a single method call.
I was thinking of something like this:
private readonly nameAndFileRequiredValidationErrorTranslation = toSignal(this.translateService.stream('artemisApp.attachmentUnit.createAttachmentUnit.nameAndFileRequiredValidationError'));
private readonly fileRequiredValidationErrorTranslation = toSignal(this.translateService.stream('artemisApp.attachmentUnit.createAttachmentUnit.fileRequiredValidationError'));
private readonly nameRequiredValidationErrorTranslation = toSignal(this.translateService.stream('artemisApp.attachmentUnit.createAttachmentUnit.nameRequiredValidationError'));
tooltipText = computed(() => {
if (!this.fileName() && !this.name()) {
return this.nameAndFileRequiredValidationErrorTranslation();
}
if (!this.fileName()) {
return this.fileRequiredValidationErrorTranslation();
}
if (!this.name()) {
return this.nameRequiredValidationErrorTranslation();
}
return undefined;
});
.../lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts
Outdated
Show resolved
Hide resolved
.../lecture-unit/lecture-unit-management/attachment-unit-form/attachment-unit-form.component.ts
Outdated
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.
…invalid-form-add-tooltip
b630299
Closed because of being inactive and/or open for a too long time. Please re-open a new pull request, if you still want to finish this feature and make sure to finish reviewing and testing quickly so merging the PR can be done within at most 2 weeks! This is best practice, avoids merge conflicts and reduces maintenance efforts! |
Opening this PR from a branch in the main repository to enable test server deployment, as it wasn't possible with the previous PR from a forked repository (see #9846)
Checklist
General
Server
Client
Motivation and Context
Fixes #9829. The submit button did not indicate that a mandatory field was still missing and could be clicked.
This led to confusion among users.
The error message for files that were too large also had an redundant sentence.
Description
I have updated/changed the conditions in isValidForm to recognize empty string names and uploaded files.
Steps for Testing
Prerequisites:
Lecture
Units
->File
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
Performance Review
Code Review
Manual Tests
Exam Mode Test
Performance Tests
Screenshots
tooltip-submit-button.mp4
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
Style