metron-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nickal...@apache.org
Subject [34/50] [abbrv] metron git commit: METRON-1734 Src and Dst port filters are incorrect after changing to empty (merrimanr) closes apache/metron#1159
Date Fri, 31 Aug 2018 19:20:30 GMT
METRON-1734 Src and Dst port filters are incorrect after changing to empty (merrimanr) closes
apache/metron#1159


Project: http://git-wip-us.apache.org/repos/asf/metron/repo
Commit: http://git-wip-us.apache.org/repos/asf/metron/commit/ba0a6092
Tree: http://git-wip-us.apache.org/repos/asf/metron/tree/ba0a6092
Diff: http://git-wip-us.apache.org/repos/asf/metron/diff/ba0a6092

Branch: refs/remotes/apache/feature/METRON-1699-create-batch-profiler
Commit: ba0a6092c97d23c118c2b5780c2559c2f849a220
Parents: 7a8c246
Author: merrimanr <merrimanr@gmail.com>
Authored: Mon Aug 13 15:42:29 2018 -0500
Committer: rmerriman <merrimanr@gmail.com>
Committed: Mon Aug 13 15:42:29 2018 -0500

----------------------------------------------------------------------
 .../pcap/pcap-filters/pcap-filters.component.spec.ts   | 13 +++++++++++++
 .../app/pcap/pcap-filters/pcap-filters.component.ts    |  4 ++++
 2 files changed, 17 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/metron/blob/ba0a6092/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
b/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
index c1d8664..3f1ab07 100644
--- a/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
+++ b/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.spec.ts
@@ -179,6 +179,19 @@ describe('PcapFiltersComponent', () => {
     component.onSubmit();
   });
 
+  it('Port fields should be removed from request when set to empty', () => {
+    component.model.ipSrcPort = 44;
+    component.model.ipDstPort = 44;
+    component.ipSrcPort = '';
+    component.ipDstPort = '';
+
+    component.search.emit = (model: PcapRequest) => {
+      expect(model.ipSrcPort).toBeFalsy();
+      expect(model.ipDstPort).toBeFalsy();
+    };
+    component.onSubmit();
+  });
+
   it('Filter should have an output called search', () => {
     component.search.subscribe((filterModel) => {
       expect(filterModel).toBeDefined();

http://git-wip-us.apache.org/repos/asf/metron/blob/ba0a6092/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
----------------------------------------------------------------------
diff --git a/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
b/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
index 20a8c2b..df91ae3 100644
--- a/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
+++ b/metron-interface/metron-alerts/src/app/pcap/pcap-filters/pcap-filters.component.ts
@@ -63,9 +63,13 @@ export class PcapFiltersComponent implements OnInit, OnChanges {
     this.model.endTimeMs = new Date(this.endTimeStr).getTime();
     if (this.ipSrcPort !== '') {
       this.model.ipSrcPort = +this.ipSrcPort;
+    } else {
+      delete this.model.ipSrcPort;
     }
     if (this.ipDstPort !== '') {
       this.model.ipDstPort = +this.ipDstPort;
+    } else {
+      delete this.model.ipDstPort;
     }
 
     this.search.emit(this.model);


Mime
View raw message