Merge pull request #1199 from potats0/master

add progress bar when uploading qemu disks
This commit is contained in:
piotrpekala7 2021-11-07 13:54:30 -08:00 committed by GitHub
commit 4e42bd7a54
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -110,6 +110,9 @@
placeholder="Please enter name"
/>
</mat-form-field>
<div *ngIf="uploadedFile">
<mat-progress-bar mode="determinate" [value]="uploadProgress" aria-valuemin="0" aria-valuemax="100"></mat-progress-bar>
</div>
</div>
</form>
</mat-step>

View File

@ -32,6 +32,8 @@ export class AddQemuVmTemplateComponent implements OnInit {
chosenImage: string = '';
qemuTemplate: QemuTemplate;
uploader: FileUploader;
uploadedFile: boolean = false;
uploadProgress: number = 0;
nameForm: FormGroup;
memoryForm: FormGroup;
@ -86,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) => {
@ -127,6 +132,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
}
uploadImageFile(event) {
this.uploadedFile = true;
let name = event.target.files[0].name;
this.diskForm.controls['fileName'].setValue(name);