1
0
mirror of https://github.com/immich-app/immich.git synced 2025-02-15 19:36:04 +02:00

Remove everything related to websocket

This commit is contained in:
yannfrendo 2023-11-29 17:03:19 +01:00
parent 72b8b2d281
commit 14bcb9e1e4
12 changed files with 18 additions and 74 deletions

View File

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

View File

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

View File

@ -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');
}

View File

@ -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');
}

View File

@ -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');
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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