mirror of
https://code.equilibrium.co.ao/ITO/doneit-web.git
synced 2026-04-19 21:06:06 +00:00
dix bugs
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<!-- <div class="back-icon">
|
||||
<ion-icon class="font-35-rem" (click)="goBack()" slot="end" src='assets/images/icons-arrow-arrow-left.svg'></ion-icon>
|
||||
</div> -->
|
||||
<div class="div-title" (click)="uploadChunk()">
|
||||
<div class="div-title" >
|
||||
<ion-label class="title">{{ publicationTitle }}</ion-label> <br>
|
||||
<i style="margin-top: -3px; font-size: 15px;"> Campos marcados com * são obrigatórios</i>
|
||||
</div>
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
<div *ngIf="publicationType!='1'" class="ion-item-container"
|
||||
[class.input-error]="Form?.get('Subject')?.invalid && validateFrom ">
|
||||
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Title" name="title"
|
||||
<ion-input autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="publicationFormMV.form.Title" name="title"
|
||||
placeholder="Título*"></ion-input>
|
||||
</div>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
</div>
|
||||
<div class="ion-textarea-class flex-grow-1"
|
||||
[class.input-error]="Form?.get('Message')?.invalid && validateFrom ">
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="pub.Message"
|
||||
<ion-textarea autocomplete="on" autocorrect="on" spellcheck="true" [(ngModel)]="publicationFormMV.form.Message"
|
||||
name="description" ngDefaultControl rows="12" cols="20" placeholder="Corpo de texto*"></ion-textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,12 +40,12 @@
|
||||
|
||||
|
||||
<!-- Captured -->
|
||||
<div *ngIf="seletedContent.length > 0">
|
||||
<div *ngIf="publicationFormMV.form.Files.length > 0">
|
||||
<ion-label class="attached-title pb-10">Anexos</ion-label>
|
||||
<div>
|
||||
<div class="d-flex" >
|
||||
|
||||
<div *ngFor="let seleted of seletedContent.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
||||
<div *ngFor="let seleted of publicationFormMV.form.Files.slice(0, displayLimit), let i = index" lot="start" class="mr-10">
|
||||
|
||||
<div>
|
||||
|
||||
@@ -80,10 +80,6 @@
|
||||
|
||||
</div>
|
||||
|
||||
<ion-label class="pl-10">
|
||||
<p>{{capturedImageTitle}}</p>
|
||||
<p hidden>size</p>
|
||||
</ion-label>
|
||||
</div>
|
||||
<!-- <button class="btn-no-color" (click)="clear()">
|
||||
<ion-icon name="close"></ion-icon>
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -21,6 +21,7 @@ export class UploadStreamingService {
|
||||
private CMAPIService: CMAPIService,
|
||||
private sanitizer: DomSanitizer
|
||||
) {
|
||||
this.CMAPIService
|
||||
window["sanitizer"] = this.sanitizer
|
||||
}
|
||||
}
|
||||
@@ -75,35 +76,38 @@ class UploadFileUseCase {
|
||||
|
||||
if(needUpload) {
|
||||
|
||||
// upload every chunk at onces
|
||||
const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||
// // upload every chunk at onces
|
||||
// const request = readAndUploadChunk(index).then(async(uploadRequest) => {
|
||||
|
||||
if(uploadRequest.isErr()) {
|
||||
connection = false
|
||||
const pingRequest = await this.CMAPIService.ping()
|
||||
if( pingRequest.isErr()) {
|
||||
errorMessage = UploadError.noConnection
|
||||
} else {
|
||||
errorMessage = UploadError.slow
|
||||
}
|
||||
}
|
||||
// if(uploadRequest.isErr()) {
|
||||
|
||||
})
|
||||
allRequest.push(request)
|
||||
// if(connection) {
|
||||
// connection = false
|
||||
// const pingRequest = await this.CMAPIService.ping()
|
||||
// if( pingRequest.isErr()) {
|
||||
// errorMessage = UploadError.noConnection
|
||||
// } else {
|
||||
// errorMessage = UploadError.slow
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
// })
|
||||
// allRequest.push(request)
|
||||
|
||||
// one by one chunk upload
|
||||
// const request = readAndUploadChunk(index)
|
||||
// allRequest.push(request)
|
||||
// const uploadRequest = await request
|
||||
const request = readAndUploadChunk(index)
|
||||
allRequest.push(request)
|
||||
const uploadRequest = await request
|
||||
|
||||
// if(uploadRequest.isErr()) {
|
||||
// const pingRequest = await this.CMAPIService.ping()
|
||||
// if( pingRequest.isErr()) {
|
||||
// return resolve(err(UploadError.noConnection))
|
||||
// } else {
|
||||
// return resolve(err(UploadError.slow))
|
||||
// }
|
||||
// }
|
||||
if(uploadRequest.isErr()) {
|
||||
const pingRequest = await this.CMAPIService.ping()
|
||||
if( pingRequest.isErr()) {
|
||||
return resolve(err(UploadError.noConnection))
|
||||
} else {
|
||||
return resolve(err(UploadError.slow))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -183,7 +187,7 @@ interface IPublicationFormModelEntity {
|
||||
Title: any
|
||||
Message: any
|
||||
DatePublication: any
|
||||
Files: PublicationAttachmentEntity[]
|
||||
Files?: PublicationAttachmentEntity[]
|
||||
}
|
||||
|
||||
interface PublicationAttachmentEntityParams {
|
||||
@@ -196,22 +200,24 @@ interface PublicationAttachmentEntityParams {
|
||||
|
||||
export class PublicationFormModel implements IPublicationFormModelEntity {
|
||||
constructor() {}
|
||||
DateIndex: any;
|
||||
DocumentId: any;
|
||||
ProcessId: any;
|
||||
DateIndex: any = new Date()
|
||||
DocumentId: any = null
|
||||
ProcessId: any = null
|
||||
Title: any;
|
||||
Message: any;
|
||||
DatePublication: any;
|
||||
DatePublication = new Date()
|
||||
OriginalFileName: string;
|
||||
Files: PublicationAttachmentEntity[];
|
||||
Files: PublicationAttachmentEntity[] = []
|
||||
|
||||
hasSet = false
|
||||
|
||||
setData(data: IPublicationFormModelEntity) {
|
||||
if(data.Files) {
|
||||
data.Files = []
|
||||
}
|
||||
if(!this.hasSet) {
|
||||
Object.assign(this, data)
|
||||
}
|
||||
|
||||
this.hasSet = true
|
||||
}
|
||||
}
|
||||
@@ -219,7 +225,7 @@ export class PublicationFormModel implements IPublicationFormModelEntity {
|
||||
export class PublicationFormMV {
|
||||
|
||||
private UploadFileUseCase = new UploadFileUseCase()
|
||||
private form = new PublicationFormModel()
|
||||
form = new PublicationFormModel()
|
||||
ObjectMergeNotification = new ObjectMergeNotification()
|
||||
|
||||
constructor() {
|
||||
@@ -329,6 +335,24 @@ export class PublicationFormMV {
|
||||
})
|
||||
|
||||
}
|
||||
|
||||
get uploadPercentage() {
|
||||
|
||||
const videosFiles = this.getVideoFiles()
|
||||
const percentageArray = videosFiles.map((e) => e.chucksManager.calculatePercentage())
|
||||
|
||||
// Check if the array is not empty
|
||||
if (percentageArray.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let sum = percentageArray.reduce((acc, percentage) => acc + percentage, 0);
|
||||
|
||||
// Calculate the average percentage
|
||||
let averagePercentage = sum / percentageArray.length;
|
||||
|
||||
return averagePercentage;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user