mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-15 13:28:10 +00:00
Merge with master
This commit is contained in:
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item (click)="openPacketFilters()">
|
||||
<mat-icon>filter_list</mat-icon>
|
||||
<span>Packet filters</span>
|
||||
</button>
|
@ -0,0 +1,30 @@
|
||||
import { Component, Input } from "@angular/core";
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { Project } from '../../../../../models/project';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { PacketFiltersDialogComponent } from '../../../packet-capturing/packet-filters/packet-filters.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-packet-filters-action',
|
||||
templateUrl: './packet-filters-action.component.html'
|
||||
})
|
||||
export class PacketFiltersActionComponent {
|
||||
@Input() server: Server;
|
||||
@Input() project: Project;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(private dialog: MatDialog) {}
|
||||
|
||||
openPacketFilters() {
|
||||
const dialogRef = this.dialog.open(PacketFiltersDialogComponent, {
|
||||
width: '900px',
|
||||
height: '400px',
|
||||
autoFocus: false
|
||||
});
|
||||
let instance = dialogRef.componentInstance;
|
||||
instance.server = this.server;
|
||||
instance.project = this.project;
|
||||
instance.link = this.link;
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item *ngIf="link.suspend" (click)="resumeLink()">
|
||||
<mat-icon>play_arrow</mat-icon>
|
||||
<span>Resume</span>
|
||||
</button>
|
@ -0,0 +1,22 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { LinkService } from '../../../../../services/link.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-resume-link-action',
|
||||
templateUrl: './resume-link-action.component.html'
|
||||
})
|
||||
export class ResumeLinkActionComponent {
|
||||
@Input() server: Server;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService
|
||||
) {}
|
||||
|
||||
resumeLink() {
|
||||
this.link.suspend = false;
|
||||
this.linkService.updateLink(this.server, this.link).subscribe(() => {});
|
||||
}
|
||||
}
|
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item *ngIf="!link.capturing" (click)="startCapture()">
|
||||
<mat-icon>loupe</mat-icon>
|
||||
<span>Start capture</span>
|
||||
</button>
|
@ -0,0 +1,26 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { MatDialog } from '@angular/material';
|
||||
import { StartCaptureDialogComponent } from '../../../packet-capturing/start-capture/start-capture.component';
|
||||
|
||||
@Component({
|
||||
selector: 'app-start-capture-action',
|
||||
templateUrl: './start-capture-action.component.html'
|
||||
})
|
||||
export class StartCaptureActionComponent {
|
||||
@Input() server: Server;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(private dialog: MatDialog) {}
|
||||
|
||||
startCapture() {
|
||||
const dialogRef = this.dialog.open(StartCaptureDialogComponent, {
|
||||
width: '400px',
|
||||
autoFocus: false
|
||||
});
|
||||
let instance = dialogRef.componentInstance;
|
||||
instance.server = this.server;
|
||||
instance.link = this.link;
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
@ -7,7 +7,7 @@ import { Node } from '../../../../../cartography/models/node';
|
||||
selector: 'app-start-node-action',
|
||||
templateUrl: './start-node-action.component.html'
|
||||
})
|
||||
export class StartNodeActionComponent implements OnInit {
|
||||
export class StartNodeActionComponent implements OnInit, OnChanges {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
isNodeWithStoppedStatus: boolean;
|
||||
@ -15,11 +15,17 @@ export class StartNodeActionComponent implements OnInit {
|
||||
constructor(private nodeService: NodeService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'stopped') {
|
||||
this.isNodeWithStoppedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStoppedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'stopped') {
|
||||
this.isNodeWithStoppedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
startNodes() {
|
||||
|
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item *ngIf="link.capturing" (click)="stopCapture()">
|
||||
<mat-icon>pause_circle_filled</mat-icon>
|
||||
<span>Stop capture</span>
|
||||
</button>
|
@ -0,0 +1,21 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { LinkService } from '../../../../../services/link.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-stop-capture-action',
|
||||
templateUrl: './stop-capture-action.component.html'
|
||||
})
|
||||
export class StopCaptureActionComponent {
|
||||
@Input() server: Server;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService
|
||||
) {}
|
||||
|
||||
stopCapture() {
|
||||
this.linkService.stopCaptureOnLink(this.server, this.link).subscribe(() => {});
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
import { Component, Input, OnInit } from '@angular/core';
|
||||
import { Component, Input, OnInit, OnChanges } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { NodeService } from '../../../../../services/node.service';
|
||||
import { Node } from '../../../../../cartography/models/node';
|
||||
@ -7,7 +7,7 @@ import { Node } from '../../../../../cartography/models/node';
|
||||
selector: 'app-stop-node-action',
|
||||
templateUrl: './stop-node-action.component.html'
|
||||
})
|
||||
export class StopNodeActionComponent implements OnInit {
|
||||
export class StopNodeActionComponent implements OnInit, OnChanges {
|
||||
@Input() server: Server;
|
||||
@Input() nodes: Node[];
|
||||
isNodeWithStartedStatus: boolean;
|
||||
@ -15,11 +15,17 @@ export class StopNodeActionComponent implements OnInit {
|
||||
constructor(private nodeService: NodeService) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'started') {
|
||||
this.isNodeWithStartedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
ngOnChanges(changes) {
|
||||
if(changes.nodes) {
|
||||
this.isNodeWithStartedStatus = false;
|
||||
this.nodes.forEach((node) => {
|
||||
if (node.status === 'started') {
|
||||
this.isNodeWithStartedStatus = true;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
stopNodes() {
|
||||
|
@ -0,0 +1,4 @@
|
||||
<button mat-menu-item *ngIf="!link.suspend" (click)="suspendLink()">
|
||||
<mat-icon>pause</mat-icon>
|
||||
<span>Suspend</span>
|
||||
</button>
|
@ -0,0 +1,22 @@
|
||||
import { Component, Input } from '@angular/core';
|
||||
import { Server } from '../../../../../models/server';
|
||||
import { Link } from '../../../../../models/link';
|
||||
import { LinkService } from '../../../../../services/link.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-suspend-link-action',
|
||||
templateUrl: './suspend-link-action.component.html'
|
||||
})
|
||||
export class SuspendLinkActionComponent {
|
||||
@Input() server: Server;
|
||||
@Input() link: Link;
|
||||
|
||||
constructor(
|
||||
private linkService: LinkService
|
||||
) {}
|
||||
|
||||
suspendLink() {
|
||||
this.link.suspend = true;
|
||||
this.linkService.updateLink(this.server, this.link).subscribe(() => {});
|
||||
}
|
||||
}
|
@ -32,6 +32,34 @@
|
||||
[nodes]="nodes"
|
||||
[drawings]="drawings"
|
||||
></app-move-layer-down-action>
|
||||
<app-start-capture-action
|
||||
*ngIf="!projectService.isReadOnly(project) && isBundledServer
|
||||
&& drawings.length===0 && nodes.length===0 && links.length===1"
|
||||
[server]="server"
|
||||
[link]="links[0]"
|
||||
></app-start-capture-action>
|
||||
<app-stop-capture-action
|
||||
*ngIf="!projectService.isReadOnly(project) && isBundledServer
|
||||
&& drawings.length===0 && nodes.length===0 && links.length===1"
|
||||
[server]="server"
|
||||
[link]="links[0]"
|
||||
></app-stop-capture-action>
|
||||
<app-packet-filters-action
|
||||
*ngIf="!projectService.isReadOnly(project) && drawings.length===0 && nodes.length===0 && links.length===1"
|
||||
[server]="server"
|
||||
[project]="project"
|
||||
[link]="links[0]"
|
||||
></app-packet-filters-action>
|
||||
<app-resume-link-action
|
||||
*ngIf="!projectService.isReadOnly(project) && drawings.length===0 && nodes.length===0 && links.length===1"
|
||||
[server]="server"
|
||||
[link]="links[0]"
|
||||
></app-resume-link-action>
|
||||
<app-suspend-link-action
|
||||
*ngIf="!projectService.isReadOnly(project) && drawings.length===0 && nodes.length===0 && links.length===1"
|
||||
[server]="server"
|
||||
[link]="links[0]"
|
||||
></app-suspend-link-action>
|
||||
<app-delete-action
|
||||
*ngIf="!projectService.isReadOnly(project)"
|
||||
[server]="server"
|
||||
|
@ -8,6 +8,7 @@ import { MatMenuModule, MatMenuTrigger } from '@angular/material';
|
||||
import { Drawing } from '../../../cartography/models/drawing';
|
||||
import { RectElement } from '../../../cartography/models/drawings/rect-element';
|
||||
import { TextElement } from '../../../cartography/models/drawings/text-element';
|
||||
import { Server } from '../../../models/server';
|
||||
|
||||
describe('ContextMenuComponent', () => {
|
||||
let component: ContextMenuComponent;
|
||||
@ -28,6 +29,7 @@ describe('ContextMenuComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(ContextMenuComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.server = {location: 'local'} as Server;
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@ -33,6 +33,7 @@ export class ContextMenuComponent implements OnInit {
|
||||
|
||||
hasTextCapabilities = false;
|
||||
isElectronApp = false;
|
||||
isBundledServer: boolean = false;
|
||||
|
||||
constructor(
|
||||
private sanitizer: DomSanitizer,
|
||||
@ -43,7 +44,9 @@ export class ContextMenuComponent implements OnInit {
|
||||
|
||||
ngOnInit() {
|
||||
this.setPosition(0, 0);
|
||||
|
||||
this.isElectronApp = this.electronService.isElectronApp;
|
||||
this.isBundledServer = this.server.location === 'bundled';
|
||||
}
|
||||
|
||||
public setPosition(top: number, left: number) {
|
||||
|
Reference in New Issue
Block a user