mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-02-22 02:16:37 +00:00
Configuration services for templates
This commit is contained in:
parent
c15b00a6bf
commit
6ec6dfe866
@ -133,6 +133,10 @@ import { PlatformService } from './services/platform.service';
|
|||||||
import { IosTemplateDetailsComponent } from './components/preferences/dynamips/ios-template-details/ios-template-details.component';
|
import { IosTemplateDetailsComponent } from './components/preferences/dynamips/ios-template-details/ios-template-details.component';
|
||||||
import { AddIosTemplateComponent } from './components/preferences/dynamips/add-ios-template/add-ios-template.component';
|
import { AddIosTemplateComponent } from './components/preferences/dynamips/add-ios-template/add-ios-template.component';
|
||||||
import { IosConfigurationService } from './services/ios-configuration.service';
|
import { IosConfigurationService } from './services/ios-configuration.service';
|
||||||
|
import { QemuConfigurationService } from './services/qemu-configuration.service';
|
||||||
|
import { VirtualBoxConfigurationService } from './services/virtual-box-configuration.service';
|
||||||
|
import { VpcsConfigurationService } from './services/vpcs-configuration.service';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from './services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
if (environment.production) {
|
if (environment.production) {
|
||||||
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', {
|
||||||
@ -272,7 +276,11 @@ if (environment.production) {
|
|||||||
InstalledSoftwareService,
|
InstalledSoftwareService,
|
||||||
ExternalSoftwareDefinitionService,
|
ExternalSoftwareDefinitionService,
|
||||||
PlatformService,
|
PlatformService,
|
||||||
IosConfigurationService
|
IosConfigurationService,
|
||||||
|
QemuConfigurationService,
|
||||||
|
VirtualBoxConfigurationService,
|
||||||
|
VpcsConfigurationService,,
|
||||||
|
BuiltInTemplatesConfigurationService
|
||||||
],
|
],
|
||||||
entryComponents: [
|
entryComponents: [
|
||||||
AddServerDialogComponent,
|
AddServerDialogComponent,
|
||||||
|
@ -16,6 +16,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
|||||||
import { ServerService } from '../../../../../services/server.service';
|
import { ServerService } from '../../../../../services/server.service';
|
||||||
import { ToasterService } from '../../../../../services/toaster.service';
|
import { ToasterService } from '../../../../../services/toaster.service';
|
||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
export class MockedBuiltInTemplatesService {
|
export class MockedBuiltInTemplatesService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -45,7 +46,8 @@ describe('CloudNodesTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService },
|
||||||
|
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
CloudNodesTemplateDetailsComponent
|
CloudNodesTemplateDetailsComponent
|
||||||
|
@ -6,6 +6,7 @@ import { ToasterService } from '../../../../../services/toaster.service';
|
|||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
import { CloudTemplate } from '../../../../../models/templates/cloud-template';
|
import { CloudTemplate } from '../../../../../models/templates/cloud-template';
|
||||||
import { PortsMappingEntity } from '../../../../../models/ethernetHub/ports-mapping-enity';
|
import { PortsMappingEntity } from '../../../../../models/ethernetHub/ports-mapping-enity';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -19,12 +20,8 @@ export class CloudNodesTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
categories = [["Default", "guest"],
|
categories = [];
|
||||||
["Routers", "router"],
|
consoleTypes: string[] = [];
|
||||||
["Switches", "switch"],
|
|
||||||
["End devices", "end_device"],
|
|
||||||
["Security devices", "security_device"]];
|
|
||||||
consoleTypes: string[] = ['telnet', 'none'];
|
|
||||||
|
|
||||||
tapInterface: string = '';
|
tapInterface: string = '';
|
||||||
ethernetInterface: string = '';
|
ethernetInterface: string = '';
|
||||||
@ -40,7 +37,8 @@ export class CloudNodesTemplateDetailsComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private builtInTemplatesService: BuiltInTemplatesService,
|
private builtInTemplatesService: BuiltInTemplatesService,
|
||||||
private toasterService: ToasterService
|
private toasterService: ToasterService,
|
||||||
|
private builtInTemplatesConfigurationService: BuiltInTemplatesConfigurationService
|
||||||
) {
|
) {
|
||||||
this.newPort = {
|
this.newPort = {
|
||||||
name: '',
|
name: '',
|
||||||
@ -54,6 +52,7 @@ export class CloudNodesTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((cloudNodeTemplate: CloudTemplate) => {
|
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((cloudNodeTemplate: CloudTemplate) => {
|
||||||
this.cloudNodeTemplate = cloudNodeTemplate;
|
this.cloudNodeTemplate = cloudNodeTemplate;
|
||||||
|
|
||||||
@ -71,6 +70,11 @@ export class CloudNodesTemplateDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration() {
|
||||||
|
this.categories = this.builtInTemplatesConfigurationService.getCategoriesForCloudNodes();
|
||||||
|
this.consoleTypes = this.builtInTemplatesConfigurationService.getConsoleTypesForCloudNodes();
|
||||||
|
}
|
||||||
|
|
||||||
onAddEthernetInterface() {
|
onAddEthernetInterface() {
|
||||||
if (this.ethernetInterface) {
|
if (this.ethernetInterface) {
|
||||||
this.ports_mapping_ethernet.push({
|
this.ports_mapping_ethernet.push({
|
||||||
|
@ -16,6 +16,7 @@ import { ToasterService } from '../../../../../services/toaster.service';
|
|||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
import { EthernetHubTemplate } from '../../../../../models/templates/ethernet-hub-template';
|
import { EthernetHubTemplate } from '../../../../../models/templates/ethernet-hub-template';
|
||||||
import { EthernetHubsTemplateDetailsComponent } from './ethernet-hubs-template-details.component';
|
import { EthernetHubsTemplateDetailsComponent } from './ethernet-hubs-template-details.component';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
export class MockedBuiltInTemplatesService {
|
export class MockedBuiltInTemplatesService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -45,7 +46,8 @@ describe('EthernetHubsTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService},
|
||||||
|
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
EthernetHubsTemplateDetailsComponent
|
EthernetHubsTemplateDetailsComponent
|
||||||
|
@ -6,6 +6,7 @@ import { ToasterService } from '../../../../../services/toaster.service';
|
|||||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
import { EthernetHubTemplate } from '../../../../../models/templates/ethernet-hub-template';
|
import { EthernetHubTemplate } from '../../../../../models/templates/ethernet-hub-template';
|
||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -21,18 +22,15 @@ export class EthernetHubsTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
categories = [["Default", "guest"],
|
categories = [];
|
||||||
["Routers", "router"],
|
|
||||||
["Switches", "switch"],
|
|
||||||
["End devices", "end_device"],
|
|
||||||
["Security devices", "security_device"]];
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private builtInTemplatesService: BuiltInTemplatesService,
|
private builtInTemplatesService: BuiltInTemplatesService,
|
||||||
private toasterService: ToasterService,
|
private toasterService: ToasterService,
|
||||||
private formBuilder: FormBuilder
|
private formBuilder: FormBuilder,
|
||||||
|
private builtInTemplatesConfigurationService: BuiltInTemplatesConfigurationService
|
||||||
) {
|
) {
|
||||||
this.inputForm = this.formBuilder.group({
|
this.inputForm = this.formBuilder.group({
|
||||||
templateName: new FormControl('', Validators.required),
|
templateName: new FormControl('', Validators.required),
|
||||||
@ -47,6 +45,7 @@ export class EthernetHubsTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.categories = this.builtInTemplatesConfigurationService.getCategoriesForEthernetHubs();
|
||||||
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((ethernetHubTemplate: EthernetHubTemplate) => {
|
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((ethernetHubTemplate: EthernetHubTemplate) => {
|
||||||
this.ethernetHubTemplate = ethernetHubTemplate;
|
this.ethernetHubTemplate = ethernetHubTemplate;
|
||||||
this.numberOfPorts = this.ethernetHubTemplate.ports_mapping.length;
|
this.numberOfPorts = this.ethernetHubTemplate.ports_mapping.length;
|
||||||
|
@ -16,6 +16,7 @@ import { ToasterService } from '../../../../../services/toaster.service';
|
|||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
import { EthernetSwitchTemplate } from '../../../../../models/templates/ethernet-switch-template';
|
import { EthernetSwitchTemplate } from '../../../../../models/templates/ethernet-switch-template';
|
||||||
import { EthernetSwitchesTemplateDetailsComponent } from './ethernet-switches-template-details.component';
|
import { EthernetSwitchesTemplateDetailsComponent } from './ethernet-switches-template-details.component';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
export class MockedBuiltInTemplatesService {
|
export class MockedBuiltInTemplatesService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -45,7 +46,8 @@ describe('EthernetSwitchesTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
{ provide: BuiltInTemplatesService, useValue: mockedBuiltInTemplatesService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService},
|
||||||
|
{ provide: BuiltInTemplatesConfigurationService, useClass: BuiltInTemplatesConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
EthernetSwitchesTemplateDetailsComponent
|
EthernetSwitchesTemplateDetailsComponent
|
||||||
|
@ -7,6 +7,7 @@ import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'
|
|||||||
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
import { BuiltInTemplatesService } from '../../../../../services/built-in-templates.service';
|
||||||
import { EthernetSwitchTemplate } from '../../../../../models/templates/ethernet-switch-template';
|
import { EthernetSwitchTemplate } from '../../../../../models/templates/ethernet-switch-template';
|
||||||
import { PortsMappingEntity } from '../../../../../models/ethernetHub/ports-mapping-enity';
|
import { PortsMappingEntity } from '../../../../../models/ethernetHub/ports-mapping-enity';
|
||||||
|
import { BuiltInTemplatesConfigurationService } from '../../../../../services/built-in-templates-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -24,14 +25,10 @@ export class EthernetSwitchesTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
categories = [["Default", "guest"],
|
categories = [];
|
||||||
["Routers", "router"],
|
consoleTypes: string[] = [];
|
||||||
["Switches", "switch"],
|
portTypes: string[] = [];
|
||||||
["End devices", "end_device"],
|
etherTypes: string[] = [];
|
||||||
["Security devices", "security_device"]];
|
|
||||||
consoleTypes: string[] = ['telnet', 'none'];
|
|
||||||
portTypes: string[] = ['access', 'dot1q', 'qinq'];
|
|
||||||
etherTypes: string[] = ['0x8100', '0x88A8', '0x9100', '0x9200'];
|
|
||||||
displayedColumns: string[] = ['port_number', 'vlan', 'type', 'ethertype'];
|
displayedColumns: string[] = ['port_number', 'vlan', 'type', 'ethertype'];
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
@ -39,7 +36,8 @@ export class EthernetSwitchesTemplateDetailsComponent implements OnInit {
|
|||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private builtInTemplatesService: BuiltInTemplatesService,
|
private builtInTemplatesService: BuiltInTemplatesService,
|
||||||
private toasterService: ToasterService,
|
private toasterService: ToasterService,
|
||||||
private formBuilder: FormBuilder
|
private formBuilder: FormBuilder,
|
||||||
|
private builtInTemplatesConfigurationService: BuiltInTemplatesConfigurationService
|
||||||
){
|
){
|
||||||
this.inputForm = this.formBuilder.group({
|
this.inputForm = this.formBuilder.group({
|
||||||
templateName: new FormControl('', Validators.required),
|
templateName: new FormControl('', Validators.required),
|
||||||
@ -59,6 +57,7 @@ export class EthernetSwitchesTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((ethernetSwitchTemplate: EthernetSwitchTemplate) => {
|
this.builtInTemplatesService.getTemplate(this.server, template_id).subscribe((ethernetSwitchTemplate: EthernetSwitchTemplate) => {
|
||||||
this.ethernetSwitchTemplate = ethernetSwitchTemplate;
|
this.ethernetSwitchTemplate = ethernetSwitchTemplate;
|
||||||
this.ethernetPorts = this.ethernetSwitchTemplate.ports_mapping;
|
this.ethernetPorts = this.ethernetSwitchTemplate.ports_mapping;
|
||||||
@ -67,6 +66,13 @@ export class EthernetSwitchesTemplateDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration() {
|
||||||
|
this.categories = this.builtInTemplatesConfigurationService.getCategoriesForEthernetSwitches();
|
||||||
|
this.consoleTypes = this.builtInTemplatesConfigurationService.getConsoleTypesForEthernetSwitches();
|
||||||
|
this.portTypes = this.builtInTemplatesConfigurationService.getPortTypesForEthernetSwitches();
|
||||||
|
this.etherTypes = this.builtInTemplatesConfigurationService.getEtherTypesForEthernetSwitches();
|
||||||
|
}
|
||||||
|
|
||||||
onAdd() {
|
onAdd() {
|
||||||
this.ethernetPorts.push(this.newPort);
|
this.ethernetPorts.push(this.newPort);
|
||||||
this.dataSource = [...this.ethernetPorts];
|
this.dataSource = [...this.ethernetPorts];
|
||||||
|
@ -46,22 +46,26 @@ export class IosTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.iosService.getTemplate(this.server, template_id).subscribe((iosTemplate: IosTemplate) => {
|
this.iosService.getTemplate(this.server, template_id).subscribe((iosTemplate: IosTemplate) => {
|
||||||
this.iosTemplate = iosTemplate;
|
this.iosTemplate = iosTemplate;
|
||||||
|
|
||||||
this.networkModules = this.iosConfigurationService.getNetworkModules();
|
|
||||||
this.networkAdaptersForPlatform = this.iosConfigurationService.getNetworkAdaptersForPlatform();
|
|
||||||
this.networkAdapters = this.iosConfigurationService.getNetworkAdapters();
|
|
||||||
this.platforms = this.iosConfigurationService.getAvailablePlatforms();
|
|
||||||
this.platformsWithEtherSwitchRouterOption = this.iosConfigurationService.getPlatformsWithEtherSwitchRouterOption();
|
|
||||||
this.platformsWithChassis = this.iosConfigurationService.getPlatformsWithChassis();
|
|
||||||
this.chassis = this.iosConfigurationService.getChassis();
|
|
||||||
this.defaultRam = this.iosConfigurationService.getDefaultRamSettings();
|
|
||||||
this.fillAdaptersData();
|
this.fillAdaptersData();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration() {
|
||||||
|
this.networkModules = this.iosConfigurationService.getNetworkModules();
|
||||||
|
this.networkAdaptersForPlatform = this.iosConfigurationService.getNetworkAdaptersForPlatform();
|
||||||
|
this.networkAdapters = this.iosConfigurationService.getNetworkAdapters();
|
||||||
|
this.platforms = this.iosConfigurationService.getAvailablePlatforms();
|
||||||
|
this.platformsWithEtherSwitchRouterOption = this.iosConfigurationService.getPlatformsWithEtherSwitchRouterOption();
|
||||||
|
this.platformsWithChassis = this.iosConfigurationService.getPlatformsWithChassis();
|
||||||
|
this.chassis = this.iosConfigurationService.getChassis();
|
||||||
|
this.defaultRam = this.iosConfigurationService.getDefaultRamSettings();
|
||||||
|
}
|
||||||
|
|
||||||
fillAdaptersData() {
|
fillAdaptersData() {
|
||||||
if (this.iosTemplate.slot0) this.networkAdaptersForTemplate[0] = this.iosTemplate.slot0;
|
if (this.iosTemplate.slot0) this.networkAdaptersForTemplate[0] = this.iosTemplate.slot0;
|
||||||
if (this.iosTemplate.slot1) this.networkAdaptersForTemplate[1] = this.iosTemplate.slot1;
|
if (this.iosTemplate.slot1) this.networkAdaptersForTemplate[1] = this.iosTemplate.slot1;
|
||||||
|
@ -17,6 +17,7 @@ import { QemuTemplate } from '../../../../models/templates/qemu-template';
|
|||||||
import { AddQemuVmTemplateComponent } from './add-qemu-vm-template.component';
|
import { AddQemuVmTemplateComponent } from './add-qemu-vm-template.component';
|
||||||
import { QemuService } from '../../../../services/qemu.service';
|
import { QemuService } from '../../../../services/qemu.service';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
|
import { QemuConfigurationService } from '../../../../services/qemu-configuration.service';
|
||||||
|
|
||||||
export class MockedQemuService {
|
export class MockedQemuService {
|
||||||
public addTemplate(server: Server, qemuTemplate: QemuTemplate) {
|
public addTemplate(server: Server, qemuTemplate: QemuTemplate) {
|
||||||
@ -56,7 +57,8 @@ describe('AddQemuVmTemplateComponent', () => {
|
|||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: QemuService, useValue: mockedQemuService },
|
{ provide: QemuService, useValue: mockedQemuService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService},
|
{ provide: ToasterService, useValue: mockedToasterService},
|
||||||
{ provide: TemplateMocksService, useClass: TemplateMocksService }
|
{ provide: TemplateMocksService, useClass: TemplateMocksService },
|
||||||
|
{ provide: QemuConfigurationService, useClass: QemuConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
AddQemuVmTemplateComponent
|
AddQemuVmTemplateComponent
|
||||||
|
@ -10,6 +10,7 @@ import { QemuTemplate } from '../../../../models/templates/qemu-template';
|
|||||||
import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms';
|
import { FormGroup, FormBuilder, FormControl, Validators } from '@angular/forms';
|
||||||
import { v4 as uuid } from 'uuid';
|
import { v4 as uuid } from 'uuid';
|
||||||
import { TemplateMocksService } from '../../../../services/template-mocks.service';
|
import { TemplateMocksService } from '../../../../services/template-mocks.service';
|
||||||
|
import { QemuConfigurationService } from '../../../../services/qemu-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -22,7 +23,7 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
|||||||
qemuBinaries: QemuBinary[] = [];
|
qemuBinaries: QemuBinary[] = [];
|
||||||
selectedBinary: QemuBinary;
|
selectedBinary: QemuBinary;
|
||||||
ramMemory: number;
|
ramMemory: number;
|
||||||
consoleTypes: string[] = ['telnet', 'vnc', 'spice', 'spice+agent', 'none'];
|
consoleTypes: string[] = [];
|
||||||
newImageSelected: boolean = false;;
|
newImageSelected: boolean = false;;
|
||||||
qemuImages: QemuImage[] = [];
|
qemuImages: QemuImage[] = [];
|
||||||
selectedImage: QemuImage;
|
selectedImage: QemuImage;
|
||||||
@ -40,7 +41,8 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
|||||||
private toasterService: ToasterService,
|
private toasterService: ToasterService,
|
||||||
private router: Router,
|
private router: Router,
|
||||||
private formBuilder: FormBuilder,
|
private formBuilder: FormBuilder,
|
||||||
private templateMocksService: TemplateMocksService
|
private templateMocksService: TemplateMocksService,
|
||||||
|
private configurationService: QemuConfigurationService
|
||||||
) {
|
) {
|
||||||
this.qemuTemplate = new QemuTemplate();
|
this.qemuTemplate = new QemuTemplate();
|
||||||
|
|
||||||
@ -73,6 +75,8 @@ export class AddQemuVmTemplateComponent implements OnInit {
|
|||||||
this.qemuService.getImages(server).subscribe((qemuImages: QemuImage[]) => {
|
this.qemuService.getImages(server).subscribe((qemuImages: QemuImage[]) => {
|
||||||
this.qemuImages = qemuImages;
|
this.qemuImages = qemuImages;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.consoleTypes = this.configurationService.getConsoleTypes();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,6 +16,7 @@ import { MockedActivatedRoute } from '../../preferences.component.spec';
|
|||||||
import { QemuTemplate } from '../../../../models/templates/qemu-template';
|
import { QemuTemplate } from '../../../../models/templates/qemu-template';
|
||||||
import { QemuVmTemplateDetailsComponent } from './qemu-vm-template-details.component';
|
import { QemuVmTemplateDetailsComponent } from './qemu-vm-template-details.component';
|
||||||
import { QemuService } from '../../../../services/qemu.service';
|
import { QemuService } from '../../../../services/qemu.service';
|
||||||
|
import { QemuConfigurationService } from '../../../../services/qemu-configuration.service';
|
||||||
|
|
||||||
export class MockedQemuService {
|
export class MockedQemuService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -53,7 +54,8 @@ describe('QemuVmTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: QemuService, useValue: mockedQemuService },
|
{ provide: QemuService, useValue: mockedQemuService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService},
|
||||||
|
{ provide: QemuConfigurationService, useClass: QemuConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
QemuVmTemplateDetailsComponent
|
QemuVmTemplateDetailsComponent
|
||||||
|
@ -7,6 +7,7 @@ import { QemuTemplate } from '../../../../models/templates/qemu-template';
|
|||||||
import { QemuBinary } from '../../../../models/qemu/qemu-binary';
|
import { QemuBinary } from '../../../../models/qemu/qemu-binary';
|
||||||
import { ToasterService } from '../../../../services/toaster.service';
|
import { ToasterService } from '../../../../services/toaster.service';
|
||||||
import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
|
import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
|
||||||
|
import { QemuConfigurationService } from '../../../../services/qemu-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -20,47 +21,13 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
consoleTypes: string[] = ['telnet', 'vnc', 'spice', 'spice+agent', 'none'];
|
consoleTypes: string[] = [];
|
||||||
diskInterfaces: string[] = ['ide', 'sata', 'scsi', 'sd', 'mtd', 'floppy', 'pflash', 'virtio', 'none'];
|
diskInterfaces: string[] = [];
|
||||||
networkTypes = [["e1000", "Intel Gigabit Ethernet"],
|
networkTypes = [];
|
||||||
["i82550", "Intel i82550 Ethernet"],
|
bootPriorities = [];
|
||||||
["i82551", "Intel i82551 Ethernet"],
|
onCloseOptions = [];
|
||||||
["i82557a", "Intel i82557A Ethernet"],
|
categories = [];
|
||||||
["i82557b", "Intel i82557B Ethernet"],
|
priorities: string[] = [];
|
||||||
["i82557c", "Intel i82557C Ethernet"],
|
|
||||||
["i82558a", "Intel i82558A Ethernet"],
|
|
||||||
["i82558b", "Intel i82558B Ethernet"],
|
|
||||||
["i82559a", "Intel i82559A Ethernet"],
|
|
||||||
["i82559b", "Intel i82559B Ethernet"],
|
|
||||||
["i82559c", "Intel i82559C Ethernet"],
|
|
||||||
["i82559er", "Intel i82559ER Ethernet"],
|
|
||||||
["i82562", "Intel i82562 Ethernet"],
|
|
||||||
["i82801", "Intel i82801 Ethernet"],
|
|
||||||
["ne2k_pci", "NE2000 Ethernet"],
|
|
||||||
["pcnet", "AMD PCNet Ethernet"],
|
|
||||||
["rtl8139", "Realtek 8139 Ethernet"],
|
|
||||||
["virtio", "Legacy paravirtualized Network I/O"],
|
|
||||||
["virtio-net-pci", "Paravirtualized Network I/O"],
|
|
||||||
["vmxnet3", "VMWare Paravirtualized Ethernet v3"]];
|
|
||||||
bootPriorities = [["HDD", "c"],
|
|
||||||
["CD/DVD-ROM", "d"],
|
|
||||||
["Network", "n"],
|
|
||||||
["HDD or Network", "cn"],
|
|
||||||
["HDD or CD/DVD-ROM", "cd"]];
|
|
||||||
onCloseOptions = [["Power off the VM", "power_off"],
|
|
||||||
["Send the shutdown signal (ACPI)", "shutdown_signal"],
|
|
||||||
["Save the VM state", "save_vm_state"]];
|
|
||||||
categories = [["Default", "guest"],
|
|
||||||
["Routers", "routers"],
|
|
||||||
["Switches", "switches"],
|
|
||||||
["End devices", "end_devices"],
|
|
||||||
["Security devices", "security_devices"]];
|
|
||||||
priorities = ["realtime",
|
|
||||||
"very high",
|
|
||||||
"high",
|
|
||||||
"normal",
|
|
||||||
"low",
|
|
||||||
"very low"];
|
|
||||||
binaries: QemuBinary[] = [];
|
binaries: QemuBinary[] = [];
|
||||||
activateCpuThrottling: boolean = true;
|
activateCpuThrottling: boolean = true;
|
||||||
isConfiguratorOpened: boolean = false;
|
isConfiguratorOpened: boolean = false;
|
||||||
@ -71,7 +38,8 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
|
|||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private qemuService: QemuService,
|
private qemuService: QemuService,
|
||||||
private toasterService: ToasterService
|
private toasterService: ToasterService,
|
||||||
|
private configurationService: QemuConfigurationService
|
||||||
){}
|
){}
|
||||||
|
|
||||||
ngOnInit(){
|
ngOnInit(){
|
||||||
@ -80,6 +48,7 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.qemuService.getTemplate(this.server, template_id).subscribe((qemuTemplate: QemuTemplate) => {
|
this.qemuService.getTemplate(this.server, template_id).subscribe((qemuTemplate: QemuTemplate) => {
|
||||||
this.qemuTemplate = qemuTemplate;
|
this.qemuTemplate = qemuTemplate;
|
||||||
|
|
||||||
@ -102,6 +71,16 @@ export class QemuVmTemplateDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration(){
|
||||||
|
this.consoleTypes = this.configurationService.getConsoleTypes();
|
||||||
|
this.diskInterfaces = this.configurationService.getDiskInterfaces();
|
||||||
|
this.networkTypes = this.configurationService.getNetworkTypes();
|
||||||
|
this.bootPriorities = this.configurationService.getBootPriorities();
|
||||||
|
this.onCloseOptions = this.configurationService.getOnCloseOptions();
|
||||||
|
this.categories = this.configurationService.getCategories();
|
||||||
|
this.priorities = this.configurationService.getPriorities();
|
||||||
|
}
|
||||||
|
|
||||||
uploadCdromImageFile(event){
|
uploadCdromImageFile(event){
|
||||||
this.qemuTemplate.cdrom_image = event.target.files[0].name;
|
this.qemuTemplate.cdrom_image = event.target.files[0].name;
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import { VirtualBoxTemplate } from '../../../../models/templates/virtualbox-temp
|
|||||||
import { VirtualBoxTemplateDetailsComponent } from './virtual-box-template-details.component';
|
import { VirtualBoxTemplateDetailsComponent } from './virtual-box-template-details.component';
|
||||||
import { VirtualBoxService } from '../../../../services/virtual-box.service';
|
import { VirtualBoxService } from '../../../../services/virtual-box.service';
|
||||||
import { MockedActivatedRoute } from '../../preferences.component.spec';
|
import { MockedActivatedRoute } from '../../preferences.component.spec';
|
||||||
|
import { VirtualBoxConfigurationService } from '../../../../services/virtual-box-configuration.service';
|
||||||
|
|
||||||
export class MockedVirtualBoxService {
|
export class MockedVirtualBoxService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -45,7 +46,8 @@ describe('VirtualBoxTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: VirtualBoxService, useValue: mockedVirtualBoxService },
|
{ provide: VirtualBoxService, useValue: mockedVirtualBoxService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService },
|
||||||
|
{ provide: VirtualBoxConfigurationService, useClass: VirtualBoxConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
VirtualBoxTemplateDetailsComponent
|
VirtualBoxTemplateDetailsComponent
|
||||||
|
@ -7,6 +7,7 @@ import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'
|
|||||||
import { VirtualBoxService } from '../../../../services/virtual-box.service';
|
import { VirtualBoxService } from '../../../../services/virtual-box.service';
|
||||||
import { VirtualBoxTemplate } from '../../../../models/templates/virtualbox-template';
|
import { VirtualBoxTemplate } from '../../../../models/templates/virtualbox-template';
|
||||||
import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
|
import { CustomAdapter } from '../../../../models/qemu/qemu-custom-adapter';
|
||||||
|
import { VirtualBoxConfigurationService } from '../../../../services/virtual-box-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -20,21 +21,10 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
consoleTypes: string[] = ['telnet', 'none'];
|
consoleTypes: string[] = [];
|
||||||
onCloseOptions = [["Power off the VM", "power_off"],
|
onCloseOptions = [];
|
||||||
["Send the shutdown signal (ACPI)", "shutdown_signal"],
|
categories = [];
|
||||||
["Save the VM state", "save_vm_state"]];
|
networkTypes = [];
|
||||||
categories = [["Default", "guest"],
|
|
||||||
["Routers", "routers"],
|
|
||||||
["Switches", "switches"],
|
|
||||||
["End devices", "end_devices"],
|
|
||||||
["Security devices", "security_devices"]];
|
|
||||||
networkTypes = ["PCnet-PCI II (Am79C970A)",
|
|
||||||
"PCNet-FAST III (Am79C973)",
|
|
||||||
"Intel PRO/1000 MT Desktop (82540EM)",
|
|
||||||
"Intel PRO/1000 T Server (82543GC)",
|
|
||||||
"Intel PRO/1000 MT Server (82545EM)",
|
|
||||||
"Paravirtualized Network (virtio-net)"];
|
|
||||||
adapters: CustomAdapter[] = [];
|
adapters: CustomAdapter[] = [];
|
||||||
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type'];
|
displayedColumns: string[] = ['adapter_number', 'port_name', 'adapter_type'];
|
||||||
isConfiguratorOpened: boolean = false;
|
isConfiguratorOpened: boolean = false;
|
||||||
@ -44,7 +34,8 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit {
|
|||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private virtualBoxService: VirtualBoxService,
|
private virtualBoxService: VirtualBoxService,
|
||||||
private toasterService: ToasterService,
|
private toasterService: ToasterService,
|
||||||
private formBuilder: FormBuilder
|
private formBuilder: FormBuilder,
|
||||||
|
private virtualBoxConfigurationService: VirtualBoxConfigurationService
|
||||||
) {}
|
) {}
|
||||||
|
|
||||||
ngOnInit() {
|
ngOnInit() {
|
||||||
@ -53,6 +44,7 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.virtualBoxService.getTemplate(this.server, template_id).subscribe((virtualBoxTemplate: VirtualBoxTemplate) => {
|
this.virtualBoxService.getTemplate(this.server, template_id).subscribe((virtualBoxTemplate: VirtualBoxTemplate) => {
|
||||||
this.virtualBoxTemplate = virtualBoxTemplate;
|
this.virtualBoxTemplate = virtualBoxTemplate;
|
||||||
|
|
||||||
@ -71,6 +63,13 @@ export class VirtualBoxTemplateDetailsComponent implements OnInit {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration(){
|
||||||
|
this.consoleTypes = this.virtualBoxConfigurationService.getConsoleTypes();
|
||||||
|
this.onCloseOptions = this.virtualBoxConfigurationService.getOnCloseoptions();
|
||||||
|
this.categories = this.virtualBoxConfigurationService.getCategories();
|
||||||
|
this.networkTypes = this.virtualBoxConfigurationService.getNetworkTypes();
|
||||||
|
}
|
||||||
|
|
||||||
configureCustomAdapters(){
|
configureCustomAdapters(){
|
||||||
this.isConfiguratorOpened = !this.isConfiguratorOpened;
|
this.isConfiguratorOpened = !this.isConfiguratorOpened;
|
||||||
this.virtualBoxTemplate.custom_adapters = this.adapters;
|
this.virtualBoxTemplate.custom_adapters = this.adapters;
|
||||||
|
@ -16,6 +16,7 @@ import { VpcsService } from '../../../../services/vpcs.service';
|
|||||||
import { ToasterService } from '../../../../services/toaster.service';
|
import { ToasterService } from '../../../../services/toaster.service';
|
||||||
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
|
||||||
import { MockedActivatedRoute } from '../../preferences.component.spec';
|
import { MockedActivatedRoute } from '../../preferences.component.spec';
|
||||||
|
import { VpcsConfigurationService } from '../../../../services/vpcs-configuration.service';
|
||||||
|
|
||||||
export class MockedVpcsService {
|
export class MockedVpcsService {
|
||||||
public getTemplate(server: Server, template_id: string) {
|
public getTemplate(server: Server, template_id: string) {
|
||||||
@ -45,7 +46,8 @@ describe('VpcsTemplateDetailsComponent', () => {
|
|||||||
},
|
},
|
||||||
{ provide: ServerService, useValue: mockedServerService },
|
{ provide: ServerService, useValue: mockedServerService },
|
||||||
{ provide: VpcsService, useValue: mockedVpcsService },
|
{ provide: VpcsService, useValue: mockedVpcsService },
|
||||||
{ provide: ToasterService, useValue: mockedToasterService}
|
{ provide: ToasterService, useValue: mockedToasterService},
|
||||||
|
{ provide: VpcsConfigurationService, useClass: VpcsConfigurationService }
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
VpcsTemplateDetailsComponent
|
VpcsTemplateDetailsComponent
|
||||||
|
@ -6,6 +6,7 @@ import { ToasterService } from '../../../../services/toaster.service';
|
|||||||
import { VpcsService } from '../../../../services/vpcs.service';
|
import { VpcsService } from '../../../../services/vpcs.service';
|
||||||
import { VpcsTemplate } from '../../../../models/templates/vpcs-template';
|
import { VpcsTemplate } from '../../../../models/templates/vpcs-template';
|
||||||
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms';
|
||||||
|
import { VpcsConfigurationService } from '../../../../services/vpcs-configuration.service';
|
||||||
|
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@ -20,19 +21,16 @@ export class VpcsTemplateDetailsComponent implements OnInit {
|
|||||||
|
|
||||||
isSymbolSelectionOpened: boolean = false;
|
isSymbolSelectionOpened: boolean = false;
|
||||||
|
|
||||||
consoleTypes: string[] = ['telnet', 'none'];
|
consoleTypes: string[] = [];
|
||||||
categories = [["Default", "guest"],
|
categories = [];
|
||||||
["Routers", "routers"],
|
|
||||||
["Switches", "switches"],
|
|
||||||
["End devices", "end_devices"],
|
|
||||||
["Security devices", "security_devices"]];
|
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private route: ActivatedRoute,
|
private route: ActivatedRoute,
|
||||||
private serverService: ServerService,
|
private serverService: ServerService,
|
||||||
private vpcsService: VpcsService,
|
private vpcsService: VpcsService,
|
||||||
private toasterService: ToasterService,
|
private toasterService: ToasterService,
|
||||||
private formBuilder: FormBuilder
|
private formBuilder: FormBuilder,
|
||||||
|
private vpcsConfigurationService: VpcsConfigurationService
|
||||||
) {
|
) {
|
||||||
this.inputForm = this.formBuilder.group({
|
this.inputForm = this.formBuilder.group({
|
||||||
templateName: new FormControl('', Validators.required),
|
templateName: new FormControl('', Validators.required),
|
||||||
@ -48,12 +46,18 @@ export class VpcsTemplateDetailsComponent implements OnInit {
|
|||||||
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
this.serverService.get(parseInt(server_id, 10)).then((server: Server) => {
|
||||||
this.server = server;
|
this.server = server;
|
||||||
|
|
||||||
|
this.getConfiguration();
|
||||||
this.vpcsService.getTemplate(this.server, template_id).subscribe((vpcsTemplate: VpcsTemplate) => {
|
this.vpcsService.getTemplate(this.server, template_id).subscribe((vpcsTemplate: VpcsTemplate) => {
|
||||||
this.vpcsTemplate = vpcsTemplate;
|
this.vpcsTemplate = vpcsTemplate;
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
getConfiguration() {
|
||||||
|
this.consoleTypes = this.vpcsConfigurationService.getConsoleTypes();
|
||||||
|
this.categories = this.vpcsConfigurationService.getCategories();
|
||||||
|
}
|
||||||
|
|
||||||
onSave() {
|
onSave() {
|
||||||
if (this.inputForm.invalid) {
|
if (this.inputForm.invalid) {
|
||||||
this.toasterService.error(`Fill all required fields`);
|
this.toasterService.error(`Fill all required fields`);
|
||||||
|
50
src/app/services/built-in-templates-configuration.service.ts
Normal file
50
src/app/services/built-in-templates-configuration.service.ts
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class BuiltInTemplatesConfigurationService {
|
||||||
|
getCategoriesForCloudNodes() {
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "router"],
|
||||||
|
["Switches", "switch"],
|
||||||
|
["End devices", "end_device"],
|
||||||
|
["Security devices", "security_device"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConsoleTypesForCloudNodes() {
|
||||||
|
return ['telnet', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategoriesForEthernetHubs() {
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "router"],
|
||||||
|
["Switches", "switch"],
|
||||||
|
["End devices", "end_device"],
|
||||||
|
["Security devices", "security_device"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategoriesForEthernetSwitches() {
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "router"],
|
||||||
|
["Switches", "switch"],
|
||||||
|
["End devices", "end_device"],
|
||||||
|
["Security devices", "security_device"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
getConsoleTypesForEthernetSwitches() {
|
||||||
|
return ['telnet', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getPortTypesForEthernetSwitches() {
|
||||||
|
return ['access', 'dot1q', 'qinq'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getEtherTypesForEthernetSwitches() {
|
||||||
|
return ['0x8100', '0x88A8', '0x9100', '0x9200'];
|
||||||
|
}
|
||||||
|
}
|
0
src/app/services/qemu-configuration.service.spec.ts
Normal file
0
src/app/services/qemu-configuration.service.spec.ts
Normal file
76
src/app/services/qemu-configuration.service.ts
Normal file
76
src/app/services/qemu-configuration.service.ts
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class QemuConfigurationService {
|
||||||
|
getConsoleTypes(){
|
||||||
|
return ['telnet', 'vnc', 'spice', 'spice+agent', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getDiskInterfaces() {
|
||||||
|
return ['ide', 'sata', 'scsi', 'sd', 'mtd', 'floppy', 'pflash', 'virtio', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getNetworkTypes() {
|
||||||
|
let networkTypes = [["e1000", "Intel Gigabit Ethernet"],
|
||||||
|
["i82550", "Intel i82550 Ethernet"],
|
||||||
|
["i82551", "Intel i82551 Ethernet"],
|
||||||
|
["i82557a", "Intel i82557A Ethernet"],
|
||||||
|
["i82557b", "Intel i82557B Ethernet"],
|
||||||
|
["i82557c", "Intel i82557C Ethernet"],
|
||||||
|
["i82558a", "Intel i82558A Ethernet"],
|
||||||
|
["i82558b", "Intel i82558B Ethernet"],
|
||||||
|
["i82559a", "Intel i82559A Ethernet"],
|
||||||
|
["i82559b", "Intel i82559B Ethernet"],
|
||||||
|
["i82559c", "Intel i82559C Ethernet"],
|
||||||
|
["i82559er", "Intel i82559ER Ethernet"],
|
||||||
|
["i82562", "Intel i82562 Ethernet"],
|
||||||
|
["i82801", "Intel i82801 Ethernet"],
|
||||||
|
["ne2k_pci", "NE2000 Ethernet"],
|
||||||
|
["pcnet", "AMD PCNet Ethernet"],
|
||||||
|
["rtl8139", "Realtek 8139 Ethernet"],
|
||||||
|
["virtio", "Legacy paravirtualized Network I/O"],
|
||||||
|
["virtio-net-pci", "Paravirtualized Network I/O"],
|
||||||
|
["vmxnet3", "VMWare Paravirtualized Ethernet v3"]];
|
||||||
|
|
||||||
|
return networkTypes;
|
||||||
|
}
|
||||||
|
|
||||||
|
getBootPriorities() {
|
||||||
|
let bootPriorities = [["HDD", "c"],
|
||||||
|
["CD/DVD-ROM", "d"],
|
||||||
|
["Network", "n"],
|
||||||
|
["HDD or Network", "cn"],
|
||||||
|
["HDD or CD/DVD-ROM", "cd"]];
|
||||||
|
|
||||||
|
return bootPriorities;
|
||||||
|
}
|
||||||
|
|
||||||
|
getOnCloseOptions() {
|
||||||
|
let onCloseOptions = [["Power off the VM", "power_off"],
|
||||||
|
["Send the shutdown signal (ACPI)", "shutdown_signal"],
|
||||||
|
["Save the VM state", "save_vm_state"]];
|
||||||
|
|
||||||
|
return onCloseOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategories() {
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "routers"],
|
||||||
|
["Switches", "switches"],
|
||||||
|
["End devices", "end_devices"],
|
||||||
|
["Security devices", "security_devices"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
getPriorities() {
|
||||||
|
let priorities = ["realtime",
|
||||||
|
"very high",
|
||||||
|
"high",
|
||||||
|
"normal",
|
||||||
|
"low",
|
||||||
|
"very low"];
|
||||||
|
|
||||||
|
return priorities;
|
||||||
|
}
|
||||||
|
}
|
37
src/app/services/virtual-box-configuration.service.ts
Normal file
37
src/app/services/virtual-box-configuration.service.ts
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class VirtualBoxConfigurationService{
|
||||||
|
getConsoleTypes() {
|
||||||
|
return ['telnet', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getOnCloseoptions() {
|
||||||
|
let onCloseOptions = [["Power off the VM", "power_off"],
|
||||||
|
["Send the shutdown signal (ACPI)", "shutdown_signal"],
|
||||||
|
["Save the VM state", "save_vm_state"]];
|
||||||
|
|
||||||
|
return onCloseOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategories() {
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "routers"],
|
||||||
|
["Switches", "switches"],
|
||||||
|
["End devices", "end_devices"],
|
||||||
|
["Security devices", "security_devices"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
|
||||||
|
getNetworkTypes() {
|
||||||
|
let networkTypes = ["PCnet-PCI II (Am79C970A)",
|
||||||
|
"PCNet-FAST III (Am79C973)",
|
||||||
|
"Intel PRO/1000 MT Desktop (82540EM)",
|
||||||
|
"Intel PRO/1000 T Server (82543GC)",
|
||||||
|
"Intel PRO/1000 MT Server (82545EM)",
|
||||||
|
"Paravirtualized Network (virtio-net)"];
|
||||||
|
|
||||||
|
return networkTypes;
|
||||||
|
}
|
||||||
|
}
|
0
src/app/services/vpcs-configuration.service.spec.ts
Normal file
0
src/app/services/vpcs-configuration.service.spec.ts
Normal file
18
src/app/services/vpcs-configuration.service.ts
Normal file
18
src/app/services/vpcs-configuration.service.ts
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
import { Injectable } from "@angular/core";
|
||||||
|
|
||||||
|
@Injectable()
|
||||||
|
export class VpcsConfigurationService {
|
||||||
|
getConsoleTypes(){
|
||||||
|
return ['telnet', 'none'];
|
||||||
|
}
|
||||||
|
|
||||||
|
getCategories(){
|
||||||
|
let categories = [["Default", "guest"],
|
||||||
|
["Routers", "routers"],
|
||||||
|
["Switches", "switches"],
|
||||||
|
["End devices", "end_devices"],
|
||||||
|
["Security devices", "security_devices"]];
|
||||||
|
|
||||||
|
return categories;
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user