view, vfilter: Add support for filtering tags and values out of a view, using !tag and field!=value.
Note that negated globs are not supported. Would have complicated the code to add them, without changing the data type serialization in a non-backwards-compatable way. This commit was sponsored by Denver Gingerich.
This commit is contained in:
parent
2432ecbdcc
commit
c2e8c21ca6
8 changed files with 82 additions and 40 deletions
|
@ -38,14 +38,20 @@ instance Arbitrary ViewComponent where
|
|||
data ViewFilter
|
||||
= FilterValues (S.Set MetaValue)
|
||||
| FilterGlob String
|
||||
| ExcludeValues (S.Set MetaValue)
|
||||
deriving (Eq, Read, Show)
|
||||
|
||||
instance Arbitrary ViewFilter where
|
||||
arbitrary = do
|
||||
size <- arbitrarySizedBoundedIntegral `suchThat` (< 100)
|
||||
FilterValues . S.fromList <$> vector size
|
||||
s <- S.fromList <$> vector size
|
||||
ifM arbitrary
|
||||
( return (FilterValues s)
|
||||
, return (ExcludeValues s)
|
||||
)
|
||||
|
||||
{- Can a ViewFilter match multiple different MetaValues? -}
|
||||
multiValue :: ViewFilter -> Bool
|
||||
multiValue (FilterValues s) = S.size s > 1
|
||||
multiValue (FilterGlob _) = True
|
||||
multiValue (ExcludeValues _) = False
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue