Sfoglia il codice sorgente

add supressNav property to plugin pages.

This allows pages to be registered that dont show up in the
Navigation menu when the App is pinned.
Anthony Woods 10 anni fa
parent
commit
74949d306f
2 ha cambiato i file con 11 aggiunte e 8 eliminazioni
  1. 6 4
      pkg/api/index.go
  2. 5 4
      pkg/plugins/app_plugin.go

+ 6 - 4
pkg/api/index.go

@@ -90,10 +90,12 @@ func setIndexViewData(c *middleware.Context) (*dtos.IndexViewData, error) {
 			}
 
 			for _, page := range plugin.Pages {
-				pageLink.Children = append(pageLink.Children, &dtos.NavLink{
-					Url:  setting.AppSubUrl + "/plugins/" + plugin.Id + "/page/" + page.Slug,
-					Text: page.Name,
-				})
+				if !page.SuppressNav {
+					pageLink.Children = append(pageLink.Children, &dtos.NavLink{
+						Url:  setting.AppSubUrl + "/plugins/" + plugin.Id + "/page/" + page.Slug,
+						Text: page.Name,
+					})
+				}
 			}
 
 			data.MainNavLinks = append(data.MainNavLinks, pageLink)

+ 5 - 4
pkg/plugins/app_plugin.go

@@ -9,10 +9,11 @@ import (
 )
 
 type AppPluginPage struct {
-	Name      string          `json:"name"`
-	Slug      string          `json:"slug"`
-	Component string          `json:"component"`
-	Role      models.RoleType `json:"role"`
+	Name        string          `json:"name"`
+	Slug        string          `json:"slug"`
+	Component   string          `json:"component"`
+	Role        models.RoleType `json:"role"`
+	SuppressNav bool            `json:"suppress_nav"`
 }
 
 type AppPluginCss struct {