diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9b50cc04..278f396f 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -225,6 +225,7 @@ import { UdpTunnelsComponent } from './components/preferences/common/udp-tunnels import { ConfiguratorDialogAtmSwitchComponent } from './components/project-map/node-editors/configurator/atm_switch/configurator-atm-switch.component'; import { ConfiguratorDialogVmwareComponent } from './components/project-map/node-editors/configurator/vmware/configurator-vmware.component'; import { ConfiguratorDialogIouComponent } from './components/project-map/node-editors/configurator/iou/configurator-iou.component'; +import { ConfiguratorDialogIosComponent } from './components/project-map/node-editors/configurator/ios/configurator-ios.component'; if (environment.production) { Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', { @@ -377,7 +378,8 @@ if (environment.production) { UdpTunnelsComponent, ConfiguratorDialogAtmSwitchComponent, ConfiguratorDialogVmwareComponent, - ConfiguratorDialogIouComponent + ConfiguratorDialogIouComponent, + ConfiguratorDialogIosComponent ], imports: [ BrowserModule, @@ -487,7 +489,8 @@ if (environment.production) { ConfiguratorDialogCloudComponent, ConfiguratorDialogAtmSwitchComponent, ConfiguratorDialogVmwareComponent, - ConfiguratorDialogIouComponent + ConfiguratorDialogIouComponent, + ConfiguratorDialogIosComponent ], bootstrap: [AppComponent] }) diff --git a/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts b/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts index ee7c36ee..5168a8c6 100644 --- a/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts +++ b/src/app/components/project-map/context-menu/actions/config-action/config-action.component.ts @@ -12,6 +12,7 @@ import { ConfiguratorDialogCloudComponent } from '../../../node-editors/configur import { ConfiguratorDialogAtmSwitchComponent } from '../../../node-editors/configurator/atm_switch/configurator-atm-switch.component'; import { ConfiguratorDialogVmwareComponent } from '../../../node-editors/configurator/vmware/configurator-vmware.component'; import { ConfiguratorDialogIouComponent } from '../../../node-editors/configurator/iou/configurator-iou.component'; +import { ConfiguratorDialogIosComponent } from '../../../node-editors/configurator/ios/configurator-ios.component'; @Component({ @@ -39,7 +40,7 @@ export class ConfigActionComponent { } else if (this.node.node_type === 'cloud') { this.dialogRef = this.dialog.open(ConfiguratorDialogCloudComponent, this.conf); } else if (this.node.node_type === 'dynamips') { - + this.dialogRef = this.dialog.open(ConfiguratorDialogIosComponent, this.conf); } else if (this.node.node_type === 'iou') { this.dialogRef = this.dialog.open(ConfiguratorDialogIouComponent, this.conf); } else if (this.node.node_type === 'qemu') { diff --git a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html new file mode 100644 index 00000000..089da3c8 --- /dev/null +++ b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.html @@ -0,0 +1,51 @@ +

Configurator for node {{name}}

+ + + +
+ + +
diff --git a/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts new file mode 100644 index 00000000..4af94677 --- /dev/null +++ b/src/app/components/project-map/node-editors/configurator/ios/configurator-ios.component.ts @@ -0,0 +1,67 @@ +import { Component, OnInit, Input, ViewChild } from "@angular/core"; +import { FormBuilder, FormGroup, Validators, FormControl } from '@angular/forms'; +import { Node } from '../../../../../cartography/models/node'; +import { Server } from '../../../../../models/server'; +import { NodeService } from '../../../../../services/node.service'; +import { ToasterService } from '../../../../../services/toaster.service'; +import { MatDialogRef } from '@angular/material'; +import { IosConfigurationService } from '../../../../../services/ios-configuration.service'; + + +@Component({ + selector: 'app-configurator-ios', + templateUrl: './configurator-ios.component.html', + styleUrls: ['../configurator.component.scss'] +}) +export class ConfiguratorDialogIosComponent implements OnInit { + server: Server; + node: Node; + name: string; + generalSettingsForm: FormGroup; + memoryForm: FormGroup; + consoleTypes: string[] = []; + + constructor( + public dialogRef: MatDialogRef, + public nodeService: NodeService, + private toasterService: ToasterService, + private formBuilder: FormBuilder, + private configurationService: IosConfigurationService + ) { + this.generalSettingsForm = this.formBuilder.group({ + name: new FormControl('', Validators.required) + }); + + this.memoryForm = this.formBuilder.group({ + ram: new FormControl('', Validators.required), + nvram: new FormControl('', Validators.required) + }); + } + + ngOnInit() { + this.nodeService.getNode(this.server, this.node).subscribe((node: Node) => { + this.node = node; + this.name = node.name; + this.getConfiguration(); + }); + } + + getConfiguration() { + this.consoleTypes = this.configurationService.getConsoleTypes(); + } + + onSaveClick() { + if (this.generalSettingsForm.valid && this.memoryForm.valid) { + this.nodeService. updateNode(this.server, this.node).subscribe(() => { + this.toasterService.success(`Node ${this.node.name} updated.`); + this.onCancelClick(); + }); + } else { + this.toasterService.error(`Fill all required fields.`); + } + } + + onCancelClick() { + this.dialogRef.close(); + } +} diff --git a/src/app/services/node.service.ts b/src/app/services/node.service.ts index d07c19d6..950f0bcd 100644 --- a/src/app/services/node.service.ts +++ b/src/app/services/node.service.ts @@ -89,6 +89,7 @@ export class NodeService { updateNode(server: Server, node: Node): Observable { return this.httpServer.put(server, `/projects/${node.project_id}/nodes/${node.node_id}`, { console_type: node.console_type, + console_auto_start: node.console_auto_start, name: node.name, properties: node.properties });