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,9 +552,7 @@ 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 {
// Add new connection (only if user has datasources access)
if hasDatasourcesAccess { if hasDatasourcesAccess {
children = append(children, &navtree.NavLink{ children = append(children, &navtree.NavLink{
Id: "connections-add-new-connection", Id: "connections-add-new-connection",
@ -574,7 +572,6 @@ func (s *ServiceImpl) buildDataConnectionsNavLink(c *contextmodel.ReqContext, tr
Children: []*navtree.NavLink{}, Children: []*navtree.NavLink{},
}) })
} }
}
if len(children) > 0 || hasPluginItems { if len(children) > 0 || hasPluginItems {
// Connections (main) // Connections (main)
@ -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/") ||