[9.0] [APM][Metrics] Allow text panels in the metric dashboards (#224426) (#224473)

# Backport

This will backport the following commits from `main` to `9.0`:
- [[APM][Metrics] Allow text panels in the metric dashboards
(#224426)](https://github.com/elastic/kibana/pull/224426)

<!--- Backport version: 9.6.6 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sorenlouv/backport)

<!--BACKPORT
[{"author":{"name":"jennypavlova","email":"dzheni.pavlova@elastic.co"},"sourceCommit":{"committedDate":"2025-06-18T16:16:12Z","message":"[APM][Metrics]
Allow text panels in the metric dashboards (#224426)\n\nCloses #224425
\n\n## Summary\n\nThis PR adds support for the text panel in the APM
dashboards inside the\nmetrics tab\n\n## Testing \n\n⚠️ UPDATE: The
dashboard won't be part of the PR so ⬇️ won't work now\n\n - with
connection to edge oblt cluster: \n- Open Applications > Service
Inventory and click on the `cart` (or any\nEDOT .NET service) service\n
- Go to the metrics tab\n - The dashboard should be visible \n
\n\n![image](https://github.com/user-attachments/assets/58082514-7e10-4758-adcf-069b4b9a2109)","sha":"2c526fc4906cee7b5018756da15718a71e8286cd","branchLabelMapping":{"^v9.1.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","apm:opentelemetry","Team:obs-ux-infra_services","backport:version","v9.1.0","v8.19.0"],"title":"[APM][Metrics]
Allow text panels in the metric
dashboards","number":224426,"url":"https://github.com/elastic/kibana/pull/224426","mergeCommit":{"message":"[APM][Metrics]
Allow text panels in the metric dashboards (#224426)\n\nCloses #224425
\n\n## Summary\n\nThis PR adds support for the text panel in the APM
dashboards inside the\nmetrics tab\n\n## Testing \n\n⚠️ UPDATE: The
dashboard won't be part of the PR so ⬇️ won't work now\n\n - with
connection to edge oblt cluster: \n- Open Applications > Service
Inventory and click on the `cart` (or any\nEDOT .NET service) service\n
- Go to the metrics tab\n - The dashboard should be visible \n
\n\n![image](https://github.com/user-attachments/assets/58082514-7e10-4758-adcf-069b4b9a2109)","sha":"2c526fc4906cee7b5018756da15718a71e8286cd"}},"sourceBranch":"main","suggestedTargetBranches":["9.0","8.19"],"targetPullRequestStates":[{"branch":"9.0","label":"v9.0.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v9.1.0","branchLabelMappingKey":"^v9.1.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/224426","number":224426,"mergeCommit":{"message":"[APM][Metrics]
Allow text panels in the metric dashboards (#224426)\n\nCloses #224425
\n\n## Summary\n\nThis PR adds support for the text panel in the APM
dashboards inside the\nmetrics tab\n\n## Testing \n\n⚠️ UPDATE: The
dashboard won't be part of the PR so ⬇️ won't work now\n\n - with
connection to edge oblt cluster: \n- Open Applications > Service
Inventory and click on the `cart` (or any\nEDOT .NET service) service\n
- Go to the metrics tab\n - The dashboard should be visible \n
\n\n![image](https://github.com/user-attachments/assets/58082514-7e10-4758-adcf-069b4b9a2109)","sha":"2c526fc4906cee7b5018756da15718a71e8286cd"}},{"branch":"8.19","label":"v8.19.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: jennypavlova <dzheni.pavlova@elastic.co>
This commit is contained in:
Kibana Machine 2025-06-18 20:08:38 +02:00 committed by GitHub
parent aa5b12683f
commit 3b8379b249
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -60,9 +60,8 @@ export async function convertSavedDashboardToPanels(
const panels = panelsRawObjects.reduce((acc, panel) => {
const { gridData, embeddableConfig, panelIndex, title } = panel;
const { attributes } = embeddableConfig;
const { state } = attributes;
const layers =
state.datasourceStates?.formBased?.layers ?? state.datasourceStates?.textBased?.layers ?? [];
const datasourceStates = attributes?.state?.datasourceStates ?? {};
const layers = datasourceStates.formBased?.layers ?? datasourceStates.textBased?.layers ?? [];
acc[gridData.i] = {
type: panel.type,
@ -75,7 +74,7 @@ export async function convertSavedDashboardToPanels(
...attributes,
references: [],
state: {
...state,
...(attributes?.state ?? {}),
adHocDataViews: getAdhocDataView(dataView),
internalReferences: Object.keys(layers).map((layerId) => ({
id: dataView.id,