mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-14 13:46:34 +00:00
Default settings for templates
This commit is contained in:
parent
18f7f350f7
commit
b6d02ca5d4
@ -21,6 +21,7 @@
|
||||
<mat-form-field class="form-field">
|
||||
<mat-select
|
||||
placeholder="Image"
|
||||
(selectionChange)="onImageChosen($event)"
|
||||
formControlName="imageName">
|
||||
<mat-option *ngFor="let image of iosImages" [value]="image.filename">
|
||||
{{image.filename}}
|
||||
|
@ -77,7 +77,6 @@ export class AddIosTemplateComponent implements OnInit {
|
||||
file.withCredentials = false;
|
||||
};
|
||||
this.uploader.onErrorItem = (item: FileItem, response: string, status: number, headers: ParsedResponseHeaders) => {
|
||||
console.log(response);
|
||||
this.toasterService.error('An error occured: ' + response);
|
||||
};
|
||||
this.uploader.onSuccessItem = (
|
||||
@ -180,7 +179,7 @@ export class AddIosTemplateComponent implements OnInit {
|
||||
}
|
||||
|
||||
completeModulesData() {
|
||||
if(Object.keys(this.networkModules[this.iosTemplate.platform])){
|
||||
if (Object.keys(this.networkModules[this.iosTemplate.platform])){
|
||||
for(let i=0; i<Object.keys(this.networkModules[this.iosTemplate.platform]).length; i++){
|
||||
if(!this.networkModulesForTemplate[i]) this.networkModulesForTemplate[i] = '';
|
||||
}
|
||||
@ -195,6 +194,16 @@ export class AddIosTemplateComponent implements OnInit {
|
||||
this.router.navigate(['/server', this.server.id, 'preferences', 'dynamips', 'templates']);
|
||||
}
|
||||
|
||||
onImageChosen() {
|
||||
let name: string = this.iosImageForm.get("imageName").value.split('-')[0];
|
||||
this.iosNameForm.controls['templateName'].setValue(name);
|
||||
|
||||
if (this.platforms.includes(name.split('-')[0])) {
|
||||
this.iosNameForm.controls['platform'].setValue(name);
|
||||
this.iosMemoryForm.controls['memory'].setValue(this.defaultRam[name]);
|
||||
}
|
||||
}
|
||||
|
||||
onPlatformChosen() {
|
||||
this.iosTemplate.chassis = '';
|
||||
this.networkAdaptersForTemplate = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user