diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 0201bfcf..5827e364 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -226,6 +226,8 @@ import { ConfiguratorDialogVmwareComponent } from './components/project-map/node
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';
+import { EditNetworkConfigurationDialogComponent } from './components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component';
+import { ConfigureCustomAdaptersDialogComponent } from './components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component';
import { ConfiguratorDialogNatComponent } from './components/project-map/node-editors/configurator/nat/configurator-nat.component';
import { ConfiguratorDialogTracengComponent } from './components/project-map/node-editors/configurator/traceng/configurator-traceng.component';
import { AddTracengTemplateComponent } from './components/preferences/traceng/add-traceng/add-traceng-template.component';
@@ -281,6 +283,7 @@ import { ApplianceInfoDialogComponent } from './components/project-map/new-templ
import { InformationDialogComponent } from './components/dialogs/information-dialog.component';
import { TemplateNameDialogComponent } from './components/project-map/new-template-dialog/template-name-dialog/template-name-dialog.component';
+
@NgModule({
declarations: [
AppComponent,
@@ -464,7 +467,9 @@ import { TemplateNameDialogComponent } from './components/project-map/new-templa
ChangeHostnameDialogComponent,
ApplianceInfoDialogComponent,
InformationDialogComponent,
- TemplateNameDialogComponent
+ TemplateNameDialogComponent,
+ ConfigureCustomAdaptersDialogComponent,
+ EditNetworkConfigurationDialogComponent
],
imports: [
BrowserModule,
@@ -606,7 +611,9 @@ import { TemplateNameDialogComponent } from './components/project-map/new-templa
AdbutlerComponent,
NewTemplateDialogComponent,
ChangeHostnameDialogComponent,
- ApplianceInfoDialogComponent
+ ApplianceInfoDialogComponent,
+ ConfigureCustomAdaptersDialogComponent,
+ EditNetworkConfigurationDialogComponent
],
bootstrap: [AppComponent]
})
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
index 03509ca4..936fd35c 100644
--- 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
@@ -19,7 +19,9 @@
-
+
@@ -48,6 +50,9 @@
+
Environment
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
index e84c817b..ba346076 100644
--- 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
@@ -4,8 +4,10 @@ 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/dialog';
+import { MatDialog, MatDialogRef } from '@angular/material/dialog';
import { DockerConfigurationService } from '../../../../../services/docker-configuration.service';
+import { EditNetworkConfigurationDialogComponent } from './edit-network-configuration/edit-network-configuration.component';
+import { ConfigureCustomAdaptersDialogComponent } from './configure-custom-adapters/configure-custom-adapters.component';
@Component({
@@ -28,13 +30,20 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
'1366x768',
'1920x1080'
];
+ private conf = {
+ autoFocus: false,
+ width: '800px',
+ disableClose: true
+ };
+ dialogRef;
constructor(
- public dialogRef: MatDialogRef,
+ public dialogReference: MatDialogRef,
public nodeService: NodeService,
private toasterService: ToasterService,
private formBuilder: FormBuilder,
- private dockerConfigurationService: DockerConfigurationService
+ private dockerConfigurationService: DockerConfigurationService,
+ private dialog: MatDialog
) {
this.generalSettingsForm = this.formBuilder.group({
name: new FormControl('', Validators.required),
@@ -57,6 +66,20 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
this.consoleTypes = this.dockerConfigurationService.getConsoleTypes();
}
+ configureCustomAdapters() {
+ this.dialogRef = this.dialog.open(ConfigureCustomAdaptersDialogComponent, this.conf);
+ let instance = this.dialogRef.componentInstance;
+ instance.server = this.server;
+ instance.node = this.node;
+ }
+
+ editNetworkConfiguration() {
+ this.dialogRef = this.dialog.open(EditNetworkConfigurationDialogComponent, this.conf);
+ let instance = this.dialogRef.componentInstance;
+ instance.server = this.server;
+ instance.node = this.node;
+ }
+
onSaveClick() {
if (this.generalSettingsForm.valid) {
this.nodeService.updateNode(this.server, this.node).subscribe(() => {
@@ -69,6 +92,6 @@ export class ConfiguratorDialogDockerComponent implements OnInit {
}
onCancelClick() {
- this.dialogRef.close();
+ this.dialogReference.close();
}
}
diff --git a/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html
new file mode 100644
index 00000000..fdd10d4a
--- /dev/null
+++ b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.html
@@ -0,0 +1,16 @@
+Configure custom adapters for node {{node.name}}
+
+
+
+
+
+
+
diff --git a/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.ts b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.ts
new file mode 100644
index 00000000..56b51f97
--- /dev/null
+++ b/src/app/components/project-map/node-editors/configurator/docker/configure-custom-adapters/configure-custom-adapters.component.ts
@@ -0,0 +1,41 @@
+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/dialog';
+import { DockerConfigurationService } from '../../../../../../services/docker-configuration.service';
+
+
+@Component({
+ selector: 'app-configure-custom-adapters',
+ templateUrl: './configure-custom-adapters.component.html',
+ styleUrls: ['../../configurator.component.scss']
+})
+export class ConfigureCustomAdaptersDialogComponent implements OnInit {
+ server: Server;
+ node: Node;
+
+ constructor(
+ public dialogRef: MatDialogRef,
+ public nodeService: NodeService,
+ private toasterService: ToasterService,
+ private formBuilder: FormBuilder,
+ private dockerConfigurationService: DockerConfigurationService
+ ) {}
+
+ ngOnInit() {
+
+ }
+
+ getConfiguration() {}
+
+ onSaveClick() {
+
+ }
+
+ onCancelClick() {
+ this.dialogRef.close();
+ }
+}
diff --git a/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.html b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.html
new file mode 100644
index 00000000..40432342
--- /dev/null
+++ b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.html
@@ -0,0 +1,10 @@
+Edit network configuration for node {{node.name}}
+
+
+
+
+
+
+
+
+
diff --git a/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.scss b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.scss
new file mode 100644
index 00000000..d874a5ff
--- /dev/null
+++ b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.scss
@@ -0,0 +1,4 @@
+.textArea {
+ width: 100%;
+ height: 350px;
+}
diff --git a/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.ts b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.ts
new file mode 100644
index 00000000..c6ed260f
--- /dev/null
+++ b/src/app/components/project-map/node-editors/configurator/docker/edit-network-configuration/edit-network-configuration.component.ts
@@ -0,0 +1,43 @@
+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/dialog';
+import { DockerConfigurationService } from '../../../../../../services/docker-configuration.service';
+
+
+@Component({
+ selector: 'app-edit-network-configuration',
+ templateUrl: './edit-network-configuration.component.html',
+ styleUrls: ['./edit-network-configuration.component.scss']
+})
+export class EditNetworkConfigurationDialogComponent implements OnInit {
+ server: Server;
+ node: Node;
+ configuration: string;
+
+ constructor(
+ public dialogRef: MatDialogRef,
+ public nodeService: NodeService,
+ private toasterService: ToasterService
+ ) {}
+
+ ngOnInit() {
+ this.nodeService.getNetworkConfiguration(this.server, this.node).subscribe((response: string) => {
+ this.configuration = response;
+ });
+ }
+
+ onSaveClick() {
+ this.nodeService.saveNetworkConfiguration(this.server, this.node, this.configuration).subscribe((response: string) => {
+ this.onCancelClick();
+ this.toasterService.success(`Configuration for node ${this.node.name} saved.`);
+ });
+ }
+
+ onCancelClick() {
+ this.dialogRef.close();
+ }
+}
diff --git a/src/app/services/node.service.ts b/src/app/services/node.service.ts
index 0b58fbaa..38db62ce 100644
--- a/src/app/services/node.service.ts
+++ b/src/app/services/node.service.ts
@@ -149,6 +149,14 @@ export class NodeService {
return `putty.exe -telnet \%h \%p -wt \"\%d\" -gns3 5 -skin 4`;
}
+ getNetworkConfiguration(server: Server, node: Node) {
+ return this.httpServer.get(server, `/projects/${node.project_id}/nodes/${node.node_id}/files/etc/network/interfaces`, { responseType: 'text' as 'json'});
+ }
+
+ saveNetworkConfiguration(server: Server, node: Node, configuration: string) {
+ return this.httpServer.post(server, `/projects/${node.project_id}/nodes/${node.node_id}/files/etc/network/interfaces`, configuration);
+ }
+
getStartupConfiguration(server: Server, node: Node) {
let urlPath: string = `/projects/${node.project_id}/nodes/${node.node_id}`;