-
Notifications
You must be signed in to change notification settings - Fork 302
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
Exam mode
: Warn user before reloading the page
#10193
base: develop
Are you sure you want to change the base?
Conversation
WalkthroughThe pull request introduces a new functionality to the Changes
Assessment against linked issues
Possibly related PRs
Suggested Labels
Suggested Reviewers
📜 Recent review detailsConfiguration used: .coderabbit.yaml 📒 Files selected for processing (3)
🚧 Files skipped from review as they are similar to previous changes (1)
🧰 Additional context used📓 Path-based instructions (1)src/main/webapp/i18n/de/exam.json (1)Pattern ⏰ Context from checks skipped due to timeout of 90000ms (5)
🔇 Additional comments (2)
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: 1
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
src/main/webapp/app/exam/participate/exam-participation.component.ts
(2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/main/webapp/app/exam/participate/exam-participation.component.ts (1)
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: Codacy Static Code Analysis
- GitHub Check: client-tests
- GitHub Check: server-tests
- GitHub Check: Build and Push Docker Image
- GitHub Check: Analyse
🔇 Additional comments (1)
src/main/webapp/app/exam/participate/exam-participation.component.ts (1)
1-1
: LGTM!The
HostListener
import is correctly added to the existing@angular/core
imports.
//Make sure to warn the user before leaving the page in exam mode | ||
@HostListener('window:beforeunload', ['$event']) | ||
beforeUnloadHandler(event: BeforeUnloadEvent) { | ||
event.preventDefault(); | ||
} | ||
|
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.
🛠️ Refactor suggestion
Enhance the reload warning implementation.
The current implementation prevents the default behavior but doesn't show a confirmation dialog. To properly warn users before reloading:
- Return a string message to show the browser's default confirmation dialog.
- Add a guard to only show the warning during active exams.
Apply this diff to improve the implementation:
//Make sure to warn the user before leaving the page in exam mode
@HostListener('window:beforeunload', ['$event'])
beforeUnloadHandler(event: BeforeUnloadEvent) {
+ // Only show warning if exam is active and not over
+ if (this.examStartConfirmed && !this.isOver()) {
event.preventDefault();
+ // Return a string to show browser's default confirmation dialog
+ return this.translateService.instant('artemisApp.examParticipation.reloadWarning');
+ }
+ return true;
}
Committable suggestion skipped: line range outside the PR's diff.
…tom message when reloading
Checklist
General
Client
authorities
to all new routes and checked the course groups for displaying navigation elements (links, buttons).Motivation and Context
Fixes #10142
Exam Mode 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
Performance Review
Code Review
Manual Tests
Exam Mode Test
Performance Tests
Test Coverage
Screenshots
Summary by CodeRabbit