From 44e1b3d656f9a092c36dc542f6f0a86594829fd3 Mon Sep 17 00:00:00 2001 From: piotrpekala7 <31202938+piotrpekala7@users.noreply.github.com> Date: Thu, 17 Jun 2021 13:21:42 +0200 Subject: [PATCH] Updating links data source added --- src/app/cartography/widgets/links/ethernet-link.ts | 2 +- src/app/cartography/widgets/links/serial-link.ts | 2 +- .../link-style-editor/link-style-editor.component.ts | 3 +++ 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/app/cartography/widgets/links/ethernet-link.ts b/src/app/cartography/widgets/links/ethernet-link.ts index 77fda0be..77625fee 100644 --- a/src/app/cartography/widgets/links/ethernet-link.ts +++ b/src/app/cartography/widgets/links/ethernet-link.ts @@ -26,7 +26,7 @@ export class EthernetLinkWidget implements Widget { return new EthernetLinkPath( [link.source.x + link.source.width / 2, link.source.y + link.source.height / 2], [link.target.x + link.target.width / 2, link.target.y + link.target.height / 2], - link.link_style ? link.link_style : this.defaultEthernetLinkStyle + link.link_style.color ? link.link_style : this.defaultEthernetLinkStyle ); } diff --git a/src/app/cartography/widgets/links/serial-link.ts b/src/app/cartography/widgets/links/serial-link.ts index 05ff94f2..49e8c509 100644 --- a/src/app/cartography/widgets/links/serial-link.ts +++ b/src/app/cartography/widgets/links/serial-link.ts @@ -60,7 +60,7 @@ export class SerialLinkWidget implements Widget { angle_source, angle_target, [target.x, target.y], - link.link_style ? link.link_style : this.defaultSerialLinkStyle); + link.link_style.color ? link.link_style : this.defaultSerialLinkStyle); } public draw(view: SVGSelection) { diff --git a/src/app/components/project-map/drawings-editors/link-style-editor/link-style-editor.component.ts b/src/app/components/project-map/drawings-editors/link-style-editor/link-style-editor.component.ts index 25134039..5a4a6721 100644 --- a/src/app/components/project-map/drawings-editors/link-style-editor/link-style-editor.component.ts +++ b/src/app/components/project-map/drawings-editors/link-style-editor/link-style-editor.component.ts @@ -7,6 +7,7 @@ import { Server } from '../../../../models/server'; import { ToasterService } from '../../../../services/toaster.service'; import { NonNegativeValidator } from '../../../../validators/non-negative-validator'; import { LinkService } from '../../../../services/link.service'; +import { LinksDataSource } from '../../../../cartography/datasources/links-datasource'; @Component({ selector: 'app-link-style-editor', @@ -25,6 +26,7 @@ export class LinkStyleEditorDialogComponent implements OnInit { private formBuilder: FormBuilder, private toasterService: ToasterService, private linkService: LinkService, + private linksDataSource: LinksDataSource, private nonNegativeValidator: NonNegativeValidator ) { this.formGroup = this.formBuilder.group({ @@ -63,6 +65,7 @@ export class LinkStyleEditorDialogComponent implements OnInit { this.link.link_style.type = type; this.linkService.updateLinkStyle(this.server, this.link).subscribe((link) => { + this.linksDataSource.update(link); this.toasterService.success("Link updated"); this.dialogRef.close(); });