From 8bdae2381c3887804c92a953ce70bd5d5f2c480c Mon Sep 17 00:00:00 2001 From: Narfinger Date: Thu, 8 Aug 2024 14:12:25 +0900 Subject: [PATCH 1/4] Show error message when ItemIds are invalid instead of infinitely spinning --- src/components/mediaLibraryEditor/mediaLibraryEditor.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/components/mediaLibraryEditor/mediaLibraryEditor.js b/src/components/mediaLibraryEditor/mediaLibraryEditor.js index 00c2961b4e..4ba2e33dac 100644 --- a/src/components/mediaLibraryEditor/mediaLibraryEditor.js +++ b/src/components/mediaLibraryEditor/mediaLibraryEditor.js @@ -31,6 +31,14 @@ function onEditLibrary() { loading.show(); const dlg = dom.parentWithClass(this, 'dlg-libraryeditor'); let libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions')); + // when the library has moved or symlinked, the ItemId is not correct anymore + // this can lead to a forever spinning value on edit the library parameters + if (currentOptions.library.ItemId == undefined) { + toast('The library setting is in an invalid state, cannot edit. You are most likely suffering from a bug where the path in the database is not the absolute path in the filesystem'); + loading.hide(); + dialogHelper.close(dlg); + return false; + } libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions); ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions).then(() => { hasChanges = true; From 71afc176b023fcc3518bca44b3e50f5933d39eb4 Mon Sep 17 00:00:00 2001 From: Narfinger Date: Sat, 10 Aug 2024 19:25:53 +0900 Subject: [PATCH 2/4] Use alert for error message of invalid ItemId --- src/components/mediaLibraryEditor/mediaLibraryEditor.js | 7 +++++-- src/strings/en-us.json | 1 + 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/mediaLibraryEditor/mediaLibraryEditor.js b/src/components/mediaLibraryEditor/mediaLibraryEditor.js index 4ba2e33dac..a8ddfc3caa 100644 --- a/src/components/mediaLibraryEditor/mediaLibraryEditor.js +++ b/src/components/mediaLibraryEditor/mediaLibraryEditor.js @@ -18,6 +18,7 @@ import '../formdialog.scss'; import '../../elements/emby-toggle/emby-toggle'; import '../../styles/flexstyles.scss'; import './style.scss'; +import alert from '../alert'; import toast from '../toast/toast'; import confirm from '../confirm/confirm'; import template from './mediaLibraryEditor.template.html'; @@ -30,15 +31,17 @@ function onEditLibrary() { isCreating = true; loading.show(); const dlg = dom.parentWithClass(this, 'dlg-libraryeditor'); - let libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions')); // when the library has moved or symlinked, the ItemId is not correct anymore // this can lead to a forever spinning value on edit the library parameters if (currentOptions.library.ItemId == undefined) { - toast('The library setting is in an invalid state, cannot edit. You are most likely suffering from a bug where the path in the database is not the absolute path in the filesystem'); loading.hide(); dialogHelper.close(dlg); + alert({ + text: globalize.translate('LibraryInvalidItemIdError') + }); return false; } + let libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions')); libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions); ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions).then(() => { hasChanges = true; diff --git a/src/strings/en-us.json b/src/strings/en-us.json index 12023468eb..f15e68bed1 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -968,6 +968,7 @@ "LibraryAccessHelp": "Select the libraries to share with this user. Administrators will be able to edit all folders using the metadata manager.", "LibraryScanFanoutConcurrency": "Parallel library scan tasks limit", "LibraryScanFanoutConcurrencyHelp": "Maximum number of parallel tasks during library scans. Setting this to 0 will choose a limit based on your systems core count. WARNING: Setting this number too high may cause issues with network file systems; if you encounter problems lower this number.", + "LibraryInvalidItemIdError": "The library setting is in an invalid state and cannot be edited. You are most likely suffering from a bug where the path in the database is not the absolute path in the filesystem", "LimitSupportedVideoResolution": "Limit maximum supported video resolution", "LimitSupportedVideoResolutionHelp": "Use 'Maximum Allowed Video Transcoding Resolution' as maximum supported video resolution.", "List": "List", From d5778538a022a7ccfd9b69faeaa47bb3127cce4e Mon Sep 17 00:00:00 2001 From: Narfinger Date: Mon, 19 Aug 2024 15:35:45 +0900 Subject: [PATCH 3/4] Incorporate suggestion in mediaLibraryEditor.js Co-authored-by: Bill Thornton --- src/components/mediaLibraryEditor/mediaLibraryEditor.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/mediaLibraryEditor/mediaLibraryEditor.js b/src/components/mediaLibraryEditor/mediaLibraryEditor.js index a8ddfc3caa..d7c819e172 100644 --- a/src/components/mediaLibraryEditor/mediaLibraryEditor.js +++ b/src/components/mediaLibraryEditor/mediaLibraryEditor.js @@ -33,7 +33,7 @@ function onEditLibrary() { const dlg = dom.parentWithClass(this, 'dlg-libraryeditor'); // when the library has moved or symlinked, the ItemId is not correct anymore // this can lead to a forever spinning value on edit the library parameters - if (currentOptions.library.ItemId == undefined) { + if (!currentOptions.library.ItemId) { loading.hide(); dialogHelper.close(dlg); alert({ From fb82c2535886ad3ee361c087e42364915db49e67 Mon Sep 17 00:00:00 2001 From: Narfinger Date: Tue, 27 Aug 2024 10:35:47 +0900 Subject: [PATCH 4/4] Update src/strings/en-us.json Co-authored-by: Bill Thornton --- src/strings/en-us.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/strings/en-us.json b/src/strings/en-us.json index f15e68bed1..d9e14506d7 100644 --- a/src/strings/en-us.json +++ b/src/strings/en-us.json @@ -968,7 +968,7 @@ "LibraryAccessHelp": "Select the libraries to share with this user. Administrators will be able to edit all folders using the metadata manager.", "LibraryScanFanoutConcurrency": "Parallel library scan tasks limit", "LibraryScanFanoutConcurrencyHelp": "Maximum number of parallel tasks during library scans. Setting this to 0 will choose a limit based on your systems core count. WARNING: Setting this number too high may cause issues with network file systems; if you encounter problems lower this number.", - "LibraryInvalidItemIdError": "The library setting is in an invalid state and cannot be edited. You are most likely suffering from a bug where the path in the database is not the absolute path in the filesystem", + "LibraryInvalidItemIdError": "The library is in an invalid state and cannot be edited. You are possibly encountering a bug: the path in the database is not the correct path on the filesystem.", "LimitSupportedVideoResolution": "Limit maximum supported video resolution", "LimitSupportedVideoResolutionHelp": "Use 'Maximum Allowed Video Transcoding Resolution' as maximum supported video resolution.", "List": "List",