-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
volar
committed
Nov 10, 2023
1 parent
61c6ca5
commit 53842fe
Showing
3 changed files
with
135 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
import type { CancelTokenSource } from 'axios' | ||
import type { DocId, DocIdNullable, IntegerId } from '@/types/common' | ||
import type { | ||
AssetExternalProviderIdNullable, | ||
AssetExternalProviderMetadata, | ||
DamAssetStatus, | ||
DamAssetType | ||
} from '@/types/coreDam/Asset' | ||
import type { AssetFileFailReason, Link } from '@/types/coreDam/AssetFile' | ||
|
||
export enum QueueItemType { | ||
File = 'file', | ||
Asset = 'asset', | ||
ExternalProviderAsset = 'externalProviderAsset', | ||
SlotFile = 'slotFile', | ||
} | ||
|
||
export enum UploadQueueItemStatus { | ||
Loading = 'loading', // loading additional api data | ||
Waiting = 'waiting', // waiting to be uploaded | ||
Uploading = 'uploading', // uploading right now | ||
Processing = 'processing', // all data sent by FE, server processing, waiting for notification, todo | ||
Failed = 'failed', // any error | ||
Uploaded = 'uploaded', // uploaded/ready after loading | ||
Stop = 'stop', // after hitting stop upload | ||
} | ||
|
||
export interface UploadQueueItemChunk { | ||
cancelTokenSource: CancelTokenSource | ||
} | ||
|
||
export interface UploadQueueItem { | ||
key: string | ||
file: File | null | ||
status: UploadQueueItemStatus | ||
assetStatus: DamAssetStatus | ||
isDuplicate: boolean | ||
type: QueueItemType | ||
assetType: DamAssetType | ||
displayTitle: string | ||
assetId: DocIdNullable | ||
duplicateAssetId: DocIdNullable | ||
fileId: DocIdNullable | ||
externalProviderAssetId: AssetExternalProviderIdNullable | ||
externalProviderName: string | null | ||
externalProviderMetadata: AssetExternalProviderMetadata | ||
chunks: UploadQueueItemChunk[] | ||
chunkSize: number | ||
currentChunkIndex: number | ||
chunkTotalCount: number | ||
licenceId: IntegerId | ||
imagePreview?: Link | ||
canEditMetadata: boolean | ||
keywords: DocId[] | ||
authors: DocId[] | ||
customData: any | ||
authorConflicts: DocId[] | ||
progress: { | ||
remainingTime: null | number | ||
progressPercent: null | number | ||
speed: null | number | ||
} | ||
error: { | ||
hasError: boolean | ||
message: string | ||
assetFileFailReason: AssetFileFailReason | ||
} | ||
notificationFallbackTimer: ReturnType<typeof setTimeout> | undefined | ||
notificationFallbackTry: number | ||
slotName: string | null | ||
} |