Skip to content

Commit ff30e08

Browse files
committed
Add unsaved changes check for Prowlarr navigation and update settings forms handling
- Implemented a check for unsaved changes when navigating away from the Prowlarr section, prompting users to save their changes. - Updated the settings forms to include Prowlarr in the unsaved changes detection logic, enhancing user experience and preventing data loss. - Disabled Prowlarr by default in the configuration to reflect updated application behavior.
1 parent f30c2b0 commit ff30e08

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

frontend/static/js/new-main.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -489,6 +489,14 @@ let huntarrUI = {
489489
}
490490
}
491491

492+
// Check for unsaved Prowlarr changes if leaving Prowlarr section
493+
if (this.currentSection === 'prowlarr' && window.SettingsForms && typeof window.SettingsForms.checkUnsavedChanges === 'function') {
494+
if (!window.SettingsForms.checkUnsavedChanges()) {
495+
console.log(`[huntarrUI] Navigation cancelled due to unsaved Prowlarr changes`);
496+
return; // User chose to stay and save changes
497+
}
498+
}
499+
492500
console.log(`[huntarrUI] User switching from ${this.currentSection} to ${section}, refreshing page...`);
493501
// Store the target section in localStorage so we can navigate to it after refresh
494502
localStorage.setItem('huntarr-target-section', section);

frontend/static/js/settings_forms.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5633,7 +5633,7 @@ const SettingsForms = {
56335633
window.huntarrBeforeUnloadListener = function(e) {
56345634
if (window.swaparrUnsavedChanges || window.settingsUnsavedChanges || window.notificationsUnsavedChanges ||
56355635
window.sonarrUnsavedChanges || window.radarrUnsavedChanges || window.lidarrUnsavedChanges ||
5636-
window.readarrUnsavedChanges || window.whisparrUnsavedChanges || window.erosUnsavedChanges) {
5636+
window.readarrUnsavedChanges || window.whisparrUnsavedChanges || window.erosUnsavedChanges || window.prowlarrUnsavedChanges) {
56375637
e.preventDefault();
56385638
e.returnValue = ''; // Standard way to trigger browser warning
56395639
return ''; // For older browsers

src/primary/default_configs/prowlarr.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@
22
"name": "Prowlarr",
33
"api_url": "",
44
"api_key": "",
5-
"enabled": true
5+
"enabled": false
66
}

0 commit comments

Comments
 (0)