mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-19 10:46:58 +08:00
Merge pull request #12152 from zhaoxiangchun/feature/zxc-monitor_sheild_master
fix(monitor): add record shield details param
This commit is contained in:
@@ -45,9 +45,11 @@ type MonitorResourceJointCreateInput struct {
|
||||
|
||||
type MonitorResourceJointDetails struct {
|
||||
ResName string `json:"res_name"`
|
||||
ResId string `json:"res_id"`
|
||||
ResType string `json:"res_type"`
|
||||
AlertName string `json:"alert_name"`
|
||||
AlertRule jsonutils.JSONObject `json:"alert_rule"`
|
||||
Level string `json:"level"`
|
||||
SendState string `json:"send_state"`
|
||||
State string `json:"state"`
|
||||
}
|
||||
|
||||
@@ -204,6 +204,8 @@ func (obj *SMonitorResourceAlert) getMoreDetails(detail monitor.MonitorResourceJ
|
||||
}
|
||||
detail.ResType = resources[0].ResType
|
||||
detail.ResName = resources[0].Name
|
||||
detail.ResId = resources[0].ResId
|
||||
|
||||
if len(obj.AlertRecordId) != 0 {
|
||||
record, err := AlertRecordManager.GetAlertRecord(obj.AlertRecordId)
|
||||
if err != nil {
|
||||
@@ -213,6 +215,7 @@ func (obj *SMonitorResourceAlert) getMoreDetails(detail monitor.MonitorResourceJ
|
||||
detail.Level = record.Level
|
||||
detail.AlertRule = record.AlertRule
|
||||
detail.SendState = record.SendState
|
||||
detail.State = record.State
|
||||
}
|
||||
return detail
|
||||
}
|
||||
|
||||
@@ -226,9 +226,7 @@ func (man *SAlertRecordShieldManager) ValidateCreateData(ctx context.Context, us
|
||||
if data.EndTime.Before(data.StartTime) {
|
||||
return data, httperrors.NewInputParameterError("end_time is before start_time")
|
||||
}
|
||||
if data.EndTime.Before(time.Now()) {
|
||||
return data, httperrors.NewInputParameterError("end_time is before now")
|
||||
}
|
||||
|
||||
hint := fmt.Sprintf("%s-%s", alert.Name, data.ResName)
|
||||
name, err := db.GenerateName(ctx, man, ownerId, hint)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user