Updating links data source added

This commit is contained in:
piotrpekala7 2021-06-17 13:21:42 +02:00
parent a93125cdd7
commit 44e1b3d656
3 changed files with 5 additions and 2 deletions

View File

@ -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
);
}

View File

@ -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) {

View File

@ -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();
});