From 1070f94fbb43e0db61a84c32bf8116d7b163ccb4 Mon Sep 17 00:00:00 2001 From: Janos Gub Date: Fri, 31 Oct 2025 11:41:01 +0100 Subject: [PATCH] Navigation: Move Cost management and billing plugin to root (#111739) --- packages/grafana-data/src/types/icon.ts | 1 + pkg/api/index.go | 1 - pkg/services/navtree/models.go | 66 +------------------- pkg/services/navtree/navtreeimpl/applinks.go | 4 +- public/img/icons/unicons/cmab-logo.svg | 1 + 5 files changed, 5 insertions(+), 68 deletions(-) create mode 100644 public/img/icons/unicons/cmab-logo.svg diff --git a/packages/grafana-data/src/types/icon.ts b/packages/grafana-data/src/types/icon.ts index 57e086c1ba2..4f8cd0c2e3f 100644 --- a/packages/grafana-data/src/types/icon.ts +++ b/packages/grafana-data/src/types/icon.ts @@ -286,6 +286,7 @@ export const availableIconsIndex = { bitbucket: true, git: true, 'tachometer-fast': true, + 'cmab-logo': true, }; export type IconName = keyof typeof availableIconsIndex; diff --git a/pkg/api/index.go b/pkg/api/index.go index 1effea38164..a928aca581c 100644 --- a/pkg/api/index.go +++ b/pkg/api/index.go @@ -215,7 +215,6 @@ func (hs *HTTPServer) setIndexViewData(c *contextmodel.ReqContext) (*dtos.IndexV hs.HooksService.RunIndexDataHooks(&data, c) - data.NavTree.ApplyCostManagementIA() data.NavTree.Sort() return &data, nil diff --git a/pkg/services/navtree/models.go b/pkg/services/navtree/models.go index 8206a45d5ea..6f6ddd06e4c 100644 --- a/pkg/services/navtree/models.go +++ b/pkg/services/navtree/models.go @@ -11,7 +11,7 @@ const ( // are negative to ensure that the default items are placed above // any items with default weight. - WeightHome = (iota - 20) * 100 + WeightHome = (iota - 40) * 100 WeightBookmarks WeightSavedItems WeightDashboard @@ -22,6 +22,7 @@ const ( WeightAlertsAndIncidents WeightAIAndML WeightAdaptiveTelemetry + WeightCMAB WeightTestingAndSynthetics WeightObservability WeightCloudServiceProviders @@ -157,69 +158,6 @@ func Sort(nodes []*NavLink) { } } -func (root *NavTreeRoot) ApplyCostManagementIA() { - orgAdminNode := root.FindById(NavIDCfg) - var costManagementApp *NavLink - var adaptiveMetricsApp *NavLink - var adaptiveLogsApp *NavLink - var adaptiveTracesApp *NavLink - var attributionsApp *NavLink - var logVolumeExplorerApp *NavLink - - if orgAdminNode != nil { - adminNodeLinks := []*NavLink{} - for _, element := range orgAdminNode.Children { - switch navId := element.Id; navId { - case "plugin-page-grafana-costmanagementui-app": - costManagementApp = element - case "plugin-page-grafana-adaptive-metrics-app": - adaptiveMetricsApp = element - case "plugin-page-grafana-adaptivelogs-app": - adaptiveLogsApp = element - case "plugin-page-grafana-adaptivetraces-app": - adaptiveTracesApp = element - case "plugin-page-grafana-attributions-app": - attributionsApp = element - case "plugin-page-grafana-logvolumeexplorer-app": - logVolumeExplorerApp = element - default: - adminNodeLinks = append(adminNodeLinks, element) - } - } - - if costManagementApp != nil { - costManagementMetricsNode := FindByURL(costManagementApp.Children, "/a/grafana-costmanagementui-app/metrics") - if costManagementMetricsNode != nil { - if adaptiveMetricsApp != nil { - costManagementMetricsNode.Children = append(costManagementMetricsNode.Children, adaptiveMetricsApp) - } - if attributionsApp != nil { - costManagementMetricsNode.Children = append(costManagementMetricsNode.Children, attributionsApp) - } - } - - costManagementLogsNode := FindByURL(costManagementApp.Children, "/a/grafana-costmanagementui-app/logs") - if costManagementLogsNode != nil { - if adaptiveLogsApp != nil { - costManagementLogsNode.Children = append(costManagementLogsNode.Children, adaptiveLogsApp) - } - if logVolumeExplorerApp != nil { - costManagementLogsNode.Children = append(costManagementLogsNode.Children, logVolumeExplorerApp) - } - } - - costManagementTracesNode := FindByURL(costManagementApp.Children, "/a/grafana-costmanagementui-app/traces") - if costManagementTracesNode != nil { - if adaptiveTracesApp != nil { - costManagementTracesNode.Children = append(costManagementTracesNode.Children, adaptiveTracesApp) - } - } - adminNodeLinks = append(adminNodeLinks, costManagementApp) - } - orgAdminNode.Children = adminNodeLinks - } -} - func AppendIfNotNil(children []*NavLink, newChild *NavLink) []*NavLink { if newChild != nil { return append(children, newChild) diff --git a/pkg/services/navtree/navtreeimpl/applinks.go b/pkg/services/navtree/navtreeimpl/applinks.go index e3fea6da25e..d6650c85ee1 100644 --- a/pkg/services/navtree/navtreeimpl/applinks.go +++ b/pkg/services/navtree/navtreeimpl/applinks.go @@ -392,13 +392,11 @@ func (s *ServiceImpl) readNavigationSettings() { "grafana-ml-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightAIAndML, Text: "Machine Learning", SubTitle: "Explore AI and machine learning features", Icon: "gf-ml-alt"}, "grafana-slo-app": {SectionID: navtree.NavIDAlertsAndIncidents, SortWeight: 7}, "grafana-cloud-link-app": {SectionID: navtree.NavIDCfgPlugins, SortWeight: 3}, - "grafana-costmanagementui-app": {SectionID: navtree.NavIDCfg, Text: "Cost management"}, "grafana-adaptive-metrics-app": {SectionID: navtree.NavIDAdaptiveTelemetry, SortWeight: 1}, "grafana-adaptivelogs-app": {SectionID: navtree.NavIDAdaptiveTelemetry, SortWeight: 2}, "grafana-adaptivetraces-app": {SectionID: navtree.NavIDAdaptiveTelemetry, SortWeight: 3}, "grafana-adaptiveprofiles-app": {SectionID: navtree.NavIDAdaptiveTelemetry, SortWeight: 4}, - "grafana-attributions-app": {SectionID: navtree.NavIDCfg, Text: "Attributions"}, - "grafana-logvolumeexplorer-app": {SectionID: navtree.NavIDCfg, Text: "Log Volume Explorer"}, + "grafana-cmab-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightCMAB, Icon: "cmab-logo", IsNew: true}, "grafana-easystart-app": {SectionID: navtree.NavIDRoot, SortWeight: navtree.WeightApps + 1, Text: "Connections", Icon: "adjust-circle"}, "k6-app": {SectionID: navtree.NavIDTestingAndSynthetics, SortWeight: 1, Text: "Performance"}, } diff --git a/public/img/icons/unicons/cmab-logo.svg b/public/img/icons/unicons/cmab-logo.svg new file mode 100644 index 00000000000..7780b9efded --- /dev/null +++ b/public/img/icons/unicons/cmab-logo.svg @@ -0,0 +1 @@ + \ No newline at end of file