mirror of
https://github.com/grafana/grafana.git
synced 2025-08-26 16:30:47 +08:00
Chore: Move remaining web framework code to pkg/web, remove macaron binding module (#43018)
* remove macaron binding dependency * completely purge macaron binding * move everything to pkg/web * remove non-go files from pkg/web * clean up leftovers of macaron imports * make linter happy
This commit is contained in:
@ -22,7 +22,6 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/guardian"
|
||||
"github.com/grafana/grafana/pkg/util"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
const (
|
||||
@ -566,7 +565,7 @@ func GetDashboardVersion(c *models.ReqContext) response.Response {
|
||||
return dashboardGuardianResponse(err)
|
||||
}
|
||||
|
||||
version, _ := strconv.ParseInt(macaron.Params(c.Req)[":id"], 10, 32)
|
||||
version, _ := strconv.ParseInt(web.Params(c.Req)[":id"], 10, 32)
|
||||
query := models.GetDashboardVersionQuery{
|
||||
OrgId: c.OrgId,
|
||||
DashboardId: dashID,
|
||||
|
@ -11,7 +11,6 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/macaron.v1"
|
||||
|
||||
"github.com/grafana/grafana/pkg/api/routing"
|
||||
"github.com/grafana/grafana/pkg/bus"
|
||||
@ -20,9 +19,10 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/licensing"
|
||||
"github.com/grafana/grafana/pkg/services/sqlstore"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
)
|
||||
|
||||
func setupOAuthTest(t *testing.T, cfg *setting.Cfg) *macaron.Macaron {
|
||||
func setupOAuthTest(t *testing.T, cfg *setting.Cfg) *web.Mux {
|
||||
t.Helper()
|
||||
|
||||
if cfg == nil {
|
||||
@ -41,12 +41,12 @@ func setupOAuthTest(t *testing.T, cfg *setting.Cfg) *macaron.Macaron {
|
||||
HooksService: hooks.ProvideService(),
|
||||
}
|
||||
|
||||
m := macaron.New()
|
||||
m := web.New()
|
||||
m.Use(getContextHandler(t, cfg).Middleware)
|
||||
viewPath, err := filepath.Abs("../../public/views")
|
||||
require.NoError(t, err)
|
||||
|
||||
m.UseMiddleware(macaron.Renderer(viewPath, "[[", "]]"))
|
||||
m.UseMiddleware(web.Renderer(viewPath, "[[", "]]"))
|
||||
|
||||
m.Get("/login/:name", routing.Wrap(hs.OAuthLogin))
|
||||
return m
|
||||
|
@ -13,9 +13,9 @@ import (
|
||||
"github.com/grafana/grafana/pkg/services/secrets/fakes"
|
||||
secretsManager "github.com/grafana/grafana/pkg/services/secrets/manager"
|
||||
"github.com/grafana/grafana/pkg/setting"
|
||||
"github.com/grafana/grafana/pkg/web"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
"gopkg.in/macaron.v1"
|
||||
)
|
||||
|
||||
func TestPluginProxy(t *testing.T) {
|
||||
@ -53,7 +53,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -75,7 +75,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -98,7 +98,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -118,7 +118,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
secretsService,
|
||||
&models.ReqContext{
|
||||
SignedInUser: &models.SignedInUser{IsAnonymous: true},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -155,7 +155,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -187,7 +187,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
@ -234,7 +234,7 @@ func TestPluginProxy(t *testing.T) {
|
||||
SignedInUser: &models.SignedInUser{
|
||||
Login: "test_user",
|
||||
},
|
||||
Context: &macaron.Context{
|
||||
Context: &web.Context{
|
||||
Req: httpReq,
|
||||
},
|
||||
},
|
||||
|
Reference in New Issue
Block a user