stra add user group detail
This commit is contained in:
parent
184c39d311
commit
0a7c8988c6
|
@ -40,19 +40,21 @@ type Stra struct {
|
||||||
WorkGroupsStr string `xorm:"work_groups" json:"-"`
|
WorkGroupsStr string `xorm:"work_groups" json:"-"`
|
||||||
Runbook string `xorm:"runbook" json:"runbook"`
|
Runbook string `xorm:"runbook" json:"runbook"`
|
||||||
|
|
||||||
ExclNid []int64 `xorm:"-" json:"excl_nid"`
|
ExclNid []int64 `xorm:"-" json:"excl_nid"`
|
||||||
Nids []string `xorm:"-" json:"nids"`
|
Nids []string `xorm:"-" json:"nids"`
|
||||||
Exprs []Exp `xorm:"-" json:"exprs"`
|
Exprs []Exp `xorm:"-" json:"exprs"`
|
||||||
Tags []Tag `xorm:"-" json:"tags"`
|
Tags []Tag `xorm:"-" json:"tags"`
|
||||||
EnableDaysOfWeek []int `xorm:"-" json:"enable_days_of_week"`
|
EnableDaysOfWeek []int `xorm:"-" json:"enable_days_of_week"`
|
||||||
Converge []int `xorm:"-" json:"converge"`
|
Converge []int `xorm:"-" json:"converge"`
|
||||||
NotifyGroup []int `xorm:"-" json:"notify_group"`
|
NotifyGroup []int64 `xorm:"-" json:"notify_group"`
|
||||||
NotifyUser []int `xorm:"-" json:"notify_user"`
|
NotifyGroupDetail []Team `xorm:"-" json:"notify_group_detail"`
|
||||||
LeafNids []int64 `xorm:"-" json:"leaf_nids"` //叶子节点id
|
NotifyUser []int64 `xorm:"-" json:"notify_user"`
|
||||||
Endpoints []string `xorm:"-" json:"endpoints"`
|
NotifyUserDetail []User `xorm:"-" json:"notify_user_detail"`
|
||||||
AlertUpgrade AlertUpgrade `xorm:"-" json:"alert_upgrade"`
|
LeafNids []int64 `xorm:"-" json:"leaf_nids"` //叶子节点id
|
||||||
JudgeInstance string `xorm:"-" json:"judge_instance"`
|
Endpoints []string `xorm:"-" json:"endpoints"`
|
||||||
WorkGroups []int `xorm:"-" json:"work_groups"`
|
AlertUpgrade AlertUpgrade `xorm:"-" json:"alert_upgrade"`
|
||||||
|
JudgeInstance string `xorm:"-" json:"judge_instance"`
|
||||||
|
WorkGroups []int `xorm:"-" json:"work_groups"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Stra) GetMetric() string {
|
func (s *Stra) GetMetric() string {
|
||||||
|
@ -504,12 +506,24 @@ func (s *Stra) Decode() error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.NotifyUserDetail, err = UserGets(s.NotifyUser, 10000, 0, "")
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("decode strategy(%d) on NotifyUserDetail fail: %v", s.Id, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
err = json.Unmarshal([]byte(s.NotifyGroupStr), &s.NotifyGroup)
|
err = json.Unmarshal([]byte(s.NotifyGroupStr), &s.NotifyGroup)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
logger.Errorf("decode strategy(%d) on NotifyGroup fail: %v", s.Id, err)
|
logger.Errorf("decode strategy(%d) on NotifyGroup fail: %v", s.Id, err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
s.NotifyGroupDetail, err = TeamGetsInIds(s.NotifyGroup, "", 10000, 0)
|
||||||
|
if err != nil {
|
||||||
|
logger.Errorf("decode strategy(%d) on NotifyGroupDetail fail: %v", s.Id, err)
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
if s.WorkGroupsStr != "" {
|
if s.WorkGroupsStr != "" {
|
||||||
err = json.Unmarshal([]byte(s.WorkGroupsStr), &s.WorkGroups)
|
err = json.Unmarshal([]byte(s.WorkGroupsStr), &s.WorkGroups)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue