K8s search: add legacy id to dashboard response (#99132)
This commit is contained in:
@@ -189,6 +189,11 @@ func DashboardBuilder(namespaced resource.NamespacedDocumentSupplier) (resource.
|
||||
Filterable: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
Name: DASHBOARD_LEGACY_ID,
|
||||
Type: resource.ResourceTableColumnDefinition_INT64,
|
||||
Description: "Deprecated legacy id of the dashboard",
|
||||
},
|
||||
})
|
||||
if namespaced == nil {
|
||||
namespaced = func(ctx context.Context, namespace string, blob resource.BlobSupport) (resource.DocumentBuilder, error) {
|
||||
@@ -267,6 +272,7 @@ func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resou
|
||||
|
||||
// metadata name is the dashboard uid
|
||||
summary.UID = obj.GetName()
|
||||
summary.ID = obj.GetDeprecatedInternalID() // nolint:staticcheck
|
||||
|
||||
doc := resource.NewIndexableDocument(key, rv, obj)
|
||||
doc.Title = summary.Title
|
||||
@@ -310,11 +316,9 @@ func (s *DashboardDocumentBuilder) BuildDocument(ctx context.Context, key *resou
|
||||
doc.Fields = map[string]any{
|
||||
DASHBOARD_SCHEMA_VERSION: summary.SchemaVersion,
|
||||
DASHBOARD_LINK_COUNT: summary.LinkCount,
|
||||
DASHBOARD_LEGACY_ID: summary.ID,
|
||||
}
|
||||
|
||||
if summary.ID > 0 {
|
||||
doc.Fields[DASHBOARD_LEGACY_ID] = summary.ID
|
||||
}
|
||||
if len(panelTypes) > 0 {
|
||||
sort.Strings(panelTypes)
|
||||
doc.Fields[DASHBOARD_PANEL_TYPES] = panelTypes
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"c"
|
||||
],
|
||||
"labels": {
|
||||
"grafana.app/deprecatedInternalID": "141",
|
||||
"host": "abc",
|
||||
"region": "xyz"
|
||||
},
|
||||
|
||||
@@ -13,7 +13,8 @@
|
||||
},
|
||||
"labels": {
|
||||
"host": "abc",
|
||||
"region": "xyz"
|
||||
"region": "xyz",
|
||||
"grafana.app/deprecatedInternalID": "141"
|
||||
}
|
||||
},
|
||||
"spec": {
|
||||
|
||||
@@ -168,6 +168,13 @@
|
||||
"format": "int64",
|
||||
"description": "Total number of views",
|
||||
"priority": 0
|
||||
},
|
||||
{
|
||||
"name": "legacy_id",
|
||||
"type": "number",
|
||||
"format": "int64",
|
||||
"description": "Deprecated legacy id of the dashboard",
|
||||
"priority": 0
|
||||
}
|
||||
],
|
||||
"rows": [
|
||||
@@ -198,6 +205,7 @@
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
],
|
||||
"object": {
|
||||
@@ -239,6 +247,7 @@
|
||||
100,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
],
|
||||
"object": {
|
||||
@@ -282,6 +291,7 @@
|
||||
50,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null
|
||||
],
|
||||
"object": {
|
||||
|
||||
Reference in New Issue
Block a user