feat(plugins): finished app navigation enhancements, closes #4434

This commit is contained in:
Torkel Ödegaard
2016-03-22 10:15:47 +01:00
parent 7f79024e6a
commit 10df9dc8c3
7 changed files with 43 additions and 36 deletions

View File

@ -6,6 +6,7 @@ import (
"github.com/gosimple/slug"
"github.com/grafana/grafana/pkg/models"
"github.com/grafana/grafana/pkg/setting"
)
type AppPluginCss struct {
@ -75,10 +76,18 @@ func (app *AppPlugin) initApp() {
}
}
app.DefaultNavUrl = setting.AppSubUrl + "/plugins/" + app.Id + "/edit"
// slugify pages
for _, page := range app.Includes {
if page.Slug == "" {
page.Slug = slug.Make(page.Name)
for _, include := range app.Includes {
if include.Slug == "" {
include.Slug = slug.Make(include.Name)
}
if include.Type == "page" && include.DefaultNav {
app.DefaultNavUrl = setting.AppSubUrl + "/plugins/" + app.Id + "/page/" + include.Slug
}
if include.Type == "dashboard" && include.DefaultNav {
app.DefaultNavUrl = setting.AppSubUrl + "/dashboard/db/" + include.Slug
}
}
}