Navigation: Move Cost management and billing plugin to root (#111739)
This commit is contained in:
@@ -286,6 +286,7 @@ export const availableIconsIndex = {
|
||||
bitbucket: true,
|
||||
git: true,
|
||||
'tachometer-fast': true,
|
||||
'cmab-logo': true,
|
||||
};
|
||||
|
||||
export type IconName = keyof typeof availableIconsIndex;
|
||||
|
||||
@@ -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"},
|
||||
}
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150" fill="none"><path fill="currentColor" d="M85.503 6.005c.594.014 1.418.067 2.353.232 1.816.322 4.404 1.122 6.504 3.193 2.183 2.153 2.955 4.991 3.253 6.886a18.128 18.128 0 0 1 .21 3.309c-.003.097-.006.18-.01.242v9.291a51.191 51.191 0 0 0-7.157-.46v-8.975l.01-.276c0-.016.004-.042.005-.074.003-.09.007-.236.004-.424a11.054 11.054 0 0 0-.13-1.52c-.203-1.291-.626-2.327-1.207-2.902-.664-.655-1.656-1.05-2.726-1.239a8.678 8.678 0 0 0-1.272-.13c-.154-.004-.273.002-.34.004h-.028l-.28.009H10.377c-1.736 0-3.22 1.441-3.22 3.303v110.293c0 1.329.763 2.429 1.826 2.958l6.576-7.907a3.58 3.58 0 0 1 3.084-1.276 3.586 3.586 0 0 1 2.796 1.831l4.986 8.997 5.73-9.16.266-.373a3.585 3.585 0 0 1 2.769-1.31 3.58 3.58 0 0 1 3.033 1.683l6.187 9.906 7.697-10.168.27-.316a3.582 3.582 0 0 1 2.583-1.105 3.59 3.59 0 0 1 2.855 1.421l7.97 10.54 4.364-5.777a51.212 51.212 0 0 0 15.041 4.109c3.962.449 7.928.417 11.827-.051-1.555 3.774-5.235 6.457-9.58 6.458a3.582 3.582 0 0 1-2.368-.894l-7.934-6.994-8.495 11.239a3.586 3.586 0 0 1-2.856 1.421 3.581 3.581 0 0 1-2.852-1.421l-7.972-10.545-7.968 10.545a3.578 3.578 0 0 1-5.89-.262l-5.912-9.463-5.914 9.463a3.583 3.583 0 0 1-3.127 1.683 3.583 3.583 0 0 1-3.038-1.846l-5.395-9.738-4.585 5.521a3.583 3.583 0 0 1-2.754 1.291C4.607 137.227 0 132.5 0 126.767V16.475C0 10.74 4.608 6.015 10.377 6.014h74.166c.06-.004.137-.006.228-.01.185-.005.434-.006.732 0Zm3.885 32.253a41.681 41.681 0 0 1 42.985 36.962 41.69 41.69 0 0 1-7.858 29.419l22.967 22.961a6.243 6.243 0 0 1 1.989 4.464 6.28 6.28 0 0 1-.453 2.453 6.28 6.28 0 0 1-1.377 2.079 6.28 6.28 0 0 1-2.079 1.377 6.28 6.28 0 0 1-2.453.454 6.24 6.24 0 0 1-4.463-1.99l-22.967-22.961a41.68 41.68 0 0 1-56.33-6.384 41.69 41.69 0 0 1 2.132-56.655 41.682 41.682 0 0 1 27.907-12.18ZM90.96 50.73a29.178 29.178 0 0 0-29.178 29.181 29.178 29.178 0 1 0 58.357 0 29.182 29.182 0 0 0-29.179-29.18Zm1.596 13.383c5.374.539 9.125 4.038 9.258 8.83l.014.49h-5.181l-.047-.425c-.13-1.136-.627-2.046-1.398-2.712-.67-.579-1.566-.977-2.646-1.174v8.625l.876.232c1.887.484 4.07 1.28 5.792 2.685 1.738 1.42 2.996 3.459 2.996 6.37-.001 2.557-.928 4.81-2.675 6.472-1.66 1.58-4.035 2.584-6.99 2.856v3.402h-3.298v-3.388c-2.829-.26-5.17-1.187-6.86-2.726-1.782-1.624-2.802-3.88-2.944-6.594l-.028-.502h5.382l.032.442c.105 1.35.67 2.366 1.524 3.085.75.631 1.748 1.032 2.894 1.23v-9.213l-1.04-.287c-2.396-.676-4.394-1.664-5.791-3.062-1.41-1.411-2.186-3.219-2.186-5.466 0-5.018 3.862-8.463 9.017-9.128v-3.514h3.299v3.472ZM40.063 85.66a51.212 51.212 0 0 0 1.332 7.157H19.44a3.579 3.579 0 0 1 0-7.157h20.623Zm52.493 5.632c2.666-.489 4.329-2.123 4.329-4.305 0-1.15-.484-1.947-1.325-2.577-.748-.561-1.777-.983-3.004-1.36v8.242Zm-3.3-22.123c-2.356.507-3.657 2.01-3.657 3.849l.023.41c.106.927.59 1.627 1.286 2.18.656.522 1.493.899 2.349 1.193v-7.632Zm-47.935-1.863a51.18 51.18 0 0 0-1.286 7.157H19.44a3.578 3.578 0 0 1 0-7.157H41.32Zm9.407-19.085a51.21 51.21 0 0 0-4.734 7.157H19.44a3.579 3.579 0 0 1 0-7.157h31.29Z"/></svg>
|
||||
|
After Width: | Height: | Size: 2.9 KiB |
Reference in New Issue
Block a user