Dashboard: Use same min refresh interval fallback in the API as in provisioning (#25926)

* Dashboard: Solve the discrepancy between provisioning and the API, Handle min refresh interval when creating/updating dashboard via API

* Docs: Add refresh field in the example dashboard http api docs

* Update create dashboard API docs

Add refresh field in the create dashboard example response

* Fix create dashboard API docs

* Fix create dashboard API docs

* Update docs/sources/http_api/dashboard.md

Co-authored-by: Sofia Papagiannaki <papagian@users.noreply.github.com>
Co-authored-by: Diana Payton <52059945+oddlittlebird@users.noreply.github.com>
This commit is contained in:
Kirchen99
2020-08-17 21:00:10 +02:00
committed by GitHub
parent 900eb8070e
commit 5da3276db1
2 changed files with 8 additions and 1 deletions

View File

@@ -277,6 +277,11 @@ func (dr *dashboardServiceImpl) SaveFolderForProvisionedDashboards(dto *SaveDash
}
func (dr *dashboardServiceImpl) SaveDashboard(dto *SaveDashboardDTO, allowUiUpdate bool) (*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, true, !allowUiUpdate)
if err != nil {
return nil, err