Browse Source

Remove everything related to websocket

yannfrendo 1 year ago
parent
commit
14bcb9e1e4

+ 0 - 6
server/src/domain/job/job.service.ts

@@ -172,12 +172,6 @@ export class JobService {
         });
 
       case JobName.METADATA_EXTRACTION:
-        if (item.data.source === 'sidecar-write') {
-          const [asset] = await this.assetRepository.getByIds([item.data.id]);
-          if (asset) {
-            this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, asset.ownerId, mapAsset(asset));
-          }
-        }
         await this.jobRepository.queue({ name: JobName.LINK_LIVE_PHOTOS, data: item.data });
         break;
 

+ 0 - 2
web/src/lib/components/album-page/album-viewer.svelte

@@ -20,7 +20,6 @@
   import ThemeButton from '../shared-components/theme-button.svelte';
   import { shouldIgnoreShortcut } from '$lib/utils/shortcut';
   import { mdiFileImagePlusOutline, mdiFolderDownloadOutline } from '@mdi/js';
-  import UpdatePanel from '../shared-components/update-panel.svelte';
 
   export let sharedLink: SharedLinkResponseDto;
   export let user: UserResponseDto | undefined = undefined;
@@ -168,5 +167,4 @@
       </p>
     </section>
   </AssetGrid>
-  <UpdatePanel {assetStore} />
 </main>

+ 10 - 12
web/src/lib/components/asset-viewer/detail-panel.svelte

@@ -5,7 +5,7 @@
   import { getAssetFilename } from '$lib/utils/asset-utils';
   import { AlbumResponseDto, AssetResponseDto, ThumbnailFormat, api } from '@api';
   import { DateTime } from 'luxon';
-  import { createEventDispatcher, onDestroy } from 'svelte';
+  import { createEventDispatcher } from 'svelte';
   import { slide } from 'svelte/transition';
   import { asByteUnitString } from '../../utils/byte-units';
   import ImageThumbnail from '../assets/thumbnail/image-thumbnail.svelte';
@@ -22,10 +22,10 @@
   } from '@mdi/js';
   import Icon from '$lib/components/elements/icon.svelte';
   import Map from '../shared-components/map/map.svelte';
-  import { websocketStore } from '$lib/stores/websocket';
   import { AppRoute } from '$lib/constants';
   import ChangeLocation from '../shared-components/change-location.svelte';
   import { handleError } from '../../utils/handle-error';
+  import { notificationController, NotificationType } from '../shared-components/notification/notification';
 
   export let asset: AssetResponseDto;
   export let albums: AlbumResponseDto[] = [];
@@ -57,16 +57,6 @@
 
   $: people = asset.people || [];
 
-  const unsubscribe = websocketStore.onAssetUpdate.subscribe((assetUpdate) => {
-    if (assetUpdate && assetUpdate.id === asset.id) {
-      asset = assetUpdate;
-    }
-  });
-
-  onDestroy(() => {
-    unsubscribe();
-  });
-
   const dispatch = createEventDispatcher();
 
   const getMegapixel = (width: number, height: number): number | undefined => {
@@ -110,6 +100,10 @@
     isShowChangeDate = false;
     try {
       await api.assetApi.updateAsset({ id: asset.id, updateAssetDto: { dateTimeOriginal } });
+      notificationController.show({
+        message: 'The date has been changed successfully, please reload to see the changes.',
+        type: NotificationType.Info,
+      });
     } catch (error) {
       handleError(error, 'Unable to change date');
     }
@@ -128,6 +122,10 @@
           longitude: gps.lng,
         },
       });
+      notificationController.show({
+        message: 'The location has been changed successfully, please reload to see the changes.',
+        type: NotificationType.Info,
+      });
     } catch (error) {
       handleError(error, 'Unable to change location');
     }

+ 4 - 1
web/src/lib/components/photos-page/actions/change-date-action.svelte

@@ -24,7 +24,10 @@
       await api.assetApi.updateAssets({
         assetBulkUpdateDto: { ids, dateTimeOriginal },
       });
-      notificationController.show({ message: 'Updating date please wait', type: NotificationType.Info });
+      notificationController.show({
+        message: 'Updating date you can reload to see change',
+        type: NotificationType.Info,
+      });
     } catch (error) {
       handleError(error, 'Unable to change date');
     }

+ 4 - 1
web/src/lib/components/photos-page/actions/change-location-action.svelte

@@ -28,7 +28,10 @@
           longitude: point.lng,
         },
       });
-      notificationController.show({ message: 'Updating location please wait', type: NotificationType.Info });
+      notificationController.show({
+        message: 'Updating location you can reload to see change',
+        type: NotificationType.Info,
+      });
     } catch (error) {
       handleError(error, 'Unable to update location');
     }

+ 0 - 38
web/src/lib/components/shared-components/update-panel.svelte

@@ -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>

+ 0 - 3
web/src/routes/(user)/albums/[albumId]/+page.svelte

@@ -58,7 +58,6 @@
   import ActivityStatus from '$lib/components/asset-viewer/activity-status.svelte';
   import { numberOfComments, setNumberOfComments, updateNumberOfComments } from '$lib/stores/activity.store';
   import AlbumOptions from '$lib/components/album-page/album-options.svelte';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
 
   export let data: PageData;
 
@@ -755,5 +754,3 @@
     on:save={({ detail: description }) => handleUpdateDescription(description)}
   />
 {/if}
-
-<UpdatePanel {assetStore} />

+ 0 - 2
web/src/routes/(user)/archive/+page.svelte

@@ -16,7 +16,6 @@
   import { AssetStore } from '$lib/stores/assets.store';
   import type { PageData } from './$types';
   import { mdiPlus, mdiDotsVertical } from '@mdi/js';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
 
   export let data: PageData;
 
@@ -53,4 +52,3 @@
     />
   </AssetGrid>
 </UserPageLayout>
-<UpdatePanel {assetStore} />

+ 0 - 2
web/src/routes/(user)/favorites/+page.svelte

@@ -18,7 +18,6 @@
   import { AssetStore } from '$lib/stores/assets.store';
   import type { PageData } from './$types';
   import { mdiDotsVertical, mdiPlus } from '@mdi/js';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
 
   export let data: PageData;
 
@@ -58,4 +57,3 @@
     />
   </AssetGrid>
 </UserPageLayout>
-<UpdatePanel {assetStore} />

+ 0 - 3
web/src/routes/(user)/partners/[userId]/+page.svelte

@@ -13,8 +13,6 @@
   import { onDestroy } from 'svelte';
   import type { PageData } from './$types';
   import { mdiPlus, mdiArrowLeft } from '@mdi/js';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
-
   export let data: PageData;
 
   const assetStore = new AssetStore({ userId: data.partner.id, isArchived: false, withStacked: true });
@@ -46,5 +44,4 @@
     </ControlAppBar>
   {/if}
   <AssetGrid {assetStore} {assetInteractionStore} />
-  <UpdatePanel {assetStore} />
 </main>

+ 0 - 2
web/src/routes/(user)/photos/+page.svelte

@@ -23,7 +23,6 @@
   import type { PageData } from './$types';
   import { assetViewingStore } from '$lib/stores/asset-viewing.store';
   import { mdiDotsVertical, mdiPlus } from '@mdi/js';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
 
   export let data: PageData;
 
@@ -98,4 +97,3 @@
     />
   </AssetGrid>
 </UserPageLayout>
-<UpdatePanel {assetStore} />

+ 0 - 2
web/src/routes/(user)/trash/+page.svelte

@@ -23,7 +23,6 @@
   import empty3Url from '$lib/assets/empty-3.svg';
   import ConfirmDialogue from '$lib/components/shared-components/confirm-dialogue.svelte';
   import { mdiDeleteOutline, mdiHistory } from '@mdi/js';
-  import UpdatePanel from '$lib/components/shared-components/update-panel.svelte';
 
   export let data: PageData;
 
@@ -114,4 +113,3 @@
     </svelte:fragment>
   </ConfirmDialogue>
 {/if}
-<UpdatePanel {assetStore} />