Fix build issues

This commit is contained in:
Jára Benc 2025-09-25 08:07:02 +02:00
parent 644938c9df
commit fb0c23f49d
1 changed files with 19 additions and 22 deletions

View File

@ -552,28 +552,25 @@ func (s *ServiceImpl) buildDataConnectionsNavLink(c *contextmodel.ReqContext, tr
// Check if there are any plugin items already added to the Connections section // Check if there are any plugin items already added to the Connections section
hasPluginItems := s.hasConnectionsPluginItems(treeRoot) hasPluginItems := s.hasConnectionsPluginItems(treeRoot)
// Show Connections section if user has datasources access OR if there are plugin items // Add datasources items if user has datasources access
if hasDatasourcesAccess || hasPluginItems { if hasDatasourcesAccess {
// Add new connection (only if user has datasources access) children = append(children, &navtree.NavLink{
if hasDatasourcesAccess { Id: "connections-add-new-connection",
children = append(children, &navtree.NavLink{ Text: "Add new connection",
Id: "connections-add-new-connection", SubTitle: "Browse and create new connections",
Text: "Add new connection", Url: baseUrl + "/add-new-connection",
SubTitle: "Browse and create new connections", Children: []*navtree.NavLink{},
Url: baseUrl + "/add-new-connection", Keywords: []string{"csv", "graphite", "json", "loki", "prometheus", "sql", "tempo"},
Children: []*navtree.NavLink{}, })
Keywords: []string{"csv", "graphite", "json", "loki", "prometheus", "sql", "tempo"},
})
// Data sources // Data sources
children = append(children, &navtree.NavLink{ children = append(children, &navtree.NavLink{
Id: "connections-datasources", Id: "connections-datasources",
Text: "Data sources", Text: "Data sources",
SubTitle: "View and manage your connected data source connections", SubTitle: "View and manage your connected data source connections",
Url: baseUrl + "/datasources", Url: baseUrl + "/datasources",
Children: []*navtree.NavLink{}, Children: []*navtree.NavLink{},
}) })
}
} }
if len(children) > 0 || hasPluginItems { if len(children) > 0 || hasPluginItems {
@ -597,7 +594,7 @@ func (s *ServiceImpl) buildDataConnectionsNavLink(c *contextmodel.ReqContext, tr
func (s *ServiceImpl) hasConnectionsPluginItems(treeRoot *navtree.NavTreeRoot) bool { func (s *ServiceImpl) hasConnectionsPluginItems(treeRoot *navtree.NavTreeRoot) bool {
// Look for any standalone plugin pages that are configured to be under the Connections section // Look for any standalone plugin pages that are configured to be under the Connections section
// These would have IDs like "standalone-plugin-page-/connections/..." // These would have IDs like "standalone-plugin-page-/connections/..."
for _, section := range treeRoot.Sections { for _, section := range treeRoot.Children {
for _, child := range section.Children { for _, child := range section.Children {
if child.Id != "" && if child.Id != "" &&
(strings.HasPrefix(child.Id, "standalone-plugin-page-/connections/") || (strings.HasPrefix(child.Id, "standalone-plugin-page-/connections/") ||