mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 13:02:56 +00:00
fix publication load and expediente
This commit is contained in:
@@ -114,7 +114,7 @@
|
||||
src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="attach-document cursor-pointer">
|
||||
<ion-label>Galeria</ion-label>
|
||||
<ion-label>Galeria 2</ion-label>
|
||||
</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
@@ -127,7 +127,7 @@
|
||||
src="assets/images/theme/gov/icons-add-photos.svg"></ion-icon>
|
||||
</div>
|
||||
<div class="attach-document cursor-pointer">
|
||||
<ion-label>Galeria</ion-label>
|
||||
<ion-label>Galeria 1</ion-label>
|
||||
</div>
|
||||
</ion-label>
|
||||
</div>
|
||||
|
||||
@@ -355,7 +355,7 @@ export class NewPublicationPage implements OnInit {
|
||||
const upload = await this.publicationFormMV.uploadVideosFiles()
|
||||
|
||||
if(upload) {
|
||||
this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity)=> {
|
||||
this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||
if(e.FileType == 'video' && e.blobFile && e.toUpload) {
|
||||
e.OriginalFileName = e?.chucksManager?.path?.replace(".mp4", "") || e.OriginalFileName
|
||||
e.FileExtension = "mp4"
|
||||
@@ -406,14 +406,17 @@ export class NewPublicationPage implements OnInit {
|
||||
|
||||
const upload = await this.publicationFormMV.uploadVideosFiles()
|
||||
|
||||
console.log({upload})
|
||||
|
||||
if(upload) {
|
||||
this.publicationFormMV.form.Files = this.publicationFormMV.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||
if(e.FileType == 'video' && e.blobFile && e.toUpload) {
|
||||
e.OriginalFileName = e.chucksManager.path.replace(".mp4", "")
|
||||
e.FileExtension = "mp4"
|
||||
e.Base64 = ''
|
||||
}
|
||||
|
||||
if(e.FileType == 'video' ) {
|
||||
if(e.FileType == 'video' && !e.toUpload) {
|
||||
e.Base64 = e.url
|
||||
}
|
||||
|
||||
@@ -454,6 +457,9 @@ export class NewPublicationPage implements OnInit {
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
this.toastService._badRequest("Tive um erro ao enviar o ficheiro")
|
||||
loader.remove()
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -129,6 +129,10 @@ export class ViewPublicationsPage implements OnInit {
|
||||
|
||||
this.stopVideo();
|
||||
|
||||
setTimeout(()=> {
|
||||
this.doRefresh({})
|
||||
}, 1500)
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user