mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-17 22:38:08 +00:00
Support for client offset in scrolled area
This commit is contained in:
@ -6,6 +6,9 @@ import { NodeService } from '../../../../../services/node.service';
|
||||
import { Drawing } from '../../../../../cartography/models/drawing';
|
||||
import { DrawingsDataSource } from '../../../../../cartography/datasources/drawings-datasource';
|
||||
import { DrawingService } from '../../../../../services/drawing.service';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { LinkService } from '../../../../../services/link.service';
|
||||
import { LinksDataSource } from '../../../../../cartography/datasources/links-datasource';
|
||||
|
||||
@Component({
|
||||
selector: 'app-delete-action',
|
||||
@ -15,12 +18,15 @@ export class DeleteActionComponent implements OnInit {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
@Input() drawings: Drawing[];
|
||||
@Input() links: Link[];
|
||||
|
||||
constructor(
|
||||
private nodesDataSource: NodesDataSource,
|
||||
private drawingsDataSource: DrawingsDataSource,
|
||||
private linksDataSource: LinksDataSource,
|
||||
private nodeService: NodeService,
|
||||
private drawingService: DrawingService
|
||||
private drawingService: DrawingService,
|
||||
private linkService: LinkService
|
||||
) {}
|
||||
|
||||
ngOnInit() {}
|
||||
@ -37,5 +43,11 @@ export class DeleteActionComponent implements OnInit {
|
||||
|
||||
this.drawingService.delete(this.server, drawing).subscribe((drawing: Drawing) => {});
|
||||
});
|
||||
|
||||
this.links.forEach((link) => {
|
||||
this.linksDataSource.remove(link);
|
||||
|
||||
this.linkService.deleteLink(this.server, link).subscribe(() => {});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -15,13 +15,13 @@
|
||||
[drawing]="drawings[0]"
|
||||
></app-edit-text-action>
|
||||
<app-move-layer-up-action
|
||||
*ngIf="!projectService.isReadOnly(project)"
|
||||
*ngIf="!projectService.isReadOnly(project) && (drawings.length || nodes.length)"
|
||||
[server]="server"
|
||||
[nodes]="nodes"
|
||||
[drawings]="drawings"
|
||||
></app-move-layer-up-action>
|
||||
<app-move-layer-down-action
|
||||
*ngIf="!projectService.isReadOnly(project)"
|
||||
*ngIf="!projectService.isReadOnly(project) && (drawings.length || nodes.length)"
|
||||
[server]="server"
|
||||
[nodes]="nodes"
|
||||
[drawings]="drawings"
|
||||
@ -31,6 +31,7 @@
|
||||
[server]="server"
|
||||
[nodes]="nodes"
|
||||
[drawings]="drawings"
|
||||
[links]="links"
|
||||
></app-delete-action>
|
||||
</mat-menu>
|
||||
</div>
|
||||
|
@ -8,6 +8,7 @@ import { ProjectService } from '../../../services/project.service';
|
||||
import { Drawing } from '../../../cartography/models/drawing';
|
||||
import { TextElement } from '../../../cartography/models/drawings/text-element';
|
||||
import { Label } from '../../../cartography/models/label';
|
||||
import { Link } from '../../../models/link';
|
||||
|
||||
|
||||
@Component({
|
||||
@ -27,6 +28,7 @@ export class ContextMenuComponent implements OnInit {
|
||||
drawings: Drawing[] = [];
|
||||
nodes: Node[] = [];
|
||||
labels: Label[] = [];
|
||||
links: Link[] = [];
|
||||
|
||||
hasTextCapabilities: boolean = false;
|
||||
|
||||
@ -74,12 +76,13 @@ export class ContextMenuComponent implements OnInit {
|
||||
this.contextMenu.openMenu();
|
||||
}
|
||||
|
||||
public openMenuForListOfElements(drawings: Drawing[], nodes: Node[], labels: Label[], top: number, left: number) {
|
||||
public openMenuForListOfElements(drawings: Drawing[], nodes: Node[], labels: Label[], links: Link[], top: number, left: number) {
|
||||
this.resetCapabilities();
|
||||
|
||||
this.drawings = drawings;
|
||||
this.nodes = nodes;
|
||||
this.labels = labels;
|
||||
this.links = links;
|
||||
this.setPosition(top, left);
|
||||
|
||||
this.contextMenu.openMenu();
|
||||
|
Reference in New Issue
Block a user