Navigation: Allow overriding icons in nav settings (#61160)

expose k6 icon, allow overriding icon in nav settings, override connections + k6
This commit is contained in:
Ashley Harrison
2023-01-10 10:29:07 +00:00
committed by GitHub
parent 84ebee026c
commit 4e00fbbd7f
6 changed files with 183 additions and 170 deletions

View File

@@ -187,6 +187,9 @@ func (s *ServiceImpl) addPluginToSection(c *models.ReqContext, treeRoot *navtree
if len(navConfig.Text) > 0 {
appLink.Text = navConfig.Text
}
if len(navConfig.Icon) > 0 {
appLink.Icon = navConfig.Icon
}
}
if sectionID == navtree.NavIDRoot {
@@ -262,8 +265,8 @@ func (s *ServiceImpl) readNavigationSettings() {
"grafana-incident-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 2, Text: "Incident"},
"grafana-ml-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 3, Text: "Machine Learning"},
"grafana-cloud-link-app": {SectionID: navtree.NavIDCfg},
"grafana-easystart-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightSavedItems + 1, Text: "Connections"},
"grafana-k6-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightAlertsAndIncidents + 1, Text: "Performance testing"},
"grafana-easystart-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightSavedItems + 1, Text: "Connections", Icon: "adjust-circle"},
"grafana-k6-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightAlertsAndIncidents + 1, Text: "Performance testing", Icon: "k6"},
}
s.navigationAppPathConfig = map[string]NavigationAppConfig{

View File

@@ -46,6 +46,7 @@ type NavigationAppConfig struct {
SectionID string
SortWeight int64
Text string
Icon string
}
func ProvideService(cfg *setting.Cfg, accessControl ac.AccessControl, pluginStore plugins.Store, pluginSettings pluginsettings.Service, starService star.Service, features *featuremgmt.FeatureManager, dashboardService dashboards.DashboardService, accesscontrolService ac.Service, kvStore kvstore.KVStore, apiKeyService apikey.Service, queryLibraryService querylibrary.HTTPService) navtree.Service {