mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-01 15:07:17 +08:00
fix(monitor): modify alertrecord list input
1.修改资源类型查询参数
This commit is contained in:
@@ -9,11 +9,11 @@ type AlertRecordListInput struct {
|
||||
apis.EnabledResourceBaseListInput
|
||||
apis.StatusStandaloneResourceListInput
|
||||
|
||||
AlertId string `json:"alert_id"`
|
||||
Level string `json:"level"`
|
||||
State string `json:"state"`
|
||||
ResTypes []string `json:"res_types"`
|
||||
Alerting bool `json:"alerting"`
|
||||
AlertId string `json:"alert_id"`
|
||||
Level string `json:"level"`
|
||||
State string `json:"state"`
|
||||
ResType string `json:"res_type"`
|
||||
Alerting bool `json:"alerting"`
|
||||
}
|
||||
|
||||
type AlertRecordDetails struct {
|
||||
|
||||
@@ -110,8 +110,8 @@ func (manager *SAlertRecordManager) ListItemFilter(
|
||||
} else {
|
||||
q = q.IsNotEmpty("res_type").IsNotNull("res_type")
|
||||
}
|
||||
if len(query.ResTypes) != 0 {
|
||||
q.Filter(sqlchemy.In(q.Field("res_type"), query.ResTypes))
|
||||
if len(query.ResType) != 0 {
|
||||
q.Filter(sqlchemy.Equals(q.Field("res_type"), query.ResType))
|
||||
}
|
||||
return q, nil
|
||||
}
|
||||
@@ -363,8 +363,8 @@ func (manager *SAlertRecordManager) getNowAlertingRecord(ctx context.Context, us
|
||||
query = query.Equals("state", monitor.AlertStateAlerting)
|
||||
query = query.IsNotNull("res_type").IsNotEmpty("res_type").Desc("created_at")
|
||||
|
||||
if len(input.ResTypes) != 0 {
|
||||
query = query.In("res_type", input.ResTypes)
|
||||
if len(input.ResType) != 0 {
|
||||
query = query.Equals("res_type", input.ResType)
|
||||
}
|
||||
|
||||
alertsQuery := CommonAlertManager.Query("id").Equals("state", monitor.AlertStateAlerting).IsTrue("enabled").
|
||||
|
||||
Reference in New Issue
Block a user