Update metadata visualisation through the websocket

This commit is contained in:
yannfrendo
2023-11-24 11:34:33 +01:00
parent 0ac9f152cf
commit d1b96967ee
3 changed files with 18 additions and 17 deletions
@@ -1,7 +1,9 @@
<script lang="ts">
import { websocketStore } from '$lib/stores/websocket';
import { AssetStore } from '$lib/stores/assets.store';
import { notificationController, NotificationType } from './notification/notification';
let assetStore = new AssetStore(/* vos options ici */);
let assetUpdateCount = 0;
let lastAssetName;
let timeoutId;
@@ -10,12 +12,15 @@
if (value && value.originalFileName) {
lastAssetName = value.originalFileName;
assetUpdateCount++;
assetStore.updateAsset(value);
clearTimeout(timeoutId);
timeoutId = setTimeout(() => {
if (assetUpdateCount === 1) {
notificationController.show({
message: `Asset updated: ${lastAssetName}.\nPlease reload to apply changes`,
message: `Asset updated: ${lastAssetName}.`,
type: NotificationType.Info,
});
} else {