Skip to content

[Infra] Fix asset details locator params in custom dashboards#256412

Merged
rmyz merged 1 commit intoelastic:mainfrom
rmyz:256161-infra-custom-dashboard-adapt-locator
Mar 6, 2026
Merged

[Infra] Fix asset details locator params in custom dashboards#256412
rmyz merged 1 commit intoelastic:mainfrom
rmyz:256161-infra-custom-dashboard-adapt-locator

Conversation

@rmyz
Copy link
Copy Markdown
Contributor

@rmyz rmyz commented Mar 6, 2026

Summary

Closes #256161.

Fixes a crash ("The inventory model you've attempted to find does not exist") that occurred when navigating from the Dashboards tab in the Infrastructure asset detail page.

Root cause

The getLocatorParams function in the Dashboards tab component (dashboards.tsx) was passing assetType and assetId to the ASSET_DETAILS_LOCATOR, but the locator expects entityType and entityId. Because the expected properties were missing from the params, both resolved to undefined, producing a broken URL:

/app/metrics/detail/undefined/undefined

When this URL was matched by the router, findInventoryModel("undefined") threw because "undefined" is not a valid inventory type (host, pod, container, awsEC2, etc.).

Changes

File Change Purpose
infra/.../dashboards/dashboards.tsx assetTypeentityType, assetIdentityId Root cause fix — passes the correct property names to the locator so the generated URL contains the actual entity type and ID
observability_shared/.../asset_details_locator.ts Added early return to /inventory when entityType or entityId is falsy Defense in depth — the locator will never produce /detail/undefined/... URLs, even if a caller passes missing params in the future

How to reproduce (before fix)

  1. Navigate to Infrastructure → Hosts → click a host → Open as page
  2. Go to the Dashboards tab (requires observability:enableInfrastructureAssetCustomDashboards advanced setting enabled)
  3. Link any dashboard
  4. Do a console.log in x-pack/solutions/observability/plugins/infra/public/components/asset_details/tabs/dashboards/dashboards.tsx -> console.log('locator', locator.getRedirectUrl({ dashboardId: '123' })); in L196
    You can copy the URL from the console.log and navigate to a new tab, and you should see "detail/undefined/undefined..." (make sure you are not checked out to this branch)

How to verify (after fix)

  1. Same steps as above — the navigation works correctly and the URL contains the proper entity type and ID
@rmyz rmyz requested review from a team as code owners March 6, 2026 10:43
@rmyz rmyz self-assigned this Mar 6, 2026
@rmyz rmyz added release_note:fix backport:version Backport to applied version labels Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation labels Mar 6, 2026
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/obs-presentation-team (Team:obs-presentation)

@rmyz rmyz added the v9.3.2 label Mar 6, 2026
@rmyz rmyz enabled auto-merge (squash) March 6, 2026 10:50
@rmyz rmyz merged commit c0ebf8b into elastic:main Mar 6, 2026
28 checks passed
@kibanamachine
Copy link
Copy Markdown
Contributor

Starting backport for target branches: 9.3

https://github.com/elastic/kibana/actions/runs/22762413285

@elasticmachine
Copy link
Copy Markdown
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #139 / Actions and Triggers app Connectors Slack rule creation should save webhook type slack connectors
  • [job] [logs] Jest Tests #8 / BackfillClient constructor should register backfill task type

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
infra 1.2MB 1.2MB +2.0B

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
observabilityShared 69.2KB 69.2KB +79.0B

cc @rmyz

@kibanamachine
Copy link
Copy Markdown
Contributor

💚 All backports created successfully

Status Branch Result
9.3

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Mar 6, 2026
…256412) (#256442)

# Backport

This will backport the following commits from `main` to `9.3`:
- [[Infra] Fix asset details locator params in custom dashboards
(#256412)](#256412)

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

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

<!--BACKPORT [{"author":{"name":"Sergi
Romeu","email":"sergi.romeu@elastic.co"},"sourceCommit":{"committedDate":"2026-03-06T11:56:11Z","message":"[Infra]
Fix asset details locator params in custom dashboards
(#256412)","sha":"c0ebf8b52a3d49dcec44bf491d12144d9a87f50f","branchLabelMapping":{"^v9.4.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","backport:version","v9.4.0","Team:obs-presentation","v9.3.2"],"title":"[Infra]
Fix asset details locator params in custom
dashboards","number":256412,"url":"https://github.com/elastic/kibana/pull/256412","mergeCommit":{"message":"[Infra]
Fix asset details locator params in custom dashboards
(#256412)","sha":"c0ebf8b52a3d49dcec44bf491d12144d9a87f50f"}},"sourceBranch":"main","suggestedTargetBranches":["9.3"],"targetPullRequestStates":[{"branch":"main","label":"v9.4.0","branchLabelMappingKey":"^v9.4.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/256412","number":256412,"mergeCommit":{"message":"[Infra]
Fix asset details locator params in custom dashboards
(#256412)","sha":"c0ebf8b52a3d49dcec44bf491d12144d9a87f50f"}},{"branch":"9.3","label":"v9.3.2","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}]
BACKPORT-->

Co-authored-by: Sergi Romeu <sergi.romeu@elastic.co>
@rmyz rmyz deleted the 256161-infra-custom-dashboard-adapt-locator branch March 6, 2026 13:58
kapral18 pushed a commit to kapral18/kibana that referenced this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:version Backport to applied version labels release_note:fix Team:obs-presentation Focus: APM UI, Infra UI, Hosts UI, Universal Profiling, Obs Overview and left Navigation v9.3.2 v9.4.0

4 participants