mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(apps): more work on app pages and sidemenu subnav
This commit is contained in:
@@ -19,8 +19,9 @@ type PluginCss struct {
|
||||
}
|
||||
|
||||
type NavLink struct {
|
||||
Text string `json:"text"`
|
||||
Icon string `json:"icon"`
|
||||
Img string `json:"img"`
|
||||
Url string `json:"url"`
|
||||
Text string `json:"text"`
|
||||
Icon string `json:"icon"`
|
||||
Img string `json:"img"`
|
||||
Url string `json:"url"`
|
||||
Children []*NavLink `json:"children"`
|
||||
}
|
||||
|
||||
@@ -51,32 +51,24 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
Text: "Dashboards",
|
||||
Icon: "fa fa-fw fa-th-large",
|
||||
Url: "/",
|
||||
})
|
||||
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
Text: "Playlists",
|
||||
Icon: "fa fa-fw fa-list",
|
||||
Url: "/playlists",
|
||||
})
|
||||
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
Text: "Snapshots",
|
||||
Icon: "fa-fw icon-gf icon-gf-snapshot",
|
||||
Url: "/dashboard/snapshots",
|
||||
Url: setting.AppSubUrl + "/",
|
||||
Children: []*dtos.NavLink{
|
||||
{Text: "Playlists", Icon: "fa fa-fw fa-list", Url: setting.AppSubUrl + "/playlists"},
|
||||
{Text: "Snapshots", Icon: "fa-fw icon-gf icon-gf-snapshot", Url: setting.AppSubUrl + "/dashboard/snapshots"},
|
||||
},
|
||||
})
|
||||
|
||||
if c.OrgRole == m.ROLE_ADMIN {
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
Text: "Data Sources",
|
||||
Icon: "fa fa-fw fa-database",
|
||||
Url: "/datasources",
|
||||
Url: setting.AppSubUrl + "/datasources",
|
||||
})
|
||||
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
Text: "Apps",
|
||||
Icon: "fa fa-fw fa-cubes",
|
||||
Url: "/apps",
|
||||
Url: setting.AppSubUrl + "/apps",
|
||||
})
|
||||
}
|
||||
|
||||
@@ -91,11 +83,20 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
|
||||
}
|
||||
|
||||
if plugin.Pinned {
|
||||
data.MainNavLinks = append(data.MainNavLinks, &dtos.NavLink{
|
||||
pageLink := &dtos.NavLink{
|
||||
Text: plugin.Name,
|
||||
Url: "/apps/edit/" + plugin.Id,
|
||||
Url: setting.AppSubUrl + "/apps/" + plugin.Id + "/edit",
|
||||
Img: plugin.Info.Logos.Small,
|
||||
})
|
||||
}
|
||||
|
||||
for _, page := range plugin.Pages {
|
||||
pageLink.Children = append(pageLink.Children, &dtos.NavLink{
|
||||
Url: setting.AppSubUrl + "/apps/" + plugin.Id + "/page/" + page.Slug,
|
||||
Text: page.Name,
|
||||
})
|
||||
}
|
||||
|
||||
data.MainNavLinks = append(data.MainNavLinks, pageLink)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user