DarkShield / daDashboard

Dashboard Frontend
0 stars 0 forks source link

Create custom filters #57

Closed ProZachJ closed 10 years ago

ProZachJ commented 10 years ago

The traffic controller currently has a function called doFilter that handles chaining all of the needed inputs into a filter so that the drop-downs, searches, and select boxes all work together. We should factor this out into a service that accepts an array of the scope items to be filtered and returns the filtered result. Usually this filtered result will be passed to the pagination service by a controller function but they should probably be kept separate for the case that we want to filter non paginated data.

ProZachJ commented 10 years ago

This might be a custom filter instead of a service, but I'll need to do a bit of doc reading to make sure that is the correct use case.

ProZachJ commented 10 years ago

Custom filters will allow us to specify the exact portion of the object that should be matched against. Currently by using the generic filter service we are doing a complete string match on every property in each object. This has two distinct disadvantages:

1) It is overly generic. If I select mattjay.com from the domain dropdown, http://anysite.com?mattjay.com would be in the filtered dataset.

2) It is slower and more resource heavy than it could/should be.

Filters needed:

@mattjay should we leave the QueryFilter as a generic string search on all properties or refine it down to only properties displayed in the table?

ProZachJ commented 10 years ago

http://stackoverflow.com/questions/17798162/chaining-angular-filters-in-controller-while-making-them-variable

mattjay commented 10 years ago

@ProZachJ good call on Attack filter. Lets make it a drop down with 'All Attacks' then a list of the types then a 'All Traffic' which will be everything including non-attacks. Will write the filter accordingly.

mattjay commented 10 years ago

Whelp this is done.

I think we should leave Query as an entire object search even if we aren't displaying it all. It'll seem like magic if it finds something else :wink: