Navigation: Move Cost management and billing plugin to root (#111739)
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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"},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user