Kaynağa Gözat

dashboards: should be possible to browse dashboard using only uid

That is, the slug part of url should be optional.
Closes #11231
Marcus Efraimsson 7 yıl önce
ebeveyn
işleme
5fbfd67b94
2 değiştirilmiş dosya ile 7 ekleme ve 0 silme
  1. 1 0
      pkg/api/api.go
  2. 6 0
      public/app/routes/routes.ts

+ 1 - 0
pkg/api/api.go

@@ -66,6 +66,7 @@ func (hs *HttpServer) registerRoutes() {
 	r.Get("/plugins/:id/page/:page", reqSignedIn, Index)
 
 	r.Get("/d/:uid/:slug", reqSignedIn, Index)
+	r.Get("/d/:uid", reqSignedIn, Index)
 	r.Get("/dashboard/db/:slug", reqSignedIn, redirectFromLegacyDashboardUrl, Index)
 	r.Get("/dashboard/script/*", reqSignedIn, Index)
 	r.Get("/dashboard-solo/snapshot/*", Index)

+ 6 - 0
public/app/routes/routes.ts

@@ -22,6 +22,12 @@ export function setupAngularRoutes($routeProvider, $locationProvider) {
       reloadOnSearch: false,
       pageClass: 'page-dashboard',
     })
+    .when('/d/:uid', {
+      templateUrl: 'public/app/partials/dashboard.html',
+      controller: 'LoadDashboardCtrl',
+      reloadOnSearch: false,
+      pageClass: 'page-dashboard',
+    })
     .when('/dashboard/:type/:slug', {
       templateUrl: 'public/app/partials/dashboard.html',
       controller: 'LoadDashboardCtrl',