,
+ private linkService: LinkService,
+ private formBuilder: FormBuilder,
+ private toasterService: ToasterService,
+ private nodesDataSource: NodesDataSource
+ ) {
+ this.inputForm = this.formBuilder.group({
+ linkType: new FormControl('', Validators.required),
+ fileName: new FormControl('', Validators.required)
+ });
+ }
+
+ ngOnInit() {
+ if (this.link.link_type === 'ethernet') {
+ this.linkTypes = [
+ ["Ethernet", "DLT_EN10MB"]
+ ];
+ } else {
+ this.linkTypes = [
+ ["Cisco HDLC", "DLT_C_HDLC"],
+ ["Cisco PPP", "DLT_PPP_SERIAL"],
+ ["Frame Relay", "DLT_FRELAY"],
+ ["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() {
+ let isAnyRunningDevice = false;
+ this.link.nodes.forEach((linkNode: LinkNode) => {
+ let node = this.nodesDataSource.get(linkNode.node_id);
+ if (node.status === 'started') isAnyRunningDevice = true;
+ });
+
+ if (!isAnyRunningDevice) {
+ this.toasterService.error(`Cannot capture because there is no running device on this link`);
+ } else if (this.inputForm.invalid) {
+ this.toasterService.error(`Fill all required fields`);
+ } else {
+ let captureSettings: CapturingSettings = {
+ capture_file_name: this.inputForm.get('fileName').value,
+ data_link_type: this.inputForm.get('linkType').value
+ };
+
+ this.linkService.startCaptureOnLink(this.server, this.link, captureSettings).subscribe(() => {
+ this.dialogRef.close();
+ });
+ }
+ }
+
+ onNoClick() {
+ this.dialogRef.close();
+ }
+}
diff --git a/src/app/components/project-map/project-map.component.html b/src/app/components/project-map/project-map.component.html
index c79bad23..eceb368e 100644
--- a/src/app/components/project-map/project-map.component.html
+++ b/src/app/components/project-map/project-map.component.html
@@ -33,7 +33,7 @@
-
+
@@ -48,7 +48,7 @@
-
+
@@ -60,13 +60,13 @@
-
-
+
zoom_out_map
@@ -80,18 +80,20 @@
-
+
settings_applications
-