mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-20 05:27:56 +00:00
Fix for IOS appliances
This commit is contained in:
parent
41e7f1c53e
commit
c0b9311b38
@ -174,6 +174,44 @@
|
||||
</div>
|
||||
<button mat-raised-button color="primary" (click)="createDockerTemplate()" class="create-button">Create docker template</button>
|
||||
</div>
|
||||
|
||||
<div *ngIf="applianceToInstall.dynamips">
|
||||
<div>
|
||||
Server type<br/>
|
||||
<mat-radio-group class="radio-group">
|
||||
<mat-radio-button [disabled]="true" class="radio-button" value="1" (click)="setServerType('local')">Install the appliance locally</mat-radio-button>
|
||||
<mat-radio-button class="radio-button" value="2" checked (click)="setServerType('gns3 vm')">Install the appliance on the GNS3 VM</mat-radio-button>
|
||||
</mat-radio-group>
|
||||
</div>
|
||||
<div>
|
||||
Install required files
|
||||
<mat-list>
|
||||
<mat-list-item *ngFor="let image of applianceToInstall.images">
|
||||
<div class="list-item">
|
||||
<div>
|
||||
{{image.filename}}
|
||||
</div>
|
||||
<div>
|
||||
<input
|
||||
type="file"
|
||||
class="non-visible"
|
||||
#file2
|
||||
(change)="importImage($event)"
|
||||
ng2FileSelect
|
||||
[uploader]="uploaderImage"/>
|
||||
<button class="button" mat-raised-button (click)="file2.click()">Import</button>
|
||||
<button class="button" mat-raised-button (click)="downloadImage(image)">Download</button>
|
||||
<button class="button" mat-raised-button color="primary" (click)="createIosTemplate(image)">Create</button>
|
||||
</div>
|
||||
</div>
|
||||
</mat-list-item>
|
||||
</mat-list>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div *ngIf="applianceToInstall.iou">
|
||||
|
||||
</div>
|
||||
</mat-card>
|
||||
|
||||
<div>
|
||||
|
@ -15,6 +15,9 @@ import { QemuTemplate } from '../../../models/templates/qemu-template';
|
||||
import { v4 as uuid } from 'uuid';
|
||||
import { DockerTemplate } from '../../../models/templates/docker-template';
|
||||
import { DockerService } from '../../../services/docker.service';
|
||||
import { IosTemplate } from '../../../models/templates/ios-template';
|
||||
import { IosService } from '../../../services/ios.service';
|
||||
import { IouService } from '../../../services/iou.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-new-template-dialog',
|
||||
@ -67,6 +70,8 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
private toasterService: ToasterService,
|
||||
private qemuService: QemuService,
|
||||
private dockerService: DockerService,
|
||||
private iosService: IosService,
|
||||
private iouService: IouService,
|
||||
public dialog: MatDialog
|
||||
) {}
|
||||
|
||||
@ -232,6 +237,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
|
||||
fileReader.onloadend = () => {
|
||||
if (this.applianceToInstall.qemu) emulator = 'qemu';
|
||||
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
||||
|
||||
const url = this.applianceService.getUploadPath(this.server, emulator, fileName);
|
||||
this.uploaderImage.queue.forEach(elem => (elem.url = url));
|
||||
@ -249,6 +255,41 @@ export class NewTemplateDialogComponent implements OnInit {
|
||||
window.open(image.download_url);
|
||||
}
|
||||
|
||||
createIouTemplate () {
|
||||
|
||||
}
|
||||
|
||||
createIosTemplate(image: Image) {
|
||||
let iosTemplate: IosTemplate = new IosTemplate();
|
||||
iosTemplate.name = this.applianceToInstall.name;
|
||||
iosTemplate.chassis = this.applianceToInstall.dynamips.chassis;
|
||||
iosTemplate.nvram = this.applianceToInstall.dynamips.nvram;
|
||||
iosTemplate.platform = this.applianceToInstall.dynamips.platform;
|
||||
iosTemplate.ram = this.applianceToInstall.dynamips.ram;
|
||||
iosTemplate.startup_config = this.applianceToInstall.dynamips.startup_config;
|
||||
iosTemplate.slot0 = this.applianceToInstall.dynamips.slot0;
|
||||
iosTemplate.slot1 = this.applianceToInstall.dynamips.slot1;
|
||||
iosTemplate.slot2 = this.applianceToInstall.dynamips.slot2;
|
||||
iosTemplate.slot3 = this.applianceToInstall.dynamips.slot3;
|
||||
iosTemplate.slot4 = this.applianceToInstall.dynamips.slot4;
|
||||
iosTemplate.slot5 = this.applianceToInstall.dynamips.slot5;
|
||||
iosTemplate.slot6 = this.applianceToInstall.dynamips.slot6;
|
||||
iosTemplate.slot7 = this.applianceToInstall.dynamips.slot7;
|
||||
iosTemplate.builtin = this.applianceToInstall.builtin;
|
||||
iosTemplate.category = this.applianceToInstall.category;
|
||||
iosTemplate.default_name_format = this.applianceToInstall.port_name_format;
|
||||
iosTemplate.symbol = this.applianceToInstall.symbol;
|
||||
iosTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||
iosTemplate.template_id = uuid();
|
||||
iosTemplate.image = image.filename;
|
||||
iosTemplate.template_type = 'dynamips';
|
||||
|
||||
this.iosService.addTemplate(this.server, iosTemplate).subscribe(() => {
|
||||
this.toasterService.success('Template added');
|
||||
this.dialogRef.close()
|
||||
});
|
||||
}
|
||||
|
||||
createDockerTemplate() {
|
||||
let dockerTemplate: DockerTemplate = new DockerTemplate();
|
||||
dockerTemplate.name = this.applianceToInstall.name;
|
||||
|
@ -29,6 +29,13 @@ export interface Dynamips {
|
||||
platform: string;
|
||||
ram: number;
|
||||
slot0: string;
|
||||
slot1: string;
|
||||
slot2: string;
|
||||
slot3: string;
|
||||
slot4: string;
|
||||
slot5: string;
|
||||
slot6: string;
|
||||
slot7: string;
|
||||
startup_config: string;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user