Commit b22649bf by Marcus Efraimsson Committed by GitHub

Dashboard: Handle min refresh interval when importing dashboard (#23959)

If refresh interval is lower than minimum refresh interval
when importing dashboard, use the minimum refresh interval
instead of returning error.

Fixes #23099
parent 0a1650d2
...@@ -323,6 +323,11 @@ func (dr *dashboardServiceImpl) deleteDashboard(dashboardId int64, orgId int64, ...@@ -323,6 +323,11 @@ func (dr *dashboardServiceImpl) deleteDashboard(dashboardId int64, orgId int64,
} }
func (dr *dashboardServiceImpl) ImportDashboard(dto *SaveDashboardDTO) (*models.Dashboard, error) { func (dr *dashboardServiceImpl) ImportDashboard(dto *SaveDashboardDTO) (*models.Dashboard, error) {
if err := validateDashboardRefreshInterval(dto.Dashboard); err != nil {
dr.log.Warn("Changing refresh interval for imported dashboard to minimum refresh interval", "dashboardUid", dto.Dashboard.Uid, "dashboardTitle", dto.Dashboard.Title, "minRefreshInterval", setting.MinRefreshInterval)
dto.Dashboard.Data.Set("refresh", setting.MinRefreshInterval)
}
cmd, err := dr.buildSaveDashboardCommand(dto, false, true) cmd, err := dr.buildSaveDashboardCommand(dto, false, true)
if err != nil { if err != nil {
return nil, err return nil, err
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment