PublicDashboards: Resolve interval for public dashboard data source (#55489)

* Resolve interval for public dashboard data source

* Remove type assertions in favor of 'in'

* Add org id to public dashboard requests
This commit is contained in:
Guilherme Caulada
2022-09-21 13:29:27 -03:00
committed by GitHub
parent 48a8b35ece
commit 9c2f3045b4
5 changed files with 65 additions and 20 deletions
@@ -2,6 +2,7 @@ package api
import (
"net/http"
"strconv"
"github.com/grafana/grafana/pkg/infra/metrics"
"github.com/grafana/grafana/pkg/models"
@@ -11,6 +12,12 @@ import (
func SetPublicDashboardFlag() func(c *models.ReqContext) {
return func(c *models.ReqContext) {
// TODO: Find a better place to set this, or rename this function
orgIDValue := c.Req.URL.Query().Get("orgId")
orgID, err := strconv.ParseInt(orgIDValue, 10, 64)
if err == nil && orgID > 0 && orgID != c.OrgID {
c.OrgID = orgID
}
c.IsPublicDashboardView = true
}
}