mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-19 07:18:14 +00:00
Support for IOU appliances
This commit is contained in:
@ -209,7 +209,36 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div *ngIf="applianceToInstall.iou">
|
<div *ngIf="applianceToInstall.iou">
|
||||||
|
<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 color="primary" (click)="createIouTemplate(image)">Create</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</mat-list-item>
|
||||||
|
</mat-list>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</mat-card>
|
</mat-card>
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@ import { DockerService } from '../../../services/docker.service';
|
|||||||
import { IosTemplate } from '../../../models/templates/ios-template';
|
import { IosTemplate } from '../../../models/templates/ios-template';
|
||||||
import { IosService } from '../../../services/ios.service';
|
import { IosService } from '../../../services/ios.service';
|
||||||
import { IouService } from '../../../services/iou.service';
|
import { IouService } from '../../../services/iou.service';
|
||||||
|
import { IouTemplate } from '../../../models/templates/iou-template';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-new-template-dialog',
|
selector: 'app-new-template-dialog',
|
||||||
@ -238,6 +239,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
fileReader.onloadend = () => {
|
fileReader.onloadend = () => {
|
||||||
if (this.applianceToInstall.qemu) emulator = 'qemu';
|
if (this.applianceToInstall.qemu) emulator = 'qemu';
|
||||||
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
if (this.applianceToInstall.dynamips) emulator = 'dynamips';
|
||||||
|
if (this.applianceToInstall.iou) emulator = 'iou';
|
||||||
|
|
||||||
const url = this.applianceService.getUploadPath(this.server, emulator, fileName);
|
const url = this.applianceService.getUploadPath(this.server, emulator, fileName);
|
||||||
this.uploaderImage.queue.forEach(elem => (elem.url = url));
|
this.uploaderImage.queue.forEach(elem => (elem.url = url));
|
||||||
@ -255,8 +257,27 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
window.open(image.download_url);
|
window.open(image.download_url);
|
||||||
}
|
}
|
||||||
|
|
||||||
createIouTemplate () {
|
createIouTemplate (image: Image) {
|
||||||
|
let iouTemplate: IouTemplate = new IouTemplate();
|
||||||
|
iouTemplate.name = this.applianceToInstall.name;
|
||||||
|
iouTemplate.nvram = this.applianceToInstall.iou.nvram;
|
||||||
|
iouTemplate.ram = this.applianceToInstall.iou.ram;
|
||||||
|
iouTemplate.ethernet_adapters = this.applianceToInstall.iou.ethernet_adapters;
|
||||||
|
iouTemplate.serial_adapters = this.applianceToInstall.iou.serial_adapters;
|
||||||
|
iouTemplate.startup_config = this.applianceToInstall.iou.startup_config;
|
||||||
|
iouTemplate.builtin = this.applianceToInstall.builtin;
|
||||||
|
iouTemplate.category = this.applianceToInstall.category;
|
||||||
|
iouTemplate.default_name_format = this.applianceToInstall.port_name_format;
|
||||||
|
iouTemplate.symbol = this.applianceToInstall.symbol;
|
||||||
|
iouTemplate.compute_id = this.isGns3VmChosen ? 'vm' : 'local';
|
||||||
|
iouTemplate.template_id = uuid();
|
||||||
|
iouTemplate.path = image.filename;
|
||||||
|
iouTemplate.template_type = 'iou';
|
||||||
|
|
||||||
|
this.iouService.addTemplate(this.server, iouTemplate).subscribe(() => {
|
||||||
|
this.toasterService.success('Template added');
|
||||||
|
this.dialogRef.close();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
createIosTemplate(image: Image) {
|
createIosTemplate(image: Image) {
|
||||||
@ -286,7 +307,7 @@ export class NewTemplateDialogComponent implements OnInit {
|
|||||||
|
|
||||||
this.iosService.addTemplate(this.server, iosTemplate).subscribe(() => {
|
this.iosService.addTemplate(this.server, iosTemplate).subscribe(() => {
|
||||||
this.toasterService.success('Template added');
|
this.toasterService.success('Template added');
|
||||||
this.dialogRef.close()
|
this.dialogRef.close();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user