Update timeline
This commit is contained in:
@@ -20,6 +20,7 @@
|
||||
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;
|
||||
@@ -167,4 +168,6 @@
|
||||
</p>
|
||||
</section>
|
||||
</AssetGrid>
|
||||
<UpdatePanel {assetStore} />
|
||||
|
||||
</main>
|
||||
|
||||
@@ -413,6 +413,7 @@
|
||||
{/if}
|
||||
</Portal>
|
||||
|
||||
|
||||
<style>
|
||||
#asset-grid {
|
||||
contain: layout;
|
||||
|
||||
@@ -1,21 +1,25 @@
|
||||
<script lang="ts">
|
||||
import { websocketStore } from '$lib/stores/websocket';
|
||||
import { AssetStore } from '$lib/stores/assets.store';
|
||||
import type { 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;
|
||||
|
||||
const subscribe = websocketStore.onAssetUpdate.subscribe(value => {
|
||||
if (value && value.originalFileName) {
|
||||
lastAssetName = value.originalFileName;
|
||||
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(value);
|
||||
assetStore.updateAsset(asset,true);
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
assetStore.removeAsset(asset.id); // Update timeline
|
||||
assetStore.addAsset(asset);
|
||||
|
||||
clearTimeout(timeoutId);
|
||||
timeoutId = setTimeout(() => {
|
||||
if (assetUpdateCount === 1) {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user