mirror of
https://github.com/immich-app/immich.git
synced 2024-11-15 18:08:48 -07:00
fix(web): Enhance Notification Handling for Duplicate Assets (#7858)
* Duplicate reporting in upload panel file-uploader.ts * Update upload-panel.svelte * Reimplement Error reporting upload-panel.svelte * Update upload-panel.svelte * Run Prettier again * Update web/src/lib/components/shared-components/upload-panel.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * Ran Prettier * Update web/src/lib/components/shared-components/upload-panel.svelte Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> * Run Prettier final * Update web/src/lib/components/shared-components/upload-panel.svelte Removed odd "``;" Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> --------- Co-authored-by: Michel Heusschen <59014050+michelheusschen@users.noreply.github.com> Co-authored-by: Alex Tran <alex.tran1502@gmail.com>
This commit is contained in:
parent
92804fe4b2
commit
a7efd66ae9
@ -34,21 +34,23 @@
|
|||||||
in:fade={{ duration: 250 }}
|
in:fade={{ duration: 250 }}
|
||||||
out:fade={{ duration: 250 }}
|
out:fade={{ duration: 250 }}
|
||||||
on:outroend={() => {
|
on:outroend={() => {
|
||||||
notificationController.show({
|
if ($errorCounter > 0) {
|
||||||
message:
|
notificationController.show({
|
||||||
($errorCounter > 0
|
message: `Upload completed with ${$errorCounter} error${$errorCounter > 1 ? 's' : ''}, refresh the page to see new upload assets.`,
|
||||||
? `Upload completed with ${$errorCounter} error${$errorCounter > 1 ? 's' : ''}`
|
type: NotificationType.Warning,
|
||||||
: 'Upload success') + ', refresh the page to see new upload assets.',
|
});
|
||||||
type: $errorCounter > 0 ? NotificationType.Warning : NotificationType.Info,
|
} else if ($successCounter > 0) {
|
||||||
});
|
notificationController.show({
|
||||||
|
message: 'Upload success, refresh the page to see new upload assets.',
|
||||||
|
type: NotificationType.Info,
|
||||||
|
});
|
||||||
|
}
|
||||||
if ($duplicateCounter > 0) {
|
if ($duplicateCounter > 0) {
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
message: `Skipped ${$duplicateCounter} duplicate asset${$duplicateCounter > 1 ? 's' : ''}`,
|
message: `Skipped ${$duplicateCounter} duplicate asset${$duplicateCounter > 1 ? 's' : ''}`,
|
||||||
type: NotificationType.Warning,
|
type: NotificationType.Warning,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadAssetsStore.resetStore();
|
uploadAssetsStore.resetStore();
|
||||||
}}
|
}}
|
||||||
class="absolute bottom-6 right-6 z-[10000]"
|
class="absolute bottom-6 right-6 z-[10000]"
|
||||||
|
@ -99,6 +99,8 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined
|
|||||||
|
|
||||||
if (res.duplicate) {
|
if (res.duplicate) {
|
||||||
uploadAssetsStore.duplicateCounter.update((count) => count + 1);
|
uploadAssetsStore.duplicateCounter.update((count) => count + 1);
|
||||||
|
} else {
|
||||||
|
uploadAssetsStore.successCounter.update((c) => c + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (albumId && res.id) {
|
if (albumId && res.id) {
|
||||||
@ -110,7 +112,6 @@ async function fileUploader(asset: File, albumId: string | undefined = undefined
|
|||||||
uploadAssetsStore.updateAsset(deviceAssetId, {
|
uploadAssetsStore.updateAsset(deviceAssetId, {
|
||||||
state: res.duplicate ? UploadState.DUPLICATED : UploadState.DONE,
|
state: res.duplicate ? UploadState.DUPLICATED : UploadState.DONE,
|
||||||
});
|
});
|
||||||
uploadAssetsStore.successCounter.update((c) => c + 1);
|
|
||||||
|
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
uploadAssetsStore.removeUploadAsset(deviceAssetId);
|
uploadAssetsStore.removeUploadAsset(deviceAssetId);
|
||||||
|
Loading…
Reference in New Issue
Block a user