mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-13 21:32:55 +00:00
Improve styles for context menus
This commit is contained in:
parent
d0ecd3b2ef
commit
f9e3200550
@ -19,7 +19,7 @@ describe('DrawLinkToolComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
// it('should create', () => {
|
||||
// expect(component).toBeTruthy();
|
||||
// });
|
||||
});
|
||||
|
@ -35,7 +35,11 @@ export class DrawLinkToolComponent implements OnInit, OnDestroy {
|
||||
|
||||
ngOnInit() {
|
||||
this.onNodeClicked = this.nodesWidget.onNodeClicked.subscribe((eventNode: NodeEvent) => {
|
||||
this.nodeSelectInterfaceMenu.open(eventNode.node, eventNode.event.clientY, eventNode.event.clientX);
|
||||
this.nodeSelectInterfaceMenu.open(
|
||||
eventNode.node,
|
||||
eventNode.event.clientY,
|
||||
eventNode.event.clientX
|
||||
);
|
||||
});
|
||||
}
|
||||
|
||||
@ -46,17 +50,9 @@ export class DrawLinkToolComponent implements OnInit, OnDestroy {
|
||||
this.onNodeClicked.unsubscribe();
|
||||
}
|
||||
|
||||
// public toggleDrawLineMode() {
|
||||
// this.drawLineMode = !this.drawLineMode;
|
||||
// if (!this.drawLineMode) {
|
||||
// this.mapChild.graphLayout.getDrawingLineTool().stop();
|
||||
// }
|
||||
// }
|
||||
|
||||
public onChooseInterface(event) {
|
||||
const node: Node = event.node;
|
||||
const port: Port = event.port;
|
||||
// const drawingLineTool = this.mapChild.graphLayout.getDrawingLineTool();
|
||||
if (this.drawingLineTool.isDrawing()) {
|
||||
const data = this.drawingLineTool.stop();
|
||||
this.linkCreated.emit(new LinkCreated(data['node'], data['port'], node, port));
|
||||
|
@ -163,7 +163,7 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
protected linkCreated(evt) {
|
||||
this.onLinkCreated.emit(evt);
|
||||
}
|
||||
|
||||
|
||||
private changeLayout() {
|
||||
if (this.parentNativeElement != null) {
|
||||
this.context.size = this.getSize();
|
||||
@ -216,10 +216,6 @@ export class MapComponent implements OnInit, OnChanges, OnDestroy {
|
||||
this.redraw();
|
||||
}
|
||||
|
||||
protected onLinkdddCreated(evt) {
|
||||
|
||||
}
|
||||
|
||||
@HostListener('window:resize', ['$event'])
|
||||
onResize(event) {
|
||||
this.changeLayout();
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="context-menu" [style.left]="leftPosition" [style.top]="topPosition" *ngIf="node">
|
||||
<span [matMenuTriggerFor]="selectInterfaceMenu"></span>
|
||||
<mat-menu #selectInterfaceMenu="matMenu">
|
||||
<mat-menu #selectInterfaceMenu="matMenu" class="context-menu-items">
|
||||
<button mat-menu-item *ngFor="let port of node.ports" (click)="chooseInterface(port)">
|
||||
<mat-icon>add_circle_outline</mat-icon>
|
||||
<span>{{ port.name }}</span>
|
||||
|
@ -3,7 +3,6 @@ import {MatMenuTrigger} from "@angular/material";
|
||||
import {DomSanitizer} from "@angular/platform-browser";
|
||||
import {Node} from "../../../cartography/models/node";
|
||||
import {Port} from "../../../models/port";
|
||||
import { Subscription } from 'rxjs';
|
||||
|
||||
|
||||
@Component({
|
||||
|
@ -1,6 +1,6 @@
|
||||
<div class="context-menu" [style.left]="leftPosition" [style.top]="topPosition" *ngIf="node">
|
||||
<span [matMenuTriggerFor]="contextMenu"></span>
|
||||
<mat-menu #contextMenu="matMenu">
|
||||
<mat-menu #contextMenu="matMenu" class="context-menu-items">
|
||||
<app-start-node-action [server]="server" [node]="node"></app-start-node-action>
|
||||
<app-stop-node-action [server]="server" [node]="node"></app-stop-node-action>
|
||||
<app-move-layer-up-action *ngIf="!projectService.isReadOnly(project)" [server]="server" [node]="node"></app-move-layer-up-action>
|
||||
|
@ -85,3 +85,14 @@ g.node text,
|
||||
padding-right: 15px;
|
||||
|
||||
}
|
||||
|
||||
.context-menu-items .mat-menu-item {
|
||||
line-height: 24px !important;
|
||||
height: 24px !important;
|
||||
font-size: 13px !important;
|
||||
padding: 0 6px;
|
||||
}
|
||||
|
||||
.context-menu-items .mat-menu-item .mat-icon {
|
||||
margin-right: 3px;
|
||||
}
|
||||
|
@ -191,7 +191,11 @@ export class ProjectMapComponent implements OnInit, OnDestroy {
|
||||
this.mapChild.graphLayout.getNodesWidget().setDraggingEnabled(!this.readonly);
|
||||
|
||||
const onContextMenu = this.mapChild.graphLayout.getNodesWidget().onContextMenu.subscribe((eventNode: NodeEvent) => {
|
||||
this.nodeContextMenu.open(eventNode.node, eventNode.event.clientY, eventNode.event.clientX);
|
||||
this.nodeContextMenu.open(
|
||||
eventNode.node,
|
||||
eventNode.event.clientY,
|
||||
eventNode.event.clientX
|
||||
);
|
||||
});
|
||||
|
||||
this.subscriptions.push(onContextMenu);
|
||||
|
Loading…
x
Reference in New Issue
Block a user