fix progress bar incorrect when upload file twice

This commit is contained in:
potats0 2021-10-14 12:22:15 +08:00
parent 15faca6d89
commit 56384fbcc0
2 changed files with 5 additions and 1 deletions

View File

@ -111,7 +111,7 @@
/>
</mat-form-field>
<div *ngIf="uploadedFile">
<mat-progress-bar mode="determinate" [value]="uploader.progress" ></mat-progress-bar>
<mat-progress-bar mode="determinate" [value]="uploadProgress" aria-valuemin="0" aria-valuemax="100"></mat-progress-bar>
</div>
</div>
</form>

View File

@ -33,6 +33,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
qemuTemplate: QemuTemplate;
uploader: FileUploader;
uploadedFile: boolean = false;
uploadProgress: number = 0;
nameForm: FormGroup;
memoryForm: FormGroup;
@ -87,6 +88,9 @@ export class AddQemuVmTemplateComponent implements OnInit {
});
this.toasterService.success('Image uploaded');
};
this.uploader.onProgressItem = (progress: any) => {
this.uploadProgress = progress['progress'];
};
const server_id = this.route.snapshot.paramMap.get('server_id');
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {