mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
fix(web): Handle duplicate library settings gracefully (#6950)
* don't add duplicate import paths * improve library import paths form * same for exclusion patterns * remove newline
This commit is contained in:
parent
90a7f16817
commit
b67fddf4b8
4 changed files with 78 additions and 24 deletions
|
|
@ -48,13 +48,16 @@
|
|||
}
|
||||
|
||||
try {
|
||||
library.exclusionPatterns.push(exclusionPatternToAdd);
|
||||
exclusionPatternToAdd = '';
|
||||
|
||||
exclusionPatterns = library.exclusionPatterns;
|
||||
addExclusionPattern = false;
|
||||
// Check so that exclusion pattern isn't duplicated
|
||||
if (!library.exclusionPatterns.includes(exclusionPatternToAdd)) {
|
||||
library.exclusionPatterns.push(exclusionPatternToAdd);
|
||||
exclusionPatterns = library.exclusionPatterns;
|
||||
}
|
||||
} catch (error) {
|
||||
handleError(error, 'Unable to add exclude pattern');
|
||||
handleError(error, 'Unable to add exclusion pattern');
|
||||
} finally {
|
||||
exclusionPatternToAdd = '';
|
||||
addExclusionPattern = false;
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -102,6 +105,7 @@
|
|||
<LibraryExclusionPatternForm
|
||||
submitText="Add"
|
||||
bind:exclusionPattern={exclusionPatternToAdd}
|
||||
{exclusionPatterns}
|
||||
on:submit={handleAddExclusionPattern}
|
||||
on:cancel={() => {
|
||||
addExclusionPattern = false;
|
||||
|
|
@ -112,8 +116,9 @@
|
|||
{#if editExclusionPattern != undefined}
|
||||
<LibraryExclusionPatternForm
|
||||
submitText="Save"
|
||||
canDelete={true}
|
||||
isEditing={true}
|
||||
bind:exclusionPattern={editedExclusionPattern}
|
||||
{exclusionPatterns}
|
||||
on:submit={handleEditExclusionPattern}
|
||||
on:delete={handleDeleteExclusionPattern}
|
||||
on:cancel={() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue