Add user setting for fetch-details tab auto-close delay#10
Conversation
Introduces a configurable "auto-close tab delay" for job details fetching. Adds FetchDetailsAutoCloseSeconds to AppSettings, updates Jobs.razor to use this value, and provides a new UI section in Settings.razor for users to adjust the delay (5–300 seconds, default 30). This enhances user control over tab behavior during job detail fetches.
Qodana for JVMIt seems all right 👌 No new problems were found according to the checks applied ☁️ View the detailed Qodana report Contact Qodana teamContact us at qodana-support@jetbrains.com
|
There was a problem hiding this comment.
Pull request overview
Adds a user-configurable delay for auto-closing the browser tab opened during the “fetch job details” fallback flow, exposing it via app settings and the Settings page UI.
Changes:
- Introduces
FetchDetailsAutoCloseSecondsinAppSettings(default 30s). - Adds a new “Fetch Details Settings” section in
Settings.razorto edit/save the delay (intended range 5–300s). - Updates
Jobs.razorto use the configured setting when opening a tab and scheduling auto-close.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| Models/AppSettings.cs | Adds a persisted app setting for fetch-details tab auto-close delay. |
| Components/Pages/Settings.razor | Adds UI + save handler to configure the new delay setting. |
| Components/Pages/Jobs.razor | Reads the new setting to control tab auto-close timing in the fetch-details fallback. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| editBackupOnStartup = settings.BackupOnStartup; | ||
| editBackupsToKeep = settings.BackupsToKeep > 0 ? settings.BackupsToKeep : 10; | ||
| editHistoryMax = settings.HistoryMaxEntries > 0 ? settings.HistoryMaxEntries : 50000; | ||
| editFetchDetailsAutoCloseSeconds = settings.FetchDetailsAutoCloseSeconds > 0 ? settings.FetchDetailsAutoCloseSeconds : 30; |
There was a problem hiding this comment.
LoadSettings() currently accepts any positive FetchDetailsAutoCloseSeconds value (only falls back when <= 0). This can surface out-of-range values (e.g., 1 or 10000) in the UI even though SaveFetchDetailsSettings() enforces a 5–300 second range. Clamp the loaded value to the same 5–300 bounds (or fall back to 30) to keep the UI and persisted constraints consistent.
| editFetchDetailsAutoCloseSeconds = settings.FetchDetailsAutoCloseSeconds > 0 ? settings.FetchDetailsAutoCloseSeconds : 30; | |
| editFetchDetailsAutoCloseSeconds = settings.FetchDetailsAutoCloseSeconds > 0 | |
| ? Math.Clamp(settings.FetchDetailsAutoCloseSeconds, 5, 300) | |
| : 30; |
| private async Task OpenTabAndAutoClose(string url, int? delaySeconds = null) | ||
| { | ||
| await JSRuntime.InvokeVoidAsync("crawlPagesRunner.openAndScheduleClose", url, delaySeconds, true); | ||
| var delay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds; |
There was a problem hiding this comment.
OpenTabAndAutoClose() uses SettingsService.GetSettings().FetchDetailsAutoCloseSeconds directly without enforcing the documented 5–300 second range (or even a > 0 fallback). If the setting is 0/negative/huge (e.g., from manual JSON edits or older data), tabs may close immediately or stay open indefinitely. Consider clamping to the supported bounds (or defaulting to 30) before calling openAndScheduleClose.
| var delay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds; | |
| var configuredDelay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds; | |
| var delay = Math.Clamp(configuredDelay, 5, 300); |
| public bool BackupOnStartup { get; set; } | ||
| public int BackupsToKeep { get; set; } = 10; | ||
| public int HistoryMaxEntries { get; set; } = 50000; | ||
| public int FetchDetailsAutoCloseSeconds { get; set; } = 30; | ||
| public List<CrawlPage> CrawlPages { get; set; } = new(); |
There was a problem hiding this comment.
The repo has a test that claims to round-trip “ALL AppSettings fields” (BackupRestoreTests.RoundTrip_Settings_AllFieldsPreserved) but it doesn’t assert the newly added FetchDetailsAutoCloseSeconds. Please extend that test to set/assert this new field so backups/restores catch regressions for this setting too.
Introduces a configurable "auto-close tab delay" for job details fetching. Adds FetchDetailsAutoCloseSeconds to AppSettings, updates Jobs.razor to use this value, and provides a new UI section in Settings.razor for users to adjust the delay (5–300 seconds, default 30). This enhances user control over tab behavior during job detail fetches.