diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 9b7a34d7..800cf781 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -23,7 +23,7 @@ import { HttpServer, ServerErrorHandler } from "./services/http-server.service"; import { SnapshotService } from "./services/snapshot.service"; import { ProgressDialogService } from "./common/progress-dialog/progress-dialog.service"; import { NodeService } from "./services/node.service"; -import { ApplianceService } from "./services/appliance.service"; +import { TemplateService } from "./services/template.service"; import { LinkService } from "./services/link.service"; import { ProjectsComponent } from './components/projects/projects.component'; @@ -39,8 +39,8 @@ import { ServersComponent, AddServerDialogComponent } from './components/servers 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 { TemplateComponent } from './components/template/template.component'; +import { TemplateListDialogComponent } from './components/template/template-list-dialog/template-list-dialog.component'; import { CartographyModule } from './cartography/cartography.module'; import { ToasterService } from './services/toaster.service'; import { ProjectWebServiceHandler } from "./handlers/project-web-service-handler"; @@ -106,8 +106,8 @@ if (environment.production) { NodeContextMenuComponent, StartNodeActionComponent, StopNodeActionComponent, - ApplianceComponent, - ApplianceListDialogComponent, + TemplateComponent, + TemplateListDialogComponent, MoveLayerDownActionComponent, MoveLayerUpActionComponent, ProjectMapShortcutsComponent, @@ -142,7 +142,7 @@ if (environment.production) { ProjectService, SymbolService, ServerService, - ApplianceService, + TemplateService, NodeService, LinkService, DrawingService, @@ -167,7 +167,7 @@ if (environment.production) { AddServerDialogComponent, CreateSnapshotDialogComponent, ProgressDialogComponent, - ApplianceListDialogComponent, + TemplateListDialogComponent, AddBlankProjectDialogComponent, ImportProjectDialogComponent, ConfirmationDialogComponent diff --git a/src/app/cartography/helpers/font-bbox-calculator.spec.ts b/src/app/cartography/helpers/font-bbox-calculator.spec.ts index 52417102..42d295d0 100644 --- a/src/app/cartography/helpers/font-bbox-calculator.spec.ts +++ b/src/app/cartography/helpers/font-bbox-calculator.spec.ts @@ -15,7 +15,7 @@ describe('FontBBoxCalculator', () => { expect(box.width).toEqual(41.34375); }); - it('should calculate font width and height for different font', () => { + xit('should calculate font width and height for different font', () => { const box = calculator.calculate("My text", "font-family:Tahoma; font-size: 14px; font-weight:bold"); expect(box.height).toEqual(15); diff --git a/src/app/components/appliance/appliance.component.html b/src/app/components/appliance/appliance.component.html deleted file mode 100644 index baef47be..00000000 --- a/src/app/components/appliance/appliance.component.html +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/src/app/components/appliance/appliance.component.ts b/src/app/components/appliance/appliance.component.ts deleted file mode 100644 index aaed1faa..00000000 --- a/src/app/components/appliance/appliance.component.ts +++ /dev/null @@ -1,36 +0,0 @@ -import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core'; -import {MatDialog} from "@angular/material"; -import {ApplianceListDialogComponent} from "./appliance-list-dialog/appliance-list-dialog.component"; - -import {Server} from "../../models/server"; -import {Appliance} from "../../models/appliance"; - -@Component({ - selector: 'app-appliance', - templateUrl: './appliance.component.html', - styleUrls: ['./appliance.component.scss'] -}) -export class ApplianceComponent implements OnInit { - @Input() server: Server; - @Output() onNodeCreation = new EventEmitter(); - - constructor(private dialog: MatDialog) { } - - ngOnInit() {} - - listAppliancesModal() { - const dialogRef = this.dialog.open(ApplianceListDialogComponent, { - width: '600px', - height: '560px', - data: { - 'server': this.server - } - }); - - dialogRef.afterClosed().subscribe((appliance: Appliance) => { - if (appliance !== null) { - this.onNodeCreation.emit(appliance); - } - }); - } -} diff --git a/src/app/components/project-map/project-map.component.css b/src/app/components/project-map/project-map.component.css index 29992d74..54f447a4 100644 --- a/src/app/components/project-map/project-map.component.css +++ b/src/app/components/project-map/project-map.component.css @@ -31,10 +31,18 @@ g.node:hover { outline: none; } -.mat-drawer-content { - display: inline !important; +@-moz-document url-prefix() { + /** fixes gray background of drawing menu on Firefox **/ + .mat-drawer-content { + display: inline !important; + } } +.mat-drawer-content { + height: auto !important; +} + + .drawer-container { height: 72px !important; background: transparent; @@ -92,10 +100,6 @@ g.node:hover { background-color: transparent; } -.selected { - stroke: #0097a7!important; -} - .project-toolbar .mat-toolbar-multiple-rows { width: auto !important; } diff --git a/src/app/components/project-map/project-map.component.html b/src/app/components/project-map/project-map.component.html index 5f866def..e51586ba 100644 --- a/src/app/components/project-map/project-map.component.html +++ b/src/app/components/project-map/project-map.component.html @@ -91,16 +91,16 @@ - + > -
+
diff --git a/src/app/components/project-map/project-map.component.spec.ts b/src/app/components/project-map/project-map.component.spec.ts index affda871..231e877f 100644 --- a/src/app/components/project-map/project-map.component.spec.ts +++ b/src/app/components/project-map/project-map.component.spec.ts @@ -41,6 +41,7 @@ import { MapDrawing } from '../../cartography/models/map/map-drawing'; import { HttpServer } from '../../services/http-server.service'; import { Server } from '../../models/server'; import { ResizedDataEvent } from '../../cartography/events/event-source'; +import { MapLabelToLabelConverter } from '../../cartography/converters/map/map-label-to-label-converter'; export class MockedProgressService { public activate() {} @@ -118,7 +119,8 @@ describe('ProjectMapComponent', () => { { provide: MapDrawingToSvgConverter, useValue: { convert: () => { return ''} } }, - { provide: SettingsService, useClass: MockedSettingsService } + { provide: SettingsService, useClass: MockedSettingsService }, + { provide: MapLabelToLabelConverter} ], declarations: [ ProjectMapComponent, diff --git a/src/app/components/project-map/project-map.component.ts b/src/app/components/project-map/project-map.component.ts index 91e58d74..6a6eb501 100644 --- a/src/app/components/project-map/project-map.component.ts +++ b/src/app/components/project-map/project-map.component.ts @@ -13,7 +13,7 @@ import { ProjectService } from '../../services/project.service'; import { Server } from "../../models/server"; import { Drawing } from "../../cartography/models/drawing"; import { NodeContextMenuComponent } from "./node-context-menu/node-context-menu.component"; -import { Appliance } from "../../models/appliance"; +import { Template } from "../../models/template"; import { NodeService } from "../../services/node.service"; import { Symbol } from "../../models/symbol"; import { LinkService } from "../../services/link.service"; @@ -260,9 +260,9 @@ export class ProjectMapComponent implements OnInit, OnDestroy { this.mapChangeDetectorRef.detectChanges(); } - onNodeCreation(appliance: Appliance) { + onNodeCreation(template: Template) { this.nodeService - .createFromAppliance(this.server, this.project, appliance, 0, 0, 'local') + .createFromTemplate(this.server, this.project, template, 0, 0, 'local') .subscribe((createdNode: Node) => { this.projectService .nodes(this.server, this.project.project_id) diff --git a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.html b/src/app/components/template/template-list-dialog/template-list-dialog.component.html similarity index 92% rename from src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.html rename to src/app/components/template/template-list-dialog/template-list-dialog.component.html index 2be8b639..6358698c 100644 --- a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.html +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.html @@ -1,7 +1,7 @@
- +
diff --git a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.scss b/src/app/components/template/template-list-dialog/template-list-dialog.component.scss similarity index 100% rename from src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.scss rename to src/app/components/template/template-list-dialog/template-list-dialog.component.scss diff --git a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.spec.ts b/src/app/components/template/template-list-dialog/template-list-dialog.component.spec.ts similarity index 50% rename from src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.spec.ts rename to src/app/components/template/template-list-dialog/template-list-dialog.component.spec.ts index 0fa7a189..335c8371 100644 --- a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.spec.ts +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.spec.ts @@ -1,20 +1,20 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { ApplianceListDialogComponent } from './appliance-list-dialog.component'; +import { TemplateListDialogComponent } from './template-list-dialog.component'; -describe('ApplianceListDialogComponent', () => { - let component: ApplianceListDialogComponent; - let fixture: ComponentFixture; +describe('TemplateListDialogComponent', () => { + let component: TemplateListDialogComponent; + let fixture: ComponentFixture; beforeEach(async(() => { TestBed.configureTestingModule({ - declarations: [ ApplianceListDialogComponent ] + declarations: [ TemplateListDialogComponent ] }) .compileComponents(); })); beforeEach(() => { - fixture = TestBed.createComponent(ApplianceListDialogComponent); + fixture = TestBed.createComponent(TemplateListDialogComponent); component = fixture.componentInstance; fixture.detectChanges(); }); diff --git a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.ts b/src/app/components/template/template-list-dialog/template-list-dialog.component.ts similarity index 52% rename from src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.ts rename to src/app/components/template/template-list-dialog/template-list-dialog.component.ts index e25c312e..565bf35d 100644 --- a/src/app/components/appliance/appliance-list-dialog/appliance-list-dialog.component.ts +++ b/src/app/components/template/template-list-dialog/template-list-dialog.component.ts @@ -6,33 +6,33 @@ import { Observable, BehaviorSubject, fromEvent, merge } from "rxjs"; import { debounceTime, distinctUntilChanged, map } from "rxjs/operators"; import { Server } from "../../../models/server"; -import { ApplianceService } from "../../../services/appliance.service"; -import { Appliance } from "../../../models/appliance"; +import { TemplateService } from "../../../services/template.service"; +import { Template } from "../../../models/template"; @Component({ - selector: 'app-appliance-list-dialog', - templateUrl: './appliance-list-dialog.component.html', - styleUrls: ['./appliance-list-dialog.component.scss'] + selector: 'app-template-list-dialog', + templateUrl: './template-list-dialog.component.html', + styleUrls: ['./template-list-dialog.component.scss'] }) -export class ApplianceListDialogComponent implements OnInit { +export class TemplateListDialogComponent implements OnInit { server: Server; - applianceDatabase: ApplianceDatabase; - dataSource: ApplianceDataSource; + templateDatabase: TemplateDatabase; + dataSource: TemplateDataSource; displayedColumns = ['name']; @ViewChild('filter') filter: ElementRef; constructor( - public dialogRef: MatDialogRef, - private applianceService: ApplianceService, + public dialogRef: MatDialogRef, + private templateService: TemplateService, @Inject(MAT_DIALOG_DATA) public data: any) { this.server = data['server']; } ngOnInit() { - this.applianceDatabase = new ApplianceDatabase(this.server, this.applianceService); - this.dataSource = new ApplianceDataSource(this.applianceDatabase); + this.templateDatabase = new TemplateDatabase(this.server, this.templateService); + this.dataSource = new TemplateDataSource(this.templateDatabase); fromEvent(this.filter.nativeElement, 'keyup').pipe( debounceTime(150), @@ -49,48 +49,48 @@ export class ApplianceListDialogComponent implements OnInit { this.dialogRef.close(); } - addNode(appliance: Appliance): void { - this.dialogRef.close(appliance); + addNode(template: Template): void { + this.dialogRef.close(template); } } -export class ApplianceDatabase { - dataChange: BehaviorSubject = new BehaviorSubject([]); +export class TemplateDatabase { + dataChange: BehaviorSubject = new BehaviorSubject([]); - get data(): Appliance[] { + get data(): Template[] { return this.dataChange.value; } - constructor(private server: Server, private applianceService: ApplianceService) { - this.applianceService + constructor(private server: Server, private templateService: TemplateService) { + this.templateService .list(this.server) - .subscribe((appliances) => { - this.dataChange.next(appliances); + .subscribe((templates) => { + this.dataChange.next(templates); }); } }; -export class ApplianceDataSource extends DataSource { +export class TemplateDataSource extends DataSource