fix publication load and expediente

This commit is contained in:
Peter Maquiran
2024-03-13 11:52:27 +01:00
parent 48d4cd637e
commit 7f2425ef1b
9 changed files with 2798 additions and 2760 deletions
@@ -240,13 +240,25 @@ export class PublicationFormMV {
return this.form.Files.filter( x => x.FileType == 'video')
}
async commit(PublicationAttachmentEntity: PublicationAttachmentEntity) {
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
if(mergeRequest.isOk()) {
PublicationAttachmentEntity.chucksManager.contentSetReady()
return true
} else {
return false
}
}
private upload(PublicationAttachmentEntity: PublicationAttachmentEntity) {
return new Promise(async (resolve, reject)=> {
if(!PublicationAttachmentEntity.hasChunkManger) {
const fileBlob = PublicationAttachmentEntity.blobFile;
const fileChunks = new Chunks({chunkSize: 400 })
const fileChunks = new Chunks({chunkSize: 50 })
fileChunks.setFile(fileBlob)
PublicationAttachmentEntity.setChunkManger(fileChunks)
@@ -276,20 +288,16 @@ export class PublicationFormMV {
resolve(false)
} else {
PublicationAttachmentEntity.chucksManager.doneChunkUpload()
const mergeRequest = await this.ObjectMergeNotification.socket.commit(PublicationAttachmentEntity.chucksManager.path)
if(mergeRequest.isOk()) {
PublicationAttachmentEntity.chucksManager.contentSetReady()
resolve(true)
} else {
resolve(false)
}
return await resolve(this.commit(PublicationAttachmentEntity))
}
} else {
} else if ( PublicationAttachmentEntity.chucksManager.contentReady == false) {
return await resolve(this.commit(PublicationAttachmentEntity))
} else {
console.log('already uploading')
}
})
@@ -413,6 +421,7 @@ export class ChucksManager {
contentReady = false
manualRetry = false
isUploading = false
needToCommit = true
subscribeToUseCaseResponse: Function[] = []
getUploadPercentage() {
@@ -531,6 +540,10 @@ export class ChucksManager {
this.onSetLastChunk.forEach(callback => callback());
}
doneCommit() {
this.needToCommit = false
}
contentSetReady() {
this.merging = false
this.contentReady = true