修复管理后台页面新添加CoverIgnoreAll类型服务需要重启docker镜像的问题.

This commit is contained in:
MikoyChinese 2022-01-14 17:34:49 +08:00
parent 004f4c9ef2
commit bcb2610f0a
2 changed files with 13 additions and 0 deletions

View File

@ -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 {

View File

@ -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
}