From e1b554c61eb3e83ec3faae7bb4e79e709608de80 Mon Sep 17 00:00:00 2001 From: Marcus Efraimsson Date: Tue, 13 Mar 2018 21:06:25 +0100 Subject: [PATCH] dashboards: should be possible to browse dashboard using only uid That is, the slug part of url should be optional. Closes #11231 (cherry picked from commit 5fbfd67b945536f3d34577034254da9a7f805115) --- pkg/api/api.go | 1 + public/app/routes/routes.ts | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/pkg/api/api.go b/pkg/api/api.go index 1b7e30e34ad12..d8def3453c468 100644 --- a/pkg/api/api.go +++ b/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) diff --git a/public/app/routes/routes.ts b/public/app/routes/routes.ts index cab45b5aff32a..e968bee9be4c6 100644 --- a/public/app/routes/routes.ts +++ b/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',