Merge pull request #11862 from zhaoxiangchun/feature/zxc-meter-pro-domain-master

fix(monitor): add used_by list filter
This commit is contained in:
Zexi Li
2021-08-11 20:04:39 +08:00
committed by GitHub
2 changed files with 6 additions and 1 deletions
+1
View File
@@ -100,6 +100,7 @@ type CommonAlertListInput struct {
Level string `json:"level"`
ResType []string `json:"res_type"`
UsedBy string `json:"used_by"`
}
type CommonAlertUpdateInput struct {
+5 -1
View File
@@ -408,7 +408,11 @@ func (man *SCommonAlertManager) ListItemFilter(
}
func (man *SCommonAlertManager) FieldListFilter(q *sqlchemy.SQuery, input monitor.CommonAlertListInput) {
q.Filter(sqlchemy.IsNull(q.Field("used_by")))
if len(input.UsedBy) == 0 {
q.Filter(sqlchemy.IsNull(q.Field("used_by")))
} else {
q.Equals("used_by", input.UsedBy)
}
if len(input.Level) > 0 {
q.Equals("level", input.Level)