removing console errors from iou & qemu template pages

This commit is contained in:
Piotr Pekala 2019-07-02 05:57:25 -07:00
parent 3d73703995
commit 383b246020
4 changed files with 7 additions and 8 deletions

View File

@ -16,7 +16,7 @@
<mat-step label="Name">
<form [formGroup]="templateNameForm">
<mat-form-field class="form-field">
<input matInput placeholder="Name" type="text" [(ngModel)]="iouTemplate.name" formControlName="templateName"/>
<input matInput placeholder="Name" type="text" formControlName="templateName"/>
</mat-form-field>
</form>
</mat-step>
@ -59,7 +59,6 @@
<input
matInput
type="text"
[(ngModel)]="iouTemplate.path"
formControlName="imageName"
placeholder="IOU image"/>
</mat-form-field>

View File

@ -82,6 +82,8 @@ export class AddIouTemplateComponent implements OnInit {
addTemplate() {
if (!this.templateNameForm.invalid && ((this.newImageSelected && !this.imageForm.invalid) || (!this.newImageSelected && this.iouTemplate.path))) {
this.iouTemplate.template_id = uuid();
this.iouTemplate.name = this.templateNameForm.get("templateName").value;
this.iouTemplate.path = this.imageForm.get("imageName").value;
this.iouService.addTemplate(this.server, this.iouTemplate).subscribe((template: IouTemplate) => {
this.goBack();

View File

@ -12,7 +12,6 @@
<mat-form-field class="form-field">
<input
matInput type="text"
[(ngModel)]="qemuTemplate.name"
formControlName="templateName"
placeholder="Please choose a descriptive name for your new QEMU virtual machine"
ngDefaultContro/>
@ -26,9 +25,9 @@
<form [formGroup]="memoryForm">
<mat-form-field class="form-field">
<mat-select
placeholder="Qemu binary"
placeholder="Qemu binary"
[(ngModel)]="selectedBinary"
formControlName="binary" >
[ngModelOptions]="{standalone: true}">
<mat-option *ngFor="let binary of qemuBinaries" [value]="binary">
{{binary.path}}
</mat-option>
@ -38,7 +37,6 @@
<input
matInput type="number"
placeholder="RAM"
[(ngModel)]="ramMemory"
formControlName="ramMemory"
ngDefaultContro/>
</mat-form-field>

View File

@ -51,7 +51,6 @@ export class AddQemuVmTemplateComponent implements OnInit {
});
this.memoryForm = this.formBuilder.group({
binary: new FormControl('', Validators.required),
ramMemory: new FormControl('', Validators.required)
});
@ -95,7 +94,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
addTemplate() {
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
this.qemuTemplate.ram = this.ramMemory;
this.qemuTemplate.ram = this.memoryForm.get("ramMemory").value;
this.qemuTemplate.qemu_path = this.selectedBinary.path;
if (this.newImageSelected) {
this.qemuTemplate.hda_disk_image = this.chosenImage;
@ -103,6 +102,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
this.qemuTemplate.hda_disk_image = this.selectedImage.path;
}
this.qemuTemplate.template_id = uuid();
this.qemuTemplate.name = this.nameForm.get("templateName").value();
this.qemuService.addTemplate(this.server, this.qemuTemplate).subscribe((template: QemuTemplate) => {
this.goBack();