Update metadata visualisation through the websocket
This commit is contained in:
@@ -166,7 +166,12 @@ export class JobService {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case JobName.METADATA_EXTRACTION:
|
case JobName.METADATA_EXTRACTION:
|
||||||
|
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 });
|
await this.jobRepository.queue({ name: JobName.LINK_LIVE_PHOTOS, data: item.data });
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JobName.LINK_LIVE_PHOTOS:
|
case JobName.LINK_LIVE_PHOTOS:
|
||||||
@@ -215,14 +220,6 @@ export class JobService {
|
|||||||
this.communicationRepository.send(CommunicationEvent.UPLOAD_SUCCESS, asset.ownerId, mapAsset(asset));
|
this.communicationRepository.send(CommunicationEvent.UPLOAD_SUCCESS, asset.ownerId, mapAsset(asset));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
case JobName.SIDECAR_WRITE: {
|
|
||||||
const [asset] = await this.assetRepository.getByIds([item.data.id]);
|
|
||||||
if (asset) {
|
|
||||||
this.communicationRepository.send(CommunicationEvent.ASSET_UPDATE, asset.ownerId, mapAsset(asset));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// In addition to the above jobs, all of these should queue `SEARCH_INDEX_ASSET`
|
// In addition to the above jobs, all of these should queue `SEARCH_INDEX_ASSET`
|
||||||
|
|||||||
@@ -20,12 +20,9 @@
|
|||||||
mdiMapMarkerOutline,
|
mdiMapMarkerOutline,
|
||||||
mdiInformationOutline,
|
mdiInformationOutline,
|
||||||
} from '@mdi/js';
|
} from '@mdi/js';
|
||||||
import {
|
|
||||||
notificationController,
|
|
||||||
NotificationType,
|
|
||||||
} from '$lib/components/shared-components/notification/notification';
|
|
||||||
import Icon from '$lib/components/elements/icon.svelte';
|
import Icon from '$lib/components/elements/icon.svelte';
|
||||||
import Map from '../shared-components/map/map.svelte';
|
import Map from '../shared-components/map/map.svelte';
|
||||||
|
import { websocketStore } from '$lib/stores/websocket';
|
||||||
import { AppRoute } from '$lib/constants';
|
import { AppRoute } from '$lib/constants';
|
||||||
import ChangeLocation from '../shared-components/change-location.svelte';
|
import ChangeLocation from '../shared-components/change-location.svelte';
|
||||||
import { handleError } from '../../utils/handle-error';
|
import { handleError } from '../../utils/handle-error';
|
||||||
@@ -60,6 +57,12 @@
|
|||||||
|
|
||||||
$: people = asset.people || [];
|
$: people = asset.people || [];
|
||||||
|
|
||||||
|
const subscribe = websocketStore.onAssetUpdate.subscribe(assetUpdate => {
|
||||||
|
if (assetUpdate && assetUpdate.id === asset.id) {
|
||||||
|
asset = assetUpdate;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
const dispatch = createEventDispatcher();
|
const dispatch = createEventDispatcher();
|
||||||
|
|
||||||
const getMegapixel = (width: number, height: number): number | undefined => {
|
const getMegapixel = (width: number, height: number): number | undefined => {
|
||||||
@@ -101,10 +104,6 @@
|
|||||||
|
|
||||||
async function handleConfirmChangeDate(dateTimeOriginal: string) {
|
async function handleConfirmChangeDate(dateTimeOriginal: string) {
|
||||||
isShowChangeDate = false;
|
isShowChangeDate = false;
|
||||||
if (asset.exifInfo) {
|
|
||||||
asset.exifInfo.dateTimeOriginal = dateTimeOriginal;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await api.assetApi.updateAsset({ id: asset.id, updateAssetDto: { dateTimeOriginal } });
|
await api.assetApi.updateAsset({ id: asset.id, updateAssetDto: { dateTimeOriginal } });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { websocketStore } from '$lib/stores/websocket';
|
import { websocketStore } from '$lib/stores/websocket';
|
||||||
|
import { AssetStore } from '$lib/stores/assets.store';
|
||||||
import { notificationController, NotificationType } from './notification/notification';
|
import { notificationController, NotificationType } from './notification/notification';
|
||||||
|
|
||||||
|
let assetStore = new AssetStore(/* vos options ici */);
|
||||||
let assetUpdateCount = 0;
|
let assetUpdateCount = 0;
|
||||||
let lastAssetName;
|
let lastAssetName;
|
||||||
let timeoutId;
|
let timeoutId;
|
||||||
@@ -10,12 +12,15 @@
|
|||||||
if (value && value.originalFileName) {
|
if (value && value.originalFileName) {
|
||||||
lastAssetName = value.originalFileName;
|
lastAssetName = value.originalFileName;
|
||||||
assetUpdateCount++;
|
assetUpdateCount++;
|
||||||
|
|
||||||
|
assetStore.updateAsset(value);
|
||||||
|
|
||||||
clearTimeout(timeoutId);
|
clearTimeout(timeoutId);
|
||||||
timeoutId = setTimeout(() => {
|
timeoutId = setTimeout(() => {
|
||||||
if (assetUpdateCount === 1) {
|
if (assetUpdateCount === 1) {
|
||||||
|
|
||||||
notificationController.show({
|
notificationController.show({
|
||||||
message: `Asset updated: ${lastAssetName}.\nPlease reload to apply changes`,
|
message: `Asset updated: ${lastAssetName}.`,
|
||||||
type: NotificationType.Info,
|
type: NotificationType.Info,
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user