filter muted checks
This adds the possibility to filter for muted checks.
This commit is contained in:
parent
8919bafb3a
commit
6f64eeace1
@ -64,6 +64,18 @@ func (f *filter) filterChecks(c *Context) {
|
||||
}
|
||||
f.Add("ac.mapping_id", "=", val[0], "int")
|
||||
f.Vals[arg] = val[0]
|
||||
case "mute":
|
||||
if val[0] == "" {
|
||||
continue
|
||||
}
|
||||
isNull := false
|
||||
if val[0] == "true" {
|
||||
isNull = true
|
||||
f.Vals[arg] = "true"
|
||||
} else if val[0] == "false" {
|
||||
f.Vals[arg] = "false"
|
||||
}
|
||||
f.AddNull("cn.check_id", isNull)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -75,6 +87,14 @@ func (f *filter) Add(field, op string, arg interface{}, castTo string) {
|
||||
f.params = append(f.params, arg)
|
||||
}
|
||||
|
||||
func (f *filter) AddNull(field string, isNull bool) {
|
||||
check := "is not null"
|
||||
if isNull {
|
||||
check = "is null"
|
||||
}
|
||||
f.where = append(f.where, fmt.Sprintf("%s %s", field, check))
|
||||
}
|
||||
|
||||
// AddSpecial lets you add a special where clause comparison where you can
|
||||
// wrap the argument in whatevery you like.
|
||||
//
|
||||
@ -82,6 +102,7 @@ func (f *filter) Add(field, op string, arg interface{}, castTo string) {
|
||||
// in the query string.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// AddSpecial("foo", "=", "to_tsvector('english', $%d), search)
|
||||
func (f *filter) AddSpecial(field, op, special string, arg interface{}) {
|
||||
f.idx += 1
|
||||
|
@ -38,6 +38,13 @@
|
||||
{{ end }}
|
||||
</select>
|
||||
</div>
|
||||
<div class="option">
|
||||
<select id="filter-mute" name="filter-mute">
|
||||
<option value="">filter muted</option>
|
||||
<option value="true" {{ if eq "true" (index .Filter.Vals "mute") }}selected{{ end }}>muted</option>
|
||||
<option value="false" {{ if eq "false" (index .Filter.Vals "mute") }}selected{{ end }}>unmuted</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="option">
|
||||
<input name="filter-search" placeholder="hostname" value="{{ .Filter.Vals.search }}" />
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user