Skip to content

Add user setting for fetch-details tab auto-close delay#10

Merged
raymondjstone merged 1 commit into
masterfrom
develop
Apr 8, 2026
Merged

Add user setting for fetch-details tab auto-close delay#10
raymondjstone merged 1 commit into
masterfrom
develop

Conversation

@raymondjstone
Copy link
Copy Markdown
Owner

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.

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.
Copilot AI review requested due to automatic review settings April 8, 2026 19:20
@raymondjstone raymondjstone merged commit 1cba169 into master Apr 8, 2026
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 8, 2026

Qodana for JVM

It seems all right 👌

No new problems were found according to the checks applied

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

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 FetchDetailsAutoCloseSeconds in AppSettings (default 30s).
  • Adds a new “Fetch Details Settings” section in Settings.razor to edit/save the delay (intended range 5–300s).
  • Updates Jobs.razor to 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;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
editFetchDetailsAutoCloseSeconds = settings.FetchDetailsAutoCloseSeconds > 0 ? settings.FetchDetailsAutoCloseSeconds : 30;
editFetchDetailsAutoCloseSeconds = settings.FetchDetailsAutoCloseSeconds > 0
? Math.Clamp(settings.FetchDetailsAutoCloseSeconds, 5, 300)
: 30;

Copilot uses AI. Check for mistakes.
private async Task OpenTabAndAutoClose(string url, int? delaySeconds = null)
{
await JSRuntime.InvokeVoidAsync("crawlPagesRunner.openAndScheduleClose", url, delaySeconds, true);
var delay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds;
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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.

Suggested change
var delay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds;
var configuredDelay = delaySeconds ?? SettingsService.GetSettings().FetchDetailsAutoCloseSeconds;
var delay = Math.Clamp(configuredDelay, 5, 300);

Copilot uses AI. Check for mistakes.
Comment thread Models/AppSettings.cs
Comment on lines 45 to 49
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();
Copy link

Copilot AI Apr 8, 2026

Choose a reason for hiding this comment

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

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.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants