mirror of
https://github.com/immich-app/immich.git
synced 2025-12-18 17:23:16 +03:00
refactor(server): library syncing (#12220)
* refactor: library scanning fix tests remove offline files step cleanup library service improve tests cleanup tests add db migration fix e2e cleanup openapi fix tests fix tests update docs update docs update mobile code fix formatting don't remove assets from library with invalid import path use trash for offline files add migration simplify scan endpoint cleanup library panel fix library tests e2e lint fix e2e trash e2e fix lint add asset trash tests add more tests ensure thumbs are generated cleanup svelte cleanup queue names fix tests fix lint add warning due to trash fix trash tests fix lint fix tests Admin message for offline asset fix comments Update web/src/lib/components/asset-viewer/asset-viewer-nav-bar.svelte Co-authored-by: Daniel Dietzler <36593685+danieldietzler@users.noreply.github.com> add permission to library scan endpoint revert asset interface sort add trash reason to shared link stub improve path view in offline update docs improve trash performance fix comments remove stray comment * refactor: add back isOffline and remove trashReason from asset, change sync job flow * chore(server): drop coverage to 80% for functions * chore: rebase and generated files --------- Co-authored-by: Zack Pollard <zackpollard@ymail.com>
This commit is contained in:
committed by
GitHub
parent
1ef2834603
commit
b2f2be3485
@@ -20,7 +20,6 @@
|
||||
getAllLibraries,
|
||||
getLibraryStatistics,
|
||||
getUserAdmin,
|
||||
removeOfflineFiles,
|
||||
scanLibrary,
|
||||
updateLibrary,
|
||||
type LibraryResponseDto,
|
||||
@@ -122,7 +121,7 @@
|
||||
const handleScanAll = async () => {
|
||||
try {
|
||||
for (const library of libraries) {
|
||||
await scanLibrary({ id: library.id, scanLibraryDto: {} });
|
||||
await scanLibrary({ id: library.id });
|
||||
}
|
||||
notificationController.show({
|
||||
message: $t('admin.refreshing_all_libraries'),
|
||||
@@ -135,9 +134,9 @@
|
||||
|
||||
const handleScan = async (libraryId: string) => {
|
||||
try {
|
||||
await scanLibrary({ id: libraryId, scanLibraryDto: {} });
|
||||
await scanLibrary({ id: libraryId });
|
||||
notificationController.show({
|
||||
message: $t('admin.scanning_library_for_new_files'),
|
||||
message: $t('admin.scanning_library'),
|
||||
type: NotificationType.Info,
|
||||
});
|
||||
} catch (error) {
|
||||
@@ -145,42 +144,6 @@
|
||||
}
|
||||
};
|
||||
|
||||
const handleScanChanges = async (libraryId: string) => {
|
||||
try {
|
||||
await scanLibrary({ id: libraryId, scanLibraryDto: { refreshModifiedFiles: true } });
|
||||
notificationController.show({
|
||||
message: $t('admin.scanning_library_for_changed_files'),
|
||||
type: NotificationType.Info,
|
||||
});
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_scan_library'));
|
||||
}
|
||||
};
|
||||
|
||||
const handleForceScan = async (libraryId: string) => {
|
||||
try {
|
||||
await scanLibrary({ id: libraryId, scanLibraryDto: { refreshAllFiles: true } });
|
||||
notificationController.show({
|
||||
message: $t('admin.forcing_refresh_library_files'),
|
||||
type: NotificationType.Info,
|
||||
});
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_scan_library'));
|
||||
}
|
||||
};
|
||||
|
||||
const handleRemoveOffline = async (libraryId: string) => {
|
||||
try {
|
||||
await removeOfflineFiles({ id: libraryId });
|
||||
notificationController.show({
|
||||
message: $t('admin.removing_offline_files'),
|
||||
type: NotificationType.Info,
|
||||
});
|
||||
} catch (error) {
|
||||
handleError(error, $t('errors.unable_to_remove_offline_files'));
|
||||
}
|
||||
};
|
||||
|
||||
const onRenameClicked = (index: number) => {
|
||||
closeAll();
|
||||
renameLibrary = index;
|
||||
@@ -193,7 +156,7 @@
|
||||
updateLibraryIndex = index;
|
||||
};
|
||||
|
||||
const onScanNewLibraryClicked = async (library: LibraryResponseDto) => {
|
||||
const onScanClicked = async (library: LibraryResponseDto) => {
|
||||
closeAll();
|
||||
|
||||
if (library) {
|
||||
@@ -207,27 +170,6 @@
|
||||
updateLibraryIndex = index;
|
||||
};
|
||||
|
||||
const onScanAllLibraryFilesClicked = async (library: LibraryResponseDto) => {
|
||||
closeAll();
|
||||
if (library) {
|
||||
await handleScanChanges(library.id);
|
||||
}
|
||||
};
|
||||
|
||||
const onForceScanAllLibraryFilesClicked = async (library: LibraryResponseDto) => {
|
||||
closeAll();
|
||||
if (library) {
|
||||
await handleForceScan(library.id);
|
||||
}
|
||||
};
|
||||
|
||||
const onRemoveOfflineFilesClicked = async (library: LibraryResponseDto) => {
|
||||
closeAll();
|
||||
if (library) {
|
||||
await handleRemoveOffline(library.id);
|
||||
}
|
||||
};
|
||||
|
||||
const handleDelete = async (library: LibraryResponseDto, index: number) => {
|
||||
closeAll();
|
||||
|
||||
@@ -351,31 +293,17 @@
|
||||
icon={mdiDotsVertical}
|
||||
title={$t('library_options')}
|
||||
>
|
||||
<MenuOption onClick={() => onScanClicked(library)} text={$t('scan_library')} />
|
||||
<hr />
|
||||
<MenuOption onClick={() => onRenameClicked(index)} text={$t('rename')} />
|
||||
<MenuOption onClick={() => onEditImportPathClicked(index)} text={$t('edit_import_paths')} />
|
||||
<MenuOption onClick={() => onScanSettingClicked(index)} text={$t('scan_settings')} />
|
||||
<hr />
|
||||
<MenuOption onClick={() => onScanNewLibraryClicked(library)} text={$t('scan_new_library_files')} />
|
||||
<MenuOption
|
||||
onClick={() => onScanAllLibraryFilesClicked(library)}
|
||||
text={$t('scan_all_library_files')}
|
||||
subtitle={$t('only_refreshes_modified_files')}
|
||||
/>
|
||||
<MenuOption
|
||||
onClick={() => onForceScanAllLibraryFilesClicked(library)}
|
||||
text={$t('force_re-scan_library_files')}
|
||||
subtitle={$t('refreshes_every_file')}
|
||||
/>
|
||||
<hr />
|
||||
<MenuOption
|
||||
onClick={() => onRemoveOfflineFilesClicked(library)}
|
||||
text={$t('remove_offline_files')}
|
||||
/>
|
||||
<MenuOption
|
||||
text={$t('delete_library')}
|
||||
onClick={() => handleDelete(library, index)}
|
||||
activeColor="bg-red-200"
|
||||
textColor="text-red-600"
|
||||
onClick={() => handleDelete(library, index)}
|
||||
text={$t('delete_library')}
|
||||
/>
|
||||
</ButtonContextMenu>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user