diff --git a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html index 084e45a4..95cc87b0 100644 --- a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html +++ b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.html @@ -48,12 +48,12 @@ - + - + {{chassis}} @@ -71,7 +71,7 @@ MB @@ -81,27 +81,27 @@ -
+
- + *ngIf="networkAdapters[iosNameForm.get('chassis').value] && networkAdapters[iosNameForm.get('chassis').value][index]"> + {{option}}
-
+
- + *ngIf="networkAdaptersForPlatform[iosNameForm.get('platform').value] && networkAdaptersForPlatform[iosNameForm.get('platform').value][index]"> + {{option}} @@ -115,7 +115,7 @@ placeholder="WIC {{index}}" [(ngModel)]="networkModulesForTemplate[index]" [ngModelOptions]="{standalone: true}" - *ngIf="networkModules[iosNameForm.get('platform').value][index]"> + *ngIf="networkModules[iosNameForm.get('platform').value] && networkModules[iosNameForm.get('platform').value][index]"> {{option}} diff --git a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts index bdf6f774..54185ddd 100644 --- a/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts +++ b/src/app/components/preferences/dynamips/add-ios-template/add-ios-template.component.ts @@ -129,12 +129,12 @@ export class AddIosTemplateComponent implements OnInit { } addTemplate() { - if (!this.iosImageForm.invalid && !this.iosNameForm.invalid && !this.iosMemoryForm.invalid) { + if (!this.iosImageForm.invalid && !this.iosMemoryForm.invalid && this.iosNameForm.get('templateName').value && this.iosNameForm.get('platform').value) { this.iosTemplate.template_id = uuid(); this.iosTemplate.image = this.iosImageForm.get("imageName").value; this.iosTemplate.name = this.iosNameForm.get('templateName').value; this.iosTemplate.platform = this.iosNameForm.get('platform').value; - this.iosTemplate.chassis = this.iosNameForm.get('chassis').value; + if (this.chassis[this.iosNameForm.get('platform').value]) this.iosTemplate.chassis = this.iosNameForm.get('chassis').value; this.iosTemplate.ram = this.iosMemoryForm.get('memory').value; if (this.isEtherSwitchRouter) { diff --git a/src/app/models/templates/ios-template.ts b/src/app/models/templates/ios-template.ts index f73630ba..7f9f2fe5 100644 --- a/src/app/models/templates/ios-template.ts +++ b/src/app/models/templates/ios-template.ts @@ -2,7 +2,7 @@ export class IosTemplate { auto_delete_disks: boolean; builtin: boolean; category: string; - chassis: string; + chassis?: string; compute_id: string; console_auto_start: boolean; console_type: string; @@ -14,7 +14,7 @@ export class IosTemplate { idlepc: string; idlesleep: number; image: string; - iomem: number; + iomem?: number; mac_addr: string; mmap: boolean; name: string; diff --git a/src/app/services/template-mocks.service.ts b/src/app/services/template-mocks.service.ts index e746ef0f..1860e821 100644 --- a/src/app/services/template-mocks.service.ts +++ b/src/app/services/template-mocks.service.ts @@ -184,7 +184,6 @@ export class TemplateMocksService { auto_delete_disks: true, builtin: false, category: 'router', - chassis: '', compute_id: 'local', console_auto_start: false, console_type: 'telnet', @@ -196,7 +195,6 @@ export class TemplateMocksService { idlepc: '', idlesleep: 30, image: '', - iomem: 0, mac_addr: '', mmap: true, name: '',