navtree

package
v0.0.0-...-fb7f86c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 18, 2023 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WeightHome = (iota - 20) * 100
	WeightSavedItems
	WeightCreate
	WeightDashboard
	WeightExplore
	WeightAlerting
	WeightAlertsAndIncidents
	WeightMonitoring
	WeightDataConnections
	WeightApps
	WeightPlugin
	WeightConfig
	WeightAdmin
	WeightProfile
	WeightHelp
)
View Source
const (
	NavIDRoot               = "root"
	NavIDDashboards         = "dashboards/browse"
	NavIDCfg                = "cfg" // NavIDCfg is the id for org configuration navigation node
	NavIDAlertsAndIncidents = "alerts-and-incidents"
	NavIDAlerting           = "alerting"
	NavIDAlertingLegacy     = "alerting-legacy"
	NavIDMonitoring         = "monitoring"
	NavIDReporting          = "reports"
	NavIDApps               = "apps"
)

Variables

This section is empty.

Functions

func Sort

func Sort(nodes []*NavLink)

Types

type NavLink struct {
	Id             string     `json:"id,omitempty"`
	Text           string     `json:"text"`
	SubTitle       string     `json:"subTitle,omitempty"`
	Icon           string     `json:"icon,omitempty"` // Available icons can be browsed in Storybook: https://developers.grafana.com/ui/latest/index.html?path=/story/docs-overview-icon--icons-overview
	Img            string     `json:"img,omitempty"`
	Url            string     `json:"url,omitempty"`
	Target         string     `json:"target,omitempty"`
	SortWeight     int64      `json:"sortWeight,omitempty"`
	HideFromTabs   bool       `json:"hideFromTabs,omitempty"`
	RoundIcon      bool       `json:"roundIcon,omitempty"`
	IsSection      bool       `json:"isSection,omitempty"`
	Children       []*NavLink `json:"children,omitempty"`
	HighlightText  string     `json:"highlightText,omitempty"`
	HighlightID    string     `json:"highlightId,omitempty"`
	EmptyMessageId string     `json:"emptyMessageId,omitempty"`
	PluginID       string     `json:"pluginId,omitempty"` // (Optional) The ID of the plugin that registered nav link (e.g. as a standalone plugin page)
	IsCreateAction bool       `json:"isCreateAction,omitempty"`
}

func AppendIfNotNil

func AppendIfNotNil(children []*NavLink, newChild *NavLink) []*NavLink

func FindById

func FindById(nodes []*NavLink, id string) *NavLink
func (node *NavLink) Sort()
type NavTreeRoot struct {
	Children []*NavLink
}
func (root *NavTreeRoot) AddSection(node *NavLink)
func (root *NavTreeRoot) ApplyAdminIA()
func (root *NavTreeRoot) FindById(id string) *NavLink
func (root *NavTreeRoot) MarshalJSON() ([]byte, error)
func (root *NavTreeRoot) RemoveSection(node *NavLink)
func (root *NavTreeRoot) Sort()

type Service

type Service interface {
	GetNavTree(c *contextmodel.ReqContext, prefs *pref.Preference) (*NavTreeRoot, error)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL