mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
middleware: rename org-id -> orgId
This commit is contained in:
parent
5174d050f2
commit
6115941df0
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
func OrgRedirect() macaron.Handler {
|
func OrgRedirect() macaron.Handler {
|
||||||
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
|
return func(res http.ResponseWriter, req *http.Request, c *macaron.Context) {
|
||||||
orgId := c.QueryInt64("org-id")
|
orgId := c.QueryInt64("orgId")
|
||||||
if orgId == 0 {
|
if orgId == 0 {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ func TestOrgRedirectMiddleware(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
sc.m.Get("/", sc.defaultHandler)
|
sc.m.Get("/", sc.defaultHandler)
|
||||||
sc.fakeReq("GET", "/?org-id=3").exec()
|
sc.fakeReq("GET", "/?orgId=3").exec()
|
||||||
|
|
||||||
Convey("change org and redirect", func() {
|
Convey("change org and redirect", func() {
|
||||||
So(sc.resp.Code, ShouldEqual, 302)
|
So(sc.resp.Code, ShouldEqual, 302)
|
||||||
@ -50,7 +50,7 @@ func TestOrgRedirectMiddleware(t *testing.T) {
|
|||||||
})
|
})
|
||||||
|
|
||||||
sc.m.Get("/", sc.defaultHandler)
|
sc.m.Get("/", sc.defaultHandler)
|
||||||
sc.fakeReq("GET", "/?org-id=3").exec()
|
sc.fakeReq("GET", "/?orgId=3").exec()
|
||||||
|
|
||||||
Convey("not allowed to change org", func() {
|
Convey("not allowed to change org", func() {
|
||||||
So(sc.resp.Code, ShouldEqual, 404)
|
So(sc.resp.Code, ShouldEqual, 404)
|
||||||
|
@ -113,7 +113,7 @@ func (c *EvalContext) GetRuleUrl() (string, error) {
|
|||||||
if slug, err := c.GetDashboardSlug(); err != nil {
|
if slug, err := c.GetDashboardSlug(); err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
} else {
|
} else {
|
||||||
ruleUrl := fmt.Sprintf("%sdashboard/db/%s?fullscreen&edit&tab=alert&panelId=%d&org-id=%d", setting.AppUrl, slug, c.Rule.PanelId, c.Rule.OrgId)
|
ruleUrl := fmt.Sprintf("%sdashboard/db/%s?fullscreen&edit&tab=alert&panelId=%d&orgId=%d", setting.AppUrl, slug, c.Rule.PanelId, c.Rule.OrgId)
|
||||||
return ruleUrl, nil
|
return ruleUrl, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user