mirror of https://github.com/immich-app/immich.git
Remove everything related to websocket
parent
72b8b2d281
commit
14bcb9e1e4
@ -1,38 +0,0 @@
|
|||||||
<script lang="ts">
|
|
||||||
import { websocketStore } from '$lib/stores/websocket';
|
|
||||||
import type { AssetStore } from '$lib/stores/assets.store';
|
|
||||||
import { notificationController, NotificationType } from './notification/notification';
|
|
||||||
|
|
||||||
export let assetStore: AssetStore | null;
|
|
||||||
let assetUpdateCount = 0;
|
|
||||||
let lastAssetName: string;
|
|
||||||
let timeoutId: string | number | NodeJS.Timeout | undefined;
|
|
||||||
|
|
||||||
websocketStore.onAssetUpdate.subscribe((asset) => {
|
|
||||||
if (asset && asset.originalFileName && assetStore) {
|
|
||||||
lastAssetName = asset.originalFileName;
|
|
||||||
assetUpdateCount++;
|
|
||||||
|
|
||||||
assetStore.updateAsset(asset, true);
|
|
||||||
|
|
||||||
assetStore.removeAsset(asset.id); // Update timeline
|
|
||||||
assetStore.addAsset(asset);
|
|
||||||
|
|
||||||
clearTimeout(timeoutId);
|
|
||||||
timeoutId = setTimeout(() => {
|
|
||||||
if (assetUpdateCount === 1) {
|
|
||||||
notificationController.show({
|
|
||||||
message: `Asset updated: ${lastAssetName}.`,
|
|
||||||
type: NotificationType.Info,
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
notificationController.show({
|
|
||||||
message: `${assetUpdateCount} assets updated.`,
|
|
||||||
type: NotificationType.Info,
|
|
||||||
});
|
|
||||||
}
|
|
||||||
assetUpdateCount = 0;
|
|
||||||
}, 500);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
Loading…
Reference in New Issue