mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-17 06:18:09 +00:00
removing console errors from iou & qemu template pages
This commit is contained in:
@ -16,7 +16,7 @@
|
|||||||
<mat-step label="Name">
|
<mat-step label="Name">
|
||||||
<form [formGroup]="templateNameForm">
|
<form [formGroup]="templateNameForm">
|
||||||
<mat-form-field class="form-field">
|
<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>
|
</mat-form-field>
|
||||||
</form>
|
</form>
|
||||||
</mat-step>
|
</mat-step>
|
||||||
@ -59,7 +59,6 @@
|
|||||||
<input
|
<input
|
||||||
matInput
|
matInput
|
||||||
type="text"
|
type="text"
|
||||||
[(ngModel)]="iouTemplate.path"
|
|
||||||
formControlName="imageName"
|
formControlName="imageName"
|
||||||
placeholder="IOU image"/>
|
placeholder="IOU image"/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -82,6 +82,8 @@ export class AddIouTemplateComponent implements OnInit {
|
|||||||
addTemplate() {
|
addTemplate() {
|
||||||
if (!this.templateNameForm.invalid && ((this.newImageSelected && !this.imageForm.invalid) || (!this.newImageSelected && this.iouTemplate.path))) {
|
if (!this.templateNameForm.invalid && ((this.newImageSelected && !this.imageForm.invalid) || (!this.newImageSelected && this.iouTemplate.path))) {
|
||||||
this.iouTemplate.template_id = uuid();
|
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.iouService.addTemplate(this.server, this.iouTemplate).subscribe((template: IouTemplate) => {
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
@ -12,7 +12,6 @@
|
|||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<input
|
<input
|
||||||
matInput type="text"
|
matInput type="text"
|
||||||
[(ngModel)]="qemuTemplate.name"
|
|
||||||
formControlName="templateName"
|
formControlName="templateName"
|
||||||
placeholder="Please choose a descriptive name for your new QEMU virtual machine"
|
placeholder="Please choose a descriptive name for your new QEMU virtual machine"
|
||||||
ngDefaultContro/>
|
ngDefaultContro/>
|
||||||
@ -26,9 +25,9 @@
|
|||||||
<form [formGroup]="memoryForm">
|
<form [formGroup]="memoryForm">
|
||||||
<mat-form-field class="form-field">
|
<mat-form-field class="form-field">
|
||||||
<mat-select
|
<mat-select
|
||||||
placeholder="Qemu binary"
|
placeholder="Qemu binary"
|
||||||
[(ngModel)]="selectedBinary"
|
[(ngModel)]="selectedBinary"
|
||||||
formControlName="binary" >
|
[ngModelOptions]="{standalone: true}">
|
||||||
<mat-option *ngFor="let binary of qemuBinaries" [value]="binary">
|
<mat-option *ngFor="let binary of qemuBinaries" [value]="binary">
|
||||||
{{binary.path}}
|
{{binary.path}}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
@ -38,7 +37,6 @@
|
|||||||
<input
|
<input
|
||||||
matInput type="number"
|
matInput type="number"
|
||||||
placeholder="RAM"
|
placeholder="RAM"
|
||||||
[(ngModel)]="ramMemory"
|
|
||||||
formControlName="ramMemory"
|
formControlName="ramMemory"
|
||||||
ngDefaultContro/>
|
ngDefaultContro/>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
@ -51,7 +51,6 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
|
|
||||||
this.memoryForm = this.formBuilder.group({
|
this.memoryForm = this.formBuilder.group({
|
||||||
binary: new FormControl('', Validators.required),
|
|
||||||
ramMemory: new FormControl('', Validators.required)
|
ramMemory: new FormControl('', Validators.required)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -95,7 +94,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
|||||||
|
|
||||||
addTemplate() {
|
addTemplate() {
|
||||||
if (!this.nameForm.invalid && !this.memoryForm.invalid && (this.selectedImage || this.chosenImage)) {
|
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;
|
this.qemuTemplate.qemu_path = this.selectedBinary.path;
|
||||||
if (this.newImageSelected) {
|
if (this.newImageSelected) {
|
||||||
this.qemuTemplate.hda_disk_image = this.chosenImage;
|
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.hda_disk_image = this.selectedImage.path;
|
||||||
}
|
}
|
||||||
this.qemuTemplate.template_id = uuid();
|
this.qemuTemplate.template_id = uuid();
|
||||||
|
this.qemuTemplate.name = this.nameForm.get("templateName").value();
|
||||||
|
|
||||||
this.qemuService.addTemplate(this.server, this.qemuTemplate).subscribe((template: QemuTemplate) => {
|
this.qemuService.addTemplate(this.server, this.qemuTemplate).subscribe((template: QemuTemplate) => {
|
||||||
this.goBack();
|
this.goBack();
|
||||||
|
Reference in New Issue
Block a user