diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 278f396f..8e14f3e2 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -226,6 +226,7 @@ import { ConfiguratorDialogAtmSwitchComponent } from './components/project-map/n 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'; +import { ConfiguratorDialogDockerComponent } from './components/project-map/node-editors/configurator/docker/configurator-docker.component'; if (environment.production) { Raven.config('https://b2b1cfd9b043491eb6b566fd8acee358@sentry.io/842726', { @@ -379,7 +380,8 @@ if (environment.production) { ConfiguratorDialogAtmSwitchComponent, ConfiguratorDialogVmwareComponent, ConfiguratorDialogIouComponent, - ConfiguratorDialogIosComponent + ConfiguratorDialogIosComponent, + ConfiguratorDialogDockerComponent ], imports: [ BrowserModule, @@ -490,7 +492,8 @@ if (environment.production) { ConfiguratorDialogAtmSwitchComponent, ConfiguratorDialogVmwareComponent, ConfiguratorDialogIouComponent, - ConfiguratorDialogIosComponent + ConfiguratorDialogIosComponent, + ConfiguratorDialogDockerComponent ], bootstrap: [AppComponent] }) diff --git a/src/app/cartography/models/node.ts b/src/app/cartography/models/node.ts index f82d50b0..86d0fa33 100644 --- a/src/app/cartography/models/node.ts +++ b/src/app/cartography/models/node.ts @@ -52,6 +52,8 @@ export class Properties { platform: string; process_priority: string; qemu_path: string; + environment: string; + extra_hosts: string; } export class Node { 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 5168a8c6..ae039104 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 @@ -13,6 +13,7 @@ import { ConfiguratorDialogAtmSwitchComponent } from '../../../node-editors/conf 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'; +import { ConfiguratorDialogDockerComponent } from '../../../node-editors/configurator/docker/configurator-docker.component'; @Component({ @@ -50,7 +51,7 @@ export class ConfigActionComponent { } else if (this.node.node_type === 'vmware') { this.dialogRef = this.dialog.open(ConfiguratorDialogVmwareComponent, this.conf); } else if (this.node.node_type === 'docker') { - + this.dialogRef = this.dialog.open(ConfiguratorDialogDockerComponent, this.conf); } else if (this.node.node_type === 'nat') { } else if (this.node.node_type === 'frame_relay_switch') { diff --git a/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.html b/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.html new file mode 100644 index 00000000..296cee21 --- /dev/null +++ b/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.html @@ -0,0 +1,54 @@ +

Configurator for node {{name}}

+ + + +
+ + +
diff --git a/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.ts b/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.ts new file mode 100644 index 00000000..07f25d73 --- /dev/null +++ b/src/app/components/project-map/node-editors/configurator/docker/configurator-docker.component.ts @@ -0,0 +1,63 @@ +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 { DockerConfigurationService } from '../../../../../services/docker-configuration.service'; + + +@Component({ + selector: 'app-configurator-docker', + templateUrl: './configurator-docker.component.html', + styleUrls: ['../configurator.component.scss'] +}) +export class ConfiguratorDialogDockerComponent implements OnInit { + server: Server; + node: Node; + name: string; + generalSettingsForm: FormGroup; + consoleTypes: string[] = []; + + constructor( + public dialogRef: MatDialogRef, + public nodeService: NodeService, + private toasterService: ToasterService, + private formBuilder: FormBuilder, + private dockerConfigurationService: DockerConfigurationService + ) { + this.generalSettingsForm = this.formBuilder.group({ + name: new FormControl('', Validators.required), + adapter: 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.dockerConfigurationService.getConsoleTypes(); + + } + + onSaveClick() { + if (this.generalSettingsForm.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(); + } +}