From 318143f5a8ea09c8692735925c00916c76f2d339 Mon Sep 17 00:00:00 2001 From: grossmj Date: Sat, 4 Feb 2023 13:25:10 +0800 Subject: [PATCH] Fix new template action not using "port_segment_size" and "default_name_format" --- .../new-template-dialog.component.ts | 18 ++++++++++-------- src/app/models/appliance.ts | 2 ++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts index 4ad51de9..4d50e47a 100644 --- a/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts +++ b/src/app/components/project-map/new-template-dialog/new-template-dialog.component.ts @@ -320,17 +320,17 @@ export class NewTemplateDialogComponent implements OnInit { setTimeout(() => { if (this.qemuBinaries.length) { if (this.applianceToInstall.qemu.arch === 'x86_64') { - let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-x86_64')); + let filtered_binaries = this.qemuBinaries.filter((n) => n.path.endsWith('qemu-system-x86_64')); if (filtered_binaries.length) { this.selectedBinary = filtered_binaries[0]; } } else if (this.applianceToInstall.qemu.arch === 'i386') { - let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-i386')); + let filtered_binaries = this.qemuBinaries.filter((n) => n.path.endsWith('qemu-system-i386')); if (filtered_binaries.length) { this.selectedBinary = filtered_binaries[0]; } - } else if (this.applianceToInstall.qemu.arch === 'x86_64') { - let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-arm')); + } else if (this.applianceToInstall.qemu.arch === 'arm') { + let filtered_binaries = this.qemuBinaries.filter((n) => n.path.endsWith('qemu-system-arm')); if (filtered_binaries.length) { this.selectedBinary = filtered_binaries[0]; } @@ -364,7 +364,7 @@ export class NewTemplateDialogComponent implements OnInit { autoFocus: false, disableClose: true, }); - dialogRef.componentInstance.confirmationMessage = `This is not the correct file. + dialogRef.componentInstance.confirmationMessage = `This is not the correct file. The MD5 sum is ${output} and should be ${imageToInstall.md5sum}. Do you want to accept it at your own risks?`; dialogRef.afterClosed().subscribe((answer: boolean) => { if (answer) { @@ -485,7 +485,7 @@ export class NewTemplateDialogComponent implements OnInit { iouTemplate.startup_config = this.applianceToInstall.iou.startup_config; iouTemplate.builtin = this.applianceToInstall.builtin; iouTemplate.category = this.getCategory(); - iouTemplate.default_name_format = this.applianceToInstall.port_name_format; + iouTemplate.default_name_format = this.applianceToInstall.default_name_format; iouTemplate.symbol = this.applianceToInstall.symbol; iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iouTemplate.template_id = uuid(); @@ -534,7 +534,7 @@ export class NewTemplateDialogComponent implements OnInit { iosTemplate.slot7 = this.applianceToInstall.dynamips.slot7; iosTemplate.builtin = this.applianceToInstall.builtin; iosTemplate.category = this.getCategory(); - iosTemplate.default_name_format = this.applianceToInstall.port_name_format; + iosTemplate.default_name_format = this.applianceToInstall.default_name_format; iosTemplate.symbol = this.applianceToInstall.symbol; iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iosTemplate.template_id = uuid(); @@ -572,7 +572,7 @@ export class NewTemplateDialogComponent implements OnInit { dockerTemplate.console_type = this.applianceToInstall.docker.console_type; dockerTemplate.builtin = this.applianceToInstall.builtin; dockerTemplate.category = this.getCategory(); - dockerTemplate.default_name_format = this.applianceToInstall.port_name_format; + dockerTemplate.default_name_format = this.applianceToInstall.default_name_format; dockerTemplate.symbol = this.applianceToInstall.symbol; dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; dockerTemplate.template_id = uuid(); @@ -629,6 +629,8 @@ export class NewTemplateDialogComponent implements OnInit { qemuTemplate.category = this.getCategory(); qemuTemplate.first_port_name = this.applianceToInstall.first_port_name; qemuTemplate.port_name_format = this.applianceToInstall.port_name_format; + qemuTemplate.port_segment_size = this.applianceToInstall.port_segment_size; + qemuTemplate.default_name_format = this.applianceToInstall.default_name_format qemuTemplate.symbol = this.applianceToInstall.symbol; qemuTemplate.qemu_path = this.selectedBinary.path; qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; diff --git a/src/app/models/appliance.ts b/src/app/models/appliance.ts index 661fbc01..4e0ecb91 100644 --- a/src/app/models/appliance.ts +++ b/src/app/models/appliance.ts @@ -74,11 +74,13 @@ export interface Appliance { maintainer_email: string; name: string; port_name_format: string; + port_segment_size: number; product_name: string; product_url: string; registry_version: number; status: string; symbol: string; + default_name_format: string; usage: string; vendor_name: string; vendor_url: string;