Merge pull request #1433 from GNS3/fix/1336

Fix new template action not using "port_segment_size" and "default_name_format"
This commit is contained in:
Jeremy Grossmann 2023-02-09 12:20:14 +05:45 committed by GitHub
commit a64ff3503e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 8 deletions

View File

@ -320,17 +320,17 @@ export class NewTemplateDialogComponent implements OnInit {
setTimeout(() => { setTimeout(() => {
if (this.qemuBinaries.length) { if (this.qemuBinaries.length) {
if (this.applianceToInstall.qemu.arch === 'x86_64') { 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) { if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0]; this.selectedBinary = filtered_binaries[0];
} }
} else if (this.applianceToInstall.qemu.arch === 'i386') { } 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) { if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0]; this.selectedBinary = filtered_binaries[0];
} }
} else if (this.applianceToInstall.qemu.arch === 'x86_64') { } else if (this.applianceToInstall.qemu.arch === 'arm') {
let filtered_binaries = this.qemuBinaries.filter((n) => n.path.includes('qemu-system-arm')); let filtered_binaries = this.qemuBinaries.filter((n) => n.path.endsWith('qemu-system-arm'));
if (filtered_binaries.length) { if (filtered_binaries.length) {
this.selectedBinary = filtered_binaries[0]; this.selectedBinary = filtered_binaries[0];
} }
@ -364,7 +364,7 @@ export class NewTemplateDialogComponent implements OnInit {
autoFocus: false, autoFocus: false,
disableClose: true, 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?`; 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) => { dialogRef.afterClosed().subscribe((answer: boolean) => {
if (answer) { if (answer) {
@ -485,7 +485,7 @@ export class NewTemplateDialogComponent implements OnInit {
iouTemplate.startup_config = this.applianceToInstall.iou.startup_config; iouTemplate.startup_config = this.applianceToInstall.iou.startup_config;
iouTemplate.builtin = this.applianceToInstall.builtin; iouTemplate.builtin = this.applianceToInstall.builtin;
iouTemplate.category = this.getCategory(); 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.symbol = this.applianceToInstall.symbol;
iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
iouTemplate.template_id = uuid(); iouTemplate.template_id = uuid();
@ -534,7 +534,7 @@ export class NewTemplateDialogComponent implements OnInit {
iosTemplate.slot7 = this.applianceToInstall.dynamips.slot7; iosTemplate.slot7 = this.applianceToInstall.dynamips.slot7;
iosTemplate.builtin = this.applianceToInstall.builtin; iosTemplate.builtin = this.applianceToInstall.builtin;
iosTemplate.category = this.getCategory(); 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.symbol = this.applianceToInstall.symbol;
iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
iosTemplate.template_id = uuid(); iosTemplate.template_id = uuid();
@ -572,7 +572,7 @@ export class NewTemplateDialogComponent implements OnInit {
dockerTemplate.console_type = this.applianceToInstall.docker.console_type; dockerTemplate.console_type = this.applianceToInstall.docker.console_type;
dockerTemplate.builtin = this.applianceToInstall.builtin; dockerTemplate.builtin = this.applianceToInstall.builtin;
dockerTemplate.category = this.getCategory(); 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.symbol = this.applianceToInstall.symbol;
dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; dockerTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
dockerTemplate.template_id = uuid(); dockerTemplate.template_id = uuid();
@ -629,6 +629,8 @@ export class NewTemplateDialogComponent implements OnInit {
qemuTemplate.category = this.getCategory(); qemuTemplate.category = this.getCategory();
qemuTemplate.first_port_name = this.applianceToInstall.first_port_name; qemuTemplate.first_port_name = this.applianceToInstall.first_port_name;
qemuTemplate.port_name_format = this.applianceToInstall.port_name_format; 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.symbol = this.applianceToInstall.symbol;
qemuTemplate.qemu_path = this.selectedBinary.path; qemuTemplate.qemu_path = this.selectedBinary.path;
qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local'; qemuTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';

View File

@ -74,11 +74,13 @@ export interface Appliance {
maintainer_email: string; maintainer_email: string;
name: string; name: string;
port_name_format: string; port_name_format: string;
port_segment_size: number;
product_name: string; product_name: string;
product_url: string; product_url: string;
registry_version: number; registry_version: number;
status: string; status: string;
symbol: string; symbol: string;
default_name_format: string;
usage: string; usage: string;
vendor_name: string; vendor_name: string;
vendor_url: string; vendor_url: string;