diff --git a/cmd/dashboard/controller/member_api.go b/cmd/dashboard/controller/member_api.go index 195e369..c3e5564 100644 --- a/cmd/dashboard/controller/member_api.go +++ b/cmd/dashboard/controller/member_api.go @@ -235,6 +235,7 @@ func (ma *memberAPI) addOrEditMonitor(c *gin.Context) { m.Cover = mf.Cover m.Notify = mf.Notify == "on" m.Duration = mf.Duration + err = m.InitSkipServers() } if err == nil { if m.ID == 0 { diff --git a/model/monitor.go b/model/monitor.go index 39b2a7c..cb8dd19 100644 --- a/model/monitor.go +++ b/model/monitor.go @@ -79,3 +79,15 @@ func (m *Monitor) AfterFind(tx *gorm.DB) error { func IsServiceSentinelNeeded(t uint64) bool { return t != TaskTypeCommand && t != TaskTypeTerminal && t != TaskTypeUpgrade } + +func (m *Monitor) InitSkipServers() error { + var skipServers []uint64 + if err := json.Unmarshal([]byte(m.SkipServersRaw), &skipServers); err != nil { + return err + } + m.SkipServers = make(map[uint64]bool) + for i := 0; i < len(skipServers); i++ { + m.SkipServers[skipServers[i]] = true + } + return nil +}