diff --git a/angular.json b/angular.json
index f4430c7a..66e1b1ba 100644
--- a/angular.json
+++ b/angular.json
@@ -151,7 +151,7 @@
}
},
"gns3-web-ui-e2e": {
- "root": "",
+ "root": "e2e",
"sourceRoot": "e2e",
"projectType": "application",
"architect": {
diff --git a/package.json b/package.json
index 6e158064..fedf5c2b 100644
--- a/package.json
+++ b/package.json
@@ -37,7 +37,7 @@
"@angular/platform-browser": "^6.0.7",
"@angular/platform-browser-dynamic": "^6.0.7",
"@angular/router": "^6.0.7",
- "@ng-bootstrap/ng-bootstrap": "^2.2.0",
+ "@ng-bootstrap/ng-bootstrap": "^3.0.0",
"angular-persistence": "^1.0.1",
"angular2-hotkeys": "^2.1.2",
"angular2-indexeddb": "^1.2.2",
@@ -64,15 +64,15 @@
"@angular/language-service": "^6.0.7",
"@types/jasmine": "~2.8.8",
"@types/jasminewd2": "~2.0.2",
- "@types/node": "~10.5.2",
+ "@types/node": "~10.7.0",
"@sentry/electron": "^0.7.0",
"codelyzer": "~4.4.2",
"electron": "2.0.6",
"electron-builder": "^20.19.2",
- "jasmine-core": "~3.1.0",
+ "jasmine-core": "~3.2.0",
"jasmine-spec-reporter": "~4.2.1",
"jquery": "^3.3.1",
- "karma": "~2.0.4",
+ "karma": "~3.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^2.0.1",
diff --git a/scripts/requirements.txt b/scripts/requirements.txt
index 006aab96..167dc9f5 100644
--- a/scripts/requirements.txt
+++ b/scripts/requirements.txt
@@ -1,6 +1,6 @@
setuptools==38.4
cx_Freeze==5.1.1
-requests==2.18.4
+requests==2.20.0
packaging==16.8
appdirs==1.4.3
psutil==5.4.0
diff --git a/src/app/app.module.ts b/src/app/app.module.ts
index 2d08e232..962c7e1e 100644
--- a/src/app/app.module.ts
+++ b/src/app/app.module.ts
@@ -6,26 +6,6 @@ import { CdkTableModule } from "@angular/cdk/table";
import { HttpClientModule } from '@angular/common/http';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import {
- MatButtonModule,
- MatCardModule,
- MatMenuModule,
- MatToolbarModule,
- MatIconModule,
- MatFormFieldModule,
- MatInputModule,
- MatTableModule,
- MatDialogModule,
- MatProgressBarModule,
- MatProgressSpinnerModule,
- MatSnackBarModule,
- MatCheckboxModule,
- MatListModule,
- MatExpansionModule,
- MatSortModule,
- MatSelectModule,
- MatTooltipModule
-} from '@angular/material';
import { D3Service } from 'd3-ng2-service';
import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
@@ -52,14 +32,13 @@ import { DefaultLayoutComponent } from './layouts/default-layout/default-layout.
import { ProgressDialogComponent } from './common/progress-dialog/progress-dialog.component';
import { AppComponent } from './app.component';
-import { CreateSnapshotDialogComponent, ProjectMapComponent } from './components/project-map/project-map.component';
+import { ProjectMapComponent } from './components/project-map/project-map.component';
import { ServersComponent, AddServerDialogComponent } from './components/servers/servers.component';
import { NodeContextMenuComponent } from './components/project-map/node-context-menu/node-context-menu.component';
import { StartNodeActionComponent } from './components/project-map/node-context-menu/actions/start-node-action/start-node-action.component';
import { StopNodeActionComponent } from './components/project-map/node-context-menu/actions/stop-node-action/stop-node-action.component';
import { ApplianceComponent } from './components/appliance/appliance.component';
import { ApplianceListDialogComponent } from './components/appliance/appliance-list-dialog/appliance-list-dialog.component';
-import { NodeSelectInterfaceComponent } from './components/project-map/node-select-interface/node-select-interface.component';
import { CartographyModule } from './cartography/cartography.module';
import { ToasterService } from './services/toaster.service';
import { ProjectWebServiceHandler } from "./handlers/project-web-service-handler";
@@ -67,7 +46,7 @@ import { LinksDataSource } from "./cartography/datasources/links-datasource";
import { NodesDataSource } from "./cartography/datasources/nodes-datasource";
import { SymbolsDataSource } from "./cartography/datasources/symbols-datasource";
import { SelectionManager } from "./cartography/managers/selection-manager";
-import { InRectangleHelper } from "./cartography/components/map/helpers/in-rectangle-helper";
+import { InRectangleHelper } from "./cartography/helpers/in-rectangle-helper";
import { DrawingsDataSource } from "./cartography/datasources/drawings-datasource";
import { MoveLayerDownActionComponent } from './components/project-map/node-context-menu/actions/move-layer-down-action/move-layer-down-action.component';
import { MoveLayerUpActionComponent } from './components/project-map/node-context-menu/actions/move-layer-up-action/move-layer-up-action.component';
@@ -82,6 +61,12 @@ import { version } from "./version";
import { ToasterErrorHandler } from "./common/error-handlers/toaster-error-handler";
import { environment } from "../environments/environment";
import { RavenState } from "./common/error-handlers/raven-state-communicator";
+import { ServerDiscoveryComponent } from "./components/servers/server-discovery/server-discovery.component";
+import { ServerDatabase } from './services/server.database';
+import { CreateSnapshotDialogComponent } from './components/snapshots/create-snapshot-dialog/create-snapshot-dialog.component';
+import { SnapshotsComponent } from './components/snapshots/snapshots.component';
+import { SnapshotMenuItemComponent } from './components/snapshots/snapshot-menu-item/snapshot-menu-item.component';
+import { MATERIAL_IMPORTS } from './material.imports';
if (environment.production) {
@@ -103,6 +88,8 @@ if (environment.production) {
ServersComponent,
AddServerDialogComponent,
CreateSnapshotDialogComponent,
+ SnapshotMenuItemComponent,
+ SnapshotsComponent,
ProjectsComponent,
DefaultLayoutComponent,
ProgressDialogComponent,
@@ -111,13 +98,13 @@ if (environment.production) {
StopNodeActionComponent,
ApplianceComponent,
ApplianceListDialogComponent,
- NodeSelectInterfaceComponent,
MoveLayerDownActionComponent,
MoveLayerUpActionComponent,
ProjectMapShortcutsComponent,
SettingsComponent,
LocalServerComponent,
ProgressComponent,
+ ServerDiscoveryComponent,
],
imports: [
NgbModule.forRoot(),
@@ -127,28 +114,11 @@ if (environment.production) {
FormsModule,
BrowserAnimationsModule,
CdkTableModule,
- MatButtonModule,
- MatMenuModule,
- MatCardModule,
- MatToolbarModule,
- MatIconModule,
- MatFormFieldModule,
- MatInputModule,
- MatTableModule,
- MatDialogModule,
- MatProgressBarModule,
- MatProgressSpinnerModule,
- MatSnackBarModule,
- MatCheckboxModule,
- MatListModule,
- MatExpansionModule,
- MatSortModule,
- MatSelectModule,
- MatTooltipModule,
CartographyModule,
HotkeyModule.forRoot(),
PersistenceModule,
- NgxElectronModule
+ NgxElectronModule,
+ ...MATERIAL_IMPORTS
],
providers: [
SettingsService,
@@ -174,7 +144,8 @@ if (environment.production) {
SelectionManager,
InRectangleHelper,
DrawingsDataSource,
- ServerErrorHandler
+ ServerErrorHandler,
+ ServerDatabase
],
entryComponents: [
AddServerDialogComponent,
diff --git a/src/app/cartography/cartography.module.ts b/src/app/cartography/cartography.module.ts
index e84bda0c..502ae205 100644
--- a/src/app/cartography/cartography.module.ts
+++ b/src/app/cartography/cartography.module.ts
@@ -1,12 +1,44 @@
import { NgModule } from '@angular/core';
import { CommonModule } from '@angular/common';
+import { MatMenuModule, MatIconModule } from '@angular/material';
+
import { MapComponent } from './components/map/map.component';
+import { DrawLinkToolComponent } from './components/draw-link-tool/draw-link-tool.component';
+import { NodeSelectInterfaceComponent } from './components/node-select-interface/node-select-interface.component';
+
+import { CssFixer } from './helpers/css-fixer';
+import { FontFixer } from './helpers/font-fixer';
+import { MultiLinkCalculatorHelper } from './helpers/multi-link-calculator-helper';
+import { SvgToDrawingConverter } from './helpers/svg-to-drawing-converter';
+import { QtDasharrayFixer } from './helpers/qt-dasharray-fixer';
+import { LayersManager } from './managers/layers-manager';
+import { MapChangeDetectorRef } from './services/map-change-detector-ref';
+import { Context } from './models/context';
+import { D3_MAP_IMPORTS } from './d3-map.imports';
+
@NgModule({
imports: [
- CommonModule
+ CommonModule,
+ MatMenuModule,
+ MatIconModule
],
- declarations: [MapComponent],
- exports: [MapComponent]
+ declarations: [
+ MapComponent,
+ DrawLinkToolComponent,
+ NodeSelectInterfaceComponent
+ ],
+ providers: [
+ CssFixer,
+ FontFixer,
+ MultiLinkCalculatorHelper,
+ SvgToDrawingConverter,
+ QtDasharrayFixer,
+ LayersManager,
+ MapChangeDetectorRef,
+ Context,
+ ...D3_MAP_IMPORTS
+ ],
+ exports: [ MapComponent ]
})
export class CartographyModule { }
diff --git a/src/app/cartography/components/draw-link-tool/draw-link-tool.component.html b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.html
new file mode 100644
index 00000000..16188157
--- /dev/null
+++ b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.html
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/src/app/cartography/components/draw-link-tool/draw-link-tool.component.scss b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.scss
new file mode 100644
index 00000000..e69de29b
diff --git a/src/app/cartography/components/draw-link-tool/draw-link-tool.component.spec.ts b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.spec.ts
new file mode 100644
index 00000000..d75619ca
--- /dev/null
+++ b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.spec.ts
@@ -0,0 +1,25 @@
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+
+import { DrawLinkToolComponent } from './draw-link-tool.component';
+
+describe('DrawLinkToolComponent', () => {
+ let component: DrawLinkToolComponent;
+ let fixture: ComponentFixture;
+
+ beforeEach(async(() => {
+ TestBed.configureTestingModule({
+ declarations: [ DrawLinkToolComponent ]
+ })
+ .compileComponents();
+ }));
+
+ beforeEach(() => {
+ fixture = TestBed.createComponent(DrawLinkToolComponent);
+ component = fixture.componentInstance;
+ fixture.detectChanges();
+ });
+
+ // it('should create', () => {
+ // expect(component).toBeTruthy();
+ // });
+});
diff --git a/src/app/cartography/components/draw-link-tool/draw-link-tool.component.ts b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.ts
new file mode 100644
index 00000000..337dfe59
--- /dev/null
+++ b/src/app/cartography/components/draw-link-tool/draw-link-tool.component.ts
@@ -0,0 +1,59 @@
+import { Component, OnInit, Output, EventEmitter, OnDestroy, ViewChild } from '@angular/core';
+import { Port } from '../../../models/port';
+import { DrawingLineWidget } from '../../widgets/drawing-line';
+import { Node } from '../../models/node';
+import { NodesWidget } from '../../widgets/nodes';
+import { Subscription } from 'rxjs';
+import { NodeSelectInterfaceComponent } from '../node-select-interface/node-select-interface.component';
+import { LinkCreated } from '../../events/links';
+import { NodeClicked } from '../../events/nodes';
+
+
+@Component({
+ selector: 'app-draw-link-tool',
+ templateUrl: './draw-link-tool.component.html',
+ styleUrls: ['./draw-link-tool.component.scss']
+})
+export class DrawLinkToolComponent implements OnInit, OnDestroy {
+ @ViewChild(NodeSelectInterfaceComponent) nodeSelectInterfaceMenu: NodeSelectInterfaceComponent;
+
+ @Output('linkCreated') linkCreated = new EventEmitter();
+
+ private onNodeClicked: Subscription;
+
+ constructor(
+ private drawingLineTool: DrawingLineWidget,
+ private nodesWidget: NodesWidget
+ ) { }
+
+ ngOnInit() {
+ this.onNodeClicked = this.nodesWidget.onNodeClicked.subscribe((eventNode: NodeClicked) => {
+ this.nodeSelectInterfaceMenu.open(
+ eventNode.node,
+ eventNode.event.clientY,
+ eventNode.event.clientX
+ );
+ });
+ }
+
+ ngOnDestroy() {
+ if(this.drawingLineTool.isDrawing()) {
+ this.drawingLineTool.stop();
+ }
+ this.onNodeClicked.unsubscribe();
+ }
+
+ public onChooseInterface(event) {
+ const node: Node = event.node;
+ const port: Port = event.port;
+ if (this.drawingLineTool.isDrawing()) {
+ const data = this.drawingLineTool.stop();
+ this.linkCreated.emit(new LinkCreated(data['node'], data['port'], node, port));
+ } else {
+ this.drawingLineTool.start(node.x + node.width / 2., node.y + node.height / 2., {
+ 'node': node,
+ 'port': port
+ });
+ }
+ }
+}
diff --git a/src/app/cartography/components/map/map.component.html b/src/app/cartography/components/map/map.component.html
index 68e33fff..2be6a6a2 100644
--- a/src/app/cartography/components/map/map.component.html
+++ b/src/app/cartography/components/map/map.component.html
@@ -1,2 +1,10 @@
-