Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 monitor middleware - fix ignore custom settings #2024

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
19 changes: 10 additions & 9 deletions middleware/monitor/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,8 @@ func configDefault(config ...Config) Config {
if cfg.ChartJsURL == "" {
cfg.ChartJsURL = defaultChartJsURL
}
if cfg.Title == ConfigDefault.Title && cfg.Refresh == ConfigDefault.Refresh {
cfg.index = ConfigDefault.index
} else {
if cfg.Refresh < minRefresh {
cfg.Refresh = minRefresh
}
// update cfg.index with custom title/refresh
cfg.index = newIndex(viewBag{cfg.Title,
cfg.Refresh, cfg.FontURL, cfg.ChartJsURL, cfg.CustomHead})
if cfg.Refresh < minRefresh {
cfg.Refresh = minRefresh
}

if cfg.Next == nil {
Expand All @@ -115,5 +108,13 @@ func configDefault(config ...Config) Config {
cfg.APIOnly = ConfigDefault.APIOnly
}

if cfg.Title == ConfigDefault.Title && cfg.Refresh == ConfigDefault.Refresh {
cfg.index = ConfigDefault.index
} else {
// update cfg.index with custom title/refresh
cfg.index = newIndex(viewBag{cfg.Title,
cfg.Refresh, cfg.FontURL, cfg.ChartJsURL, cfg.CustomHead})
wangjq4214 marked this conversation as resolved.
Show resolved Hide resolved
}

return cfg
}