K8s/Dashboards: Fix title extraction (#101990)

This commit is contained in:
Ryan McKinley
2025-03-12 09:46:12 +02:00
committed by GitHub
parent e28c993465
commit e6f682bc14
2 changed files with 27 additions and 3 deletions
+16
View File
@@ -607,6 +607,22 @@ func (m *grafanaMetaAccessor) FindTitle(defaultTitle string) string {
if name.IsValid() && name.Kind() == reflect.String {
return name.String()
}
// Unstructured uses Object subtype
object := spec.FieldByName("Object")
if object.IsValid() && object.Kind() == reflect.Map {
key := reflect.ValueOf("title")
value := object.MapIndex(key)
if value.IsValid() {
if value.CanInterface() {
v := value.Interface()
t, ok := v.(string)
if ok {
return t
}
}
}
}
}
obj, ok := m.obj.(*unstructured.Unstructured)