mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 04:57:52 +00:00
fix publication load and expediente
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user