rose bush: improve filtering of job states.

This change makes it possible to filter state over all
jobs, as opposed to the old behaviour of filtering state
only on task final statuses.

This is done by calculating state filtering in Python
rather than via a SQL query.

The state filtering API and GUI is improved to avoid
negative logic.