@@ -13,6 +13,7 @@ import (
13
13
"github.com/grafana/grafana/pkg/services/dashboards"
14
14
"github.com/grafana/grafana/pkg/services/datasources"
15
15
"github.com/grafana/grafana/pkg/services/featuremgmt"
16
+ publicdashboardsapi "github.com/grafana/grafana/pkg/services/publicdashboards/api"
16
17
"github.com/grafana/grafana/pkg/services/serviceaccounts"
17
18
"github.com/grafana/grafana/pkg/web"
18
19
)
@@ -103,6 +104,10 @@ func (hs *HTTPServer) registerRoutes() {
103
104
r .Get ("/dashboards/*" , reqSignedIn , hs .Index )
104
105
r .Get ("/goto/:uid" , reqSignedIn , hs .redirectFromShortURL , hs .Index )
105
106
107
+ if hs .Features .IsEnabled (featuremgmt .FlagPublicDashboards ) {
108
+ r .Get ("/public-dashboards/:accessToken" , publicdashboardsapi .SetPublicDashboardFlag (), hs .Index )
109
+ }
110
+
106
111
r .Get ("/explore" , authorize (func (c * models.ReqContext ) {
107
112
if f , ok := reqSignedIn .(func (c * models.ReqContext )); ok {
108
113
f (c )
@@ -391,11 +396,6 @@ func (hs *HTTPServer) registerRoutes() {
391
396
})
392
397
393
398
dashboardRoute .Group ("/uid/:uid" , func (dashUidRoute routing.RouteRegister ) {
394
- if hs .Features .IsEnabled (featuremgmt .FlagPublicDashboards ) {
395
- dashUidRoute .Get ("/public-config" , authorize (reqSignedIn , ac .EvalPermission (dashboards .ActionDashboardsWrite )), routing .Wrap (hs .GetPublicDashboardConfig ))
396
- dashUidRoute .Post ("/public-config" , authorize (reqSignedIn , ac .EvalPermission (dashboards .ActionDashboardsWrite )), routing .Wrap (hs .SavePublicDashboardConfig ))
397
- }
398
-
399
399
if hs .ThumbService != nil {
400
400
dashUidRoute .Get ("/img/:kind/:theme" , hs .ThumbService .GetImage )
401
401
if hs .Features .IsEnabled (featuremgmt .FlagDashboardPreviewsAdmin ) {
@@ -598,7 +598,7 @@ func (hs *HTTPServer) registerRoutes() {
598
598
// grafana.net proxy
599
599
r .Any ("/api/gnet/*" , reqSignedIn , hs .ProxyGnetRequest )
600
600
601
- // Gravatar service.
601
+ // Gravatar service
602
602
r .Get ("/avatar/:hash" , hs .AvatarCacheServer .Handler )
603
603
604
604
// Snapshots
@@ -608,13 +608,6 @@ func (hs *HTTPServer) registerRoutes() {
608
608
r .Get ("/api/snapshots-delete/:deleteKey" , reqSnapshotPublicModeOrSignedIn , routing .Wrap (hs .DeleteDashboardSnapshotByDeleteKey ))
609
609
r .Delete ("/api/snapshots/:key" , reqEditorRole , routing .Wrap (hs .DeleteDashboardSnapshot ))
610
610
611
- // Public API
612
- if hs .Features .IsEnabled (featuremgmt .FlagPublicDashboards ) {
613
- r .Get ("/public-dashboards/:accessToken" , middleware .SetPublicDashboardFlag (), hs .Index )
614
- r .Get ("/api/public/dashboards/:accessToken" , routing .Wrap (hs .GetPublicDashboard ))
615
- r .Post ("/api/public/dashboards/:accessToken/panels/:panelId/query" , routing .Wrap (hs .QueryPublicDashboard ))
616
- }
617
-
618
611
// Frontend logs
619
612
sourceMapStore := frontendlogging .NewSourceMapStore (hs .Cfg , hs .pluginStaticRouteResolver , frontendlogging .ReadSourceMapFromFS )
620
613
r .Post ("/log" , middleware .RateLimit (hs .Cfg .Sentry .EndpointRPS , hs .Cfg .Sentry .EndpointBurst , time .Now ),
0 commit comments