mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-01-18 10:46:35 +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 { MapLink } from '../models/map/map-link';
|
||||
import { SelectionManager } from '../managers/selection-manager';
|
||||
import { event } from 'd3-selection';
|
||||
import { LinkContextMenu } from '../events/event-source';
|
||||
|
||||
@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)})
|
||||
.append<SVGGElement>('g')
|
||||
.on('contextmenu', (datum: MapLink) => {
|
||||
event.preventDefault();
|
||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
||||
const evt = event;
|
||||
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||
})
|
||||
.attr('class', 'capture-icon')
|
||||
.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')
|
||||
.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)})
|
||||
.append<SVGGElement>('g')
|
||||
.on('contextmenu', (datum: MapLink) => {
|
||||
event.preventDefault();
|
||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
||||
const evt = event;
|
||||
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||
})
|
||||
.attr('class', 'filter-capture-icon')
|
||||
.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')
|
||||
.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)})
|
||||
.append<SVGGElement>('g')
|
||||
.on('contextmenu', (datum: MapLink) => {
|
||||
event.preventDefault();
|
||||
this.onContextMenu.emit(new LinkContextMenu(event, datum));
|
||||
const evt = event;
|
||||
this.onContextMenu.emit(new LinkContextMenu(evt, datum));
|
||||
})
|
||||
.attr('class', 'filter-icon')
|
||||
.attr('width', '48px')
|
||||
.attr('height', '48px')
|
||||
.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')
|
||||
.append<SVGImageElement>('image')
|
||||
.attr('width', '48px')
|
||||
.attr('height', '48px')
|
||||
.attr("xlink:href", "assets/resources/images/filter.svg");
|
||||
|
||||
const serial_link_widget = new SerialLinkWidget();
|
||||
|
@ -18,6 +18,9 @@
|
||||
formControlName="fileName"
|
||||
matInput type="text">
|
||||
</mat-form-field>
|
||||
<!-- <mat-checkbox [ngModelOptions]="{standalone: true}" [(ngModel)]="startProgram">
|
||||
Start the capture visualization program
|
||||
</mat-checkbox> -->
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
@ -44,8 +44,7 @@ describe('StartCaptureDialogComponent', () => {
|
||||
beforeEach(() => {
|
||||
fixture = TestBed.createComponent(StartCaptureDialogComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.link = {link_type: 'ethernet', nodes: [{node_id: '1'}]} as Link;
|
||||
fixture.detectChanges();
|
||||
component.link = {link_type: 'ethernet', nodes: [{node_id: '1'}, {node_id: '2'}]} as Link;
|
||||
});
|
||||
|
||||
it('should create', () => {
|
||||
|
@ -20,6 +20,7 @@ export class StartCaptureDialogComponent implements OnInit {
|
||||
link: Link;
|
||||
linkTypes = [];
|
||||
inputForm: FormGroup;
|
||||
startProgram: boolean;
|
||||
|
||||
constructor(
|
||||
private dialogRef: MatDialogRef<PacketFiltersDialogComponent>,
|
||||
@ -47,6 +48,12 @@ export class StartCaptureDialogComponent implements OnInit {
|
||||
["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() {
|
||||
|
Loading…
Reference in New Issue
Block a user