mozilla/treeherder-ui — pull request #274 by camd (2014-11-20 16:35:04+00:00)
Title: Filter url params

This fixes the very-broken filters and their relationships with the url query params. Things were broken enough, and a refactor was due, so I did the refactor while fixing everything. This should make the code less brittle and easier to understand. Filtering has many parts, so it's still a bit complex, but the attempt is to make this MORE straightforward, at least.

* now the query string is the primary source of truth, and all filtering is driven by them (rather than them being something co-maintained along with the filters in memory)
* removed the watcher in the ``searchQuery`` controller and handled everything with direct calls to ``thJobFilters``
* refiltering is now triggered by the query string changes. When that changes, it triggers an ``onLocationChangeSuccess``. Then we check if the filter params are now different. If so, we fire a ``globalFiltersChanged`` which tells ``thCloneJobs`` to re-render.
* this has the added benefit that filters can be changed by going through the ``addFilter``, ``removeFilter`` or ``setFilter``functions in ``thJobFilters`` or they can be made directly on the ``$location.search()``. Either way, it will automatically kick-off a re-render with new filters.
* ``searchStr`` (formerly called ``searchQuery``) is now managed in the normal handling of the field-filters. This reduces code and makes it easier to follow.

The handling for hidden jobs is largely untouched. That will be refactored in another PR that will do the filtering on hidden jobs server side instead. So most of that code can likely be removed at that time.