ruffle1986 commented on a change in pull request #1356: METRON-2029: Configure 
Table should have filter
URL: https://github.com/apache/metron/pull/1356#discussion_r265192269
 
 

 ##########
 File path: 
metron-interface/metron-alerts/src/app/alerts/configure-table/configure-table.component.ts
 ##########
 @@ -91,6 +95,46 @@ export class ConfigureTableComponent implements OnInit {
     });
   }
 
+  ngAfterViewInit() {
+    fromEvent(this.filterColResults.nativeElement, 'keyup')
+      .pipe(debounceTime(250))
+      .subscribe(e => {
+        this.filterColumns(e['target'].value);
+      });
+  }
+
+  filterColumns(val) {
+    const words = val.trim().split(' ');
+    this.filteredColumns = this.allColumns.filter(col => {
+      if (col.displayName) {
+        if (this.colMissingFilterKeyword(words, col, true)) {
+          return false;
+        } else {
+          return true;
+        }
+      } else {
+        if (this.colMissingFilterKeyword(words, col)) {
+          return false;
+        } else {
+          return true;
+        }
+      }
+    });
+  }
 
 Review comment:
   It's way explicit, which is a good thing in general but in my opinion, we 
can save a few extra lines here:
   
   ```
   filterColumns(val) {
     const words = val.trim().split(' ');
     this.filteredColumns = this.allColumns.filter(col => {
       return !this.colMissingFilterKeyword(words, col, col.displayName)
     });
   }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to