From 0606555ba10762dd745f1953300ba9bd2f95e37f Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Thu, 27 Feb 2020 09:10:21 -0800 Subject: [PATCH] App Plugins: support react pages in nav (#22428) --- pkg/api/index.go | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/pkg/api/index.go b/pkg/api/index.go index 513b77cc97c..b6537510768 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -230,9 +230,20 @@ func (hs *HTTPServer) setIndexViewData(c *m.ReqContext) (*dtos.IndexViewData, er } if include.Type == "page" && include.AddToNav { - link := &dtos.NavLink{ - Url: setting.AppSubUrl + "/plugins/" + plugin.Id + "/page/" + include.Slug, - Text: include.Name, + var link *dtos.NavLink + if len(include.Path) > 0 { + link = &dtos.NavLink{ + Url: setting.AppSubUrl + include.Path, + Text: include.Name, + } + if include.DefaultNav { + appLink.Url = link.Url // Overwrite the hardcoded page logic + } + } else { + link = &dtos.NavLink{ + Url: setting.AppSubUrl + "/plugins/" + plugin.Id + "/page/" + include.Slug, + Text: include.Name, + } } appLink.Children = append(appLink.Children, link) }