mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-01 23:10:47 +00:00
Fixes after review
This commit is contained in:
parent
ce5c46df1a
commit
36fb802454
@ -9,6 +9,7 @@ import { InterfaceLabelWidget } from './interface-label';
|
|||||||
import { InterfaceStatusWidget } from './interface-status';
|
import { InterfaceStatusWidget } from './interface-status';
|
||||||
import { MapLink } from '../models/map/map-link';
|
import { MapLink } from '../models/map/map-link';
|
||||||
import { SelectionManager } from '../managers/selection-manager';
|
import { SelectionManager } from '../managers/selection-manager';
|
||||||
|
import { event } from 'd3-selection';
|
||||||
import { LinkContextMenu } from '../events/event-source';
|
import { LinkContextMenu } from '../events/event-source';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -40,12 +41,12 @@ export class LinkWidget implements Widget {
|
|||||||
.filter(l => { return l.capturing && !(l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
.filter(l => { return l.capturing && !(l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
||||||
.append<SVGGElement>('g')
|
.append<SVGGElement>('g')
|
||||||
.on('contextmenu', (datum: MapLink) => {
|
.on('contextmenu', (datum: MapLink) => {
|
||||||
event.preventDefault();
|
const evt = event;
|
||||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||||
})
|
})
|
||||||
.attr('class', 'capture-icon')
|
.attr('class', 'capture-icon')
|
||||||
.attr('transform', link => {
|
.attr('transform', link => {
|
||||||
return `translate (${(link.source.x + link.target.x)/2}, ${(link.source.y + link.target.y)/2}) scale(0.5)`
|
return `translate (${(link.source.x + link.target.x)/2 + 24}, ${(link.source.y + link.target.y)/2 + 24}) scale(0.5)`
|
||||||
})
|
})
|
||||||
.attr('viewBox', '0 0 20 20')
|
.attr('viewBox', '0 0 20 20')
|
||||||
.append<SVGImageElement>('image')
|
.append<SVGImageElement>('image')
|
||||||
@ -56,12 +57,12 @@ export class LinkWidget implements Widget {
|
|||||||
.filter(l => { return l.capturing && (l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
.filter(l => { return l.capturing && (l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
||||||
.append<SVGGElement>('g')
|
.append<SVGGElement>('g')
|
||||||
.on('contextmenu', (datum: MapLink) => {
|
.on('contextmenu', (datum: MapLink) => {
|
||||||
event.preventDefault();
|
const evt = event;
|
||||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||||
})
|
})
|
||||||
.attr('class', 'filter-capture-icon')
|
.attr('class', 'filter-capture-icon')
|
||||||
.attr('transform', link => {
|
.attr('transform', link => {
|
||||||
return `translate (${(link.source.x + link.target.x)/2}, ${(link.source.y + link.target.y)/2}) scale(0.5)`
|
return `translate (${(link.source.x + link.target.x)/2 + 24}, ${(link.source.y + link.target.y)/2 + 24}) scale(0.5)`
|
||||||
})
|
})
|
||||||
.attr('viewBox', '0 0 20 20')
|
.attr('viewBox', '0 0 20 20')
|
||||||
.append<SVGImageElement>('image')
|
.append<SVGImageElement>('image')
|
||||||
@ -72,15 +73,19 @@ export class LinkWidget implements Widget {
|
|||||||
.filter(l => { return !l.capturing && (l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
.filter(l => { return !l.capturing && (l.filters.bpf || l.filters.corrupt || l.filters.delay || l.filters.frequency_drop || l.filters.packet_loss)})
|
||||||
.append<SVGGElement>('g')
|
.append<SVGGElement>('g')
|
||||||
.on('contextmenu', (datum: MapLink) => {
|
.on('contextmenu', (datum: MapLink) => {
|
||||||
event.preventDefault();
|
const evt = event;
|
||||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||||
})
|
})
|
||||||
.attr('class', 'filter-icon')
|
.attr('class', 'filter-icon')
|
||||||
|
.attr('width', '48px')
|
||||||
|
.attr('height', '48px')
|
||||||
.attr('transform', link => {
|
.attr('transform', link => {
|
||||||
return `translate (${(link.source.x + link.target.x)/2}, ${(link.source.y + link.target.y)/2}) scale(0.5)`
|
return `translate (${(link.source.x + link.target.x)/2 + 24}, ${(link.source.y + link.target.y)/2 + 24}) scale(0.5)`
|
||||||
})
|
})
|
||||||
.attr('viewBox', '0 0 20 20')
|
.attr('viewBox', '0 0 20 20')
|
||||||
.append<SVGImageElement>('image')
|
.append<SVGImageElement>('image')
|
||||||
|
.attr('width', '48px')
|
||||||
|
.attr('height', '48px')
|
||||||
.attr("xlink:href", "assets/resources/images/filter.svg");
|
.attr("xlink:href", "assets/resources/images/filter.svg");
|
||||||
|
|
||||||
const serial_link_widget = new SerialLinkWidget();
|
const serial_link_widget = new SerialLinkWidget();
|
||||||
|
@ -18,6 +18,9 @@
|
|||||||
formControlName="fileName"
|
formControlName="fileName"
|
||||||
matInput type="text">
|
matInput type="text">
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
|
<!-- <mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="startProgram">
|
||||||
|
Start the capture visualization program
|
||||||
|
</mat-checkbox> -->
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
@ -44,8 +44,7 @@ describe('StartCaptureDialogComponent', () => {
|
|||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
fixture = TestBed.createComponent(StartCaptureDialogComponent);
|
fixture = TestBed.createComponent(StartCaptureDialogComponent);
|
||||||
component = fixture.componentInstance;
|
component = fixture.componentInstance;
|
||||||
component.link = {link_type: 'ethernet', nodes: [{node_id: '1'}]} as Link;
|
component.link = {link_type: 'ethernet', nodes: [{node_id: '1'}, {node_id: '2'}]} as Link;
|
||||||
fixture.detectChanges();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should create', () => {
|
it('should create', () => {
|
||||||
|
@ -20,6 +20,7 @@ export class StartCaptureDialogComponent implements OnInit {
|
|||||||
link: Link;
|
link: Link;
|
||||||
linkTypes = [];
|
linkTypes = [];
|
||||||
inputForm: FormGroup;
|
inputForm: FormGroup;
|
||||||
|
startProgram: boolean;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
private dialogRef: MatDialogRef<PacketFiltersDialogComponent>,
|
private dialogRef: MatDialogRef<PacketFiltersDialogComponent>,
|
||||||
@ -47,6 +48,12 @@ export class StartCaptureDialogComponent implements OnInit {
|
|||||||
["ATM", "DLT_ATM_RFC1483"]
|
["ATM", "DLT_ATM_RFC1483"]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sourceNode = this.nodesDataSource.get(this.link.nodes[0].node_id);
|
||||||
|
const targetNode = this.nodesDataSource.get(this.link.nodes[1].node_id);
|
||||||
|
const sourcePort = sourceNode.ports[this.link.nodes[0].port_number];
|
||||||
|
const targetPort = targetNode.ports[this.link.nodes[1].port_number];
|
||||||
|
this.inputForm.controls['fileName'].setValue(`${sourceNode.name}_${sourcePort.name}_to_${targetNode.name}_${targetPort.name}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
onYesClick() {
|
onYesClick() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user