refactor linux dashboard
This commit is contained in:
parent
7c351e09e5
commit
64646d2ace
File diff suppressed because it is too large
Load Diff
|
@ -13,10 +13,10 @@ import (
|
|||
|
||||
type TagFilter struct {
|
||||
Key string `json:"key"` // tag key
|
||||
Func string `json:"func"` // == | =~ | in
|
||||
Func string `json:"func"` // `==` | `=~` | `in` | `!=` | `!~` | `not in`
|
||||
Value string `json:"value"` // tag value
|
||||
Regexp *regexp.Regexp // parse value to regexp if func = '=~'
|
||||
Vset map[string]struct{} // parse value to regexp if func = 'in'
|
||||
Regexp *regexp.Regexp // parse value to regexp if func = '=~' or '!~'
|
||||
Vset map[string]struct{} // parse value to regexp if func = 'in' or 'not in'
|
||||
}
|
||||
|
||||
type AlertMute struct {
|
||||
|
|
|
@ -88,12 +88,12 @@ func (s *AlertSubscribe) Parse() error {
|
|||
}
|
||||
|
||||
for i := 0; i < len(s.ITags); i++ {
|
||||
if s.ITags[i].Func == "=~" {
|
||||
if s.ITags[i].Func == "=~" || s.ITags[i].Func == "!~" {
|
||||
s.ITags[i].Regexp, err = regexp.Compile(s.ITags[i].Value)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
} else if s.ITags[i].Func == "in" {
|
||||
} else if s.ITags[i].Func == "in" || s.ITags[i].Func == "not in" {
|
||||
arr := strings.Fields(s.ITags[i].Value)
|
||||
s.ITags[i].Vset = make(map[string]struct{})
|
||||
for j := 0; j < len(arr); j++ {
|
||||
|
|
Loading…
Reference in New Issue