diff --git a/server/src/domain/metadata/metadata.service.ts b/server/src/domain/metadata/metadata.service.ts index 62aaae4fd1..5a5b620d05 100644 --- a/server/src/domain/metadata/metadata.service.ts +++ b/server/src/domain/metadata/metadata.service.ts @@ -280,7 +280,7 @@ export class MetadataService { await this.assetRepository.save({ id, sidecarPath }); } - await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: { id: id } }); + await this.jobRepository.queue({ name: JobName.METADATA_EXTRACTION, data: { id } }); return true; } diff --git a/web/src/lib/components/asset-viewer/detail-panel.svelte b/web/src/lib/components/asset-viewer/detail-panel.svelte index f4f6e5e6be..149acc8a57 100644 --- a/web/src/lib/components/asset-viewer/detail-panel.svelte +++ b/web/src/lib/components/asset-viewer/detail-panel.svelte @@ -28,6 +28,7 @@ import Map from '../shared-components/map/map.svelte'; import { AppRoute } from '$lib/constants'; import ChangeLocation from '../shared-components/change-location.svelte'; + import { handleError } from '../../utils/handle-error'; export let asset: AssetResponseDto; export let albums: AlbumResponseDto[] = []; @@ -86,9 +87,7 @@ try { await api.assetApi.updateAsset({ id: asset.id, - updateAssetDto: { - description: description, - }, + updateAssetDto: { description }, }); } catch (error) { console.error(error); @@ -100,40 +99,36 @@ let isShowChangeDate = false; - async function handleConfirmChangeDate(event: CustomEvent) { + async function handleConfirmChangeDate(dateTimeOriginal: string) { isShowChangeDate = false; if (asset.exifInfo) { - asset.exifInfo.dateTimeOriginal = event.detail; + asset.exifInfo.dateTimeOriginal = dateTimeOriginal; } + try { - await api.assetApi.updateAsset({ - id: asset.id, - updateAssetDto: { - dateTimeOriginal: event.detail, - }, - }); + await api.assetApi.updateAsset({ id: asset.id, updateAssetDto: { dateTimeOriginal } }); notificationController.show({ message: 'Metadata updated please reload to apply', type: NotificationType.Info }); } catch (error) { - console.error(error); + handleError(error, 'Unable to change date'); } } let isShowChangeLocation = false; - async function handleConfirmChangeLocation(event: CustomEvent<{ lng: number; lat: number }>) { + async function handleConfirmChangeLocation(gps: { lng: number; lat: number }) { isShowChangeLocation = false; try { await api.assetApi.updateAsset({ id: asset.id, updateAssetDto: { - latitude: event.detail.lat, - longitude: event.detail.lng, + latitude: gps.lat, + longitude: gps.lng, }, }); notificationController.show({ message: 'Metadata updated please reload to apply', type: NotificationType.Info }); } catch (error) { - console.error(error); + handleError(error, 'Unable to change location'); } } @@ -307,34 +302,16 @@ {/if} {#if isShowChangeDate} - {#if asset.exifInfo?.dateTimeOriginal} - {@const assetDateTimeOriginal = DateTime.fromISO(asset.exifInfo.dateTimeOriginal, { - zone: asset.exifInfo.timeZone ?? undefined, - })} - (isShowChangeDate = false)} - > - -

Please select a new date:

-
-
- {:else} - (isShowChangeDate = false)} - > - -

Please select a new date:

-
-
- {/if} + {@const assetDateTimeOriginal = asset.exifInfo?.dateTimeOriginal + ? DateTime.fromISO(asset.exifInfo.dateTimeOriginal, { + zone: asset.exifInfo.timeZone ?? undefined, + }) + : DateTime.now()} + handleConfirmChangeDate(date)} + on:cancel={() => (isShowChangeDate = false)} + /> {/if} {#if asset.exifInfo?.fileSizeInByte} @@ -453,29 +430,11 @@ {/if} {#if isShowChangeLocation} - {#if latlng} - (isShowChangeLocation = false)} - > - -

Please select a new location:

-
-
- {:else} - (isShowChangeLocation = false)} - > - -

Please select a new location:

-
-
- {/if} + handleConfirmChangeLocation(gps)} + on:cancel={() => (isShowChangeLocation = false)} + /> {/if} diff --git a/web/src/lib/components/elements/buttons/link-button.svelte b/web/src/lib/components/elements/buttons/link-button.svelte index d5fe8b29b5..2cb22d41da 100644 --- a/web/src/lib/components/elements/buttons/link-button.svelte +++ b/web/src/lib/components/elements/buttons/link-button.svelte @@ -7,8 +7,9 @@ export let color: Color = 'transparent-gray'; export let disabled = false; + export let fullwidth = false; - diff --git a/web/src/lib/components/elements/dropdown.svelte b/web/src/lib/components/elements/dropdown.svelte index 65c551e432..d89847c209 100644 --- a/web/src/lib/components/elements/dropdown.svelte +++ b/web/src/lib/components/elements/dropdown.svelte @@ -60,7 +60,7 @@