mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-18 12:37:53 +00:00
fix publication post
This commit is contained in:
@@ -30,6 +30,7 @@ export class PublicationHolderService {
|
||||
}
|
||||
|
||||
window['upload-header-set-add'] = (id: string, percentage: number, save: Function) => {
|
||||
this.remove(id)
|
||||
this.PublicationFormMV.push({id, percentage, retry: false, retryFunction: save})
|
||||
this.uploadPercentage()
|
||||
}
|
||||
|
||||
@@ -139,7 +139,7 @@ class ReconnectingWebSocketSignalR {
|
||||
if (!this.stop && (!error || error.message !== "Connection stopped by client.")) {
|
||||
setTimeout(() => {
|
||||
this.connect();
|
||||
}, 1000); // Ajuste o atraso conforme necessário
|
||||
}, 3000); // Ajuste o atraso conforme necessário
|
||||
|
||||
}
|
||||
|
||||
@@ -407,30 +407,16 @@ export class ObjectMergeNotification{
|
||||
|
||||
constructor() {
|
||||
this.socket.onDisconnectCallback(()=> {
|
||||
console.log("run watch")
|
||||
//console.log("run watch")
|
||||
this.runWatch = true
|
||||
this.watch()
|
||||
//this.watch()
|
||||
})
|
||||
|
||||
this.socket.onConnectCallback(()=> {
|
||||
|
||||
this.socket.onConnectCallback(() => {
|
||||
console.log("open trigger")
|
||||
this.runWatch = false
|
||||
})
|
||||
|
||||
// this.socket.subscribe((data: socketResponse) => {
|
||||
// if(data.IsCompleted == true) {
|
||||
// console.log("==================!!!====================")
|
||||
// try {
|
||||
// this.callbacks[data.Guid](data)
|
||||
// delete this.callbacks[data.Guid]
|
||||
// } catch (error) {}
|
||||
// } else {
|
||||
// console.log("else", data)
|
||||
// }
|
||||
// })
|
||||
|
||||
// this.watch()
|
||||
}
|
||||
|
||||
connect() {
|
||||
|
||||
@@ -43,8 +43,6 @@ export class PublicationFromMvService {
|
||||
|
||||
clear() {
|
||||
|
||||
|
||||
|
||||
this.id = uuidv4()
|
||||
this.UploadFileUseCase = new UploadFileUseCase()
|
||||
this.form = new PublicationFormModel()
|
||||
@@ -67,6 +65,8 @@ export class PublicationFromMvService {
|
||||
|
||||
save = async() => {
|
||||
|
||||
const needChunk = this.needToUploadChunk()
|
||||
|
||||
if (this.publicationType == ActionType.edit) {
|
||||
|
||||
if (this.form.Files.length >= 1) {
|
||||
@@ -75,6 +75,14 @@ export class PublicationFromMvService {
|
||||
this.form.send = true
|
||||
const upload = await this.uploadVideosFiles()
|
||||
|
||||
|
||||
const needChunk = this.needToUploadChunk()
|
||||
if(needChunk.length == 0 ) {
|
||||
window['upload-header-set-percentage'](this.id, 50)
|
||||
} else {
|
||||
window['upload-header-set-percentage'](this.id, 100)
|
||||
}
|
||||
|
||||
if(upload) {
|
||||
this.form.Files = this.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||
if(e.FileType == 'video' && e.toUpload) {
|
||||
@@ -100,14 +108,18 @@ export class PublicationFromMvService {
|
||||
|
||||
this.httpErroHandle.httpsSucessMessagge('Editar publicação')
|
||||
this.publicationFolderService.getPublicationsIds(this.folderId)
|
||||
window['upload-header-set-remove'](this.id);
|
||||
|
||||
// this.goBack();
|
||||
|
||||
} catch (error) {
|
||||
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
if (error.status == 404) {
|
||||
this.PublicationFolderService.deletePost(this.form.ProcessId, this.form.DocumentId)
|
||||
// this.goBack();
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
}
|
||||
} finally {
|
||||
// loader.remove()
|
||||
@@ -115,6 +127,7 @@ export class PublicationFromMvService {
|
||||
|
||||
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||
}
|
||||
|
||||
@@ -129,6 +142,13 @@ export class PublicationFromMvService {
|
||||
this.form.send = true
|
||||
const upload = await this.uploadVideosFiles()
|
||||
|
||||
const needChunk = this.needToUploadChunk()
|
||||
if(needChunk.length ==0 ) {
|
||||
window['upload-header-set-percentage'](this.id, 50)
|
||||
} else {
|
||||
window['upload-header-set-percentage'](this.id, 100)
|
||||
}
|
||||
|
||||
if(upload) {
|
||||
this.form.Files = this.form.Files.map((e:PublicationAttachmentEntity) => {
|
||||
if(e.FileType == 'video' && e.toUpload) {
|
||||
@@ -176,12 +196,14 @@ export class PublicationFromMvService {
|
||||
window['upload-header-set-remove'](this.id);
|
||||
this.publicationFolderService.getPublicationsIds(this.folderId)
|
||||
} catch (error) {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.httpErroHandle.httpStatusHandle(error)
|
||||
} finally {
|
||||
// loader.remove()
|
||||
}
|
||||
|
||||
} else {
|
||||
window['upload-header-set-retry'](this.id)
|
||||
this.toastService._badRequest("ocorreu um erro ao enviar o ficheiro")
|
||||
// loader.remove()
|
||||
}
|
||||
@@ -189,6 +211,7 @@ export class PublicationFromMvService {
|
||||
|
||||
|
||||
} else {
|
||||
|
||||
this.toastService._badRequest("É necessário adicionar uma imagem ou vídeo")
|
||||
}
|
||||
|
||||
@@ -200,6 +223,9 @@ export class PublicationFromMvService {
|
||||
}
|
||||
|
||||
|
||||
needToUploadChunk() {
|
||||
return this.form.Files.filter( e => e.FileType == "video" && e.toUpload)
|
||||
}
|
||||
|
||||
|
||||
setDataToFrom(data: IPublicationFormModelEntity) {
|
||||
|
||||
@@ -4,4 +4,4 @@ import { environment as oaprDev } from './suport/oapr'
|
||||
import { DevDev } from './suport/dev'
|
||||
|
||||
|
||||
export const environment: Environment = DevDev
|
||||
export const environment: Environment = oaprDev
|
||||
|
||||
Reference in New Issue
Block a user