Skip to content

[CPS][Maps] Support CPS Picker in Maps #246382

Merged
mbondyra merged 2 commits intoelastic:mainfrom
mbondyra:maps_readonly
Dec 17, 2025
Merged

[CPS][Maps] Support CPS Picker in Maps #246382
mbondyra merged 2 commits intoelastic:mainfrom
mbondyra:maps_readonly

Conversation

@mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Dec 15, 2025

Summary

Supports CPS project picker in Maps. When changing the picker setting, maps refetch the data with the correct project_routing parameter.
Note: This does NOT allow yet saving the project routing setting to the maps saved object

Also fixes the fact I forgot to pass project_routing to esql source.

To test:

  1. Navigate to Maps and create a new map
  2. Add a few layers with Elasticsearch data sources (e.g., documents, clusters, heatmap)
  3. Open browser DevTools Network tab (optionally, filter for search requests)
  4. Click the CPS picker and change the project routing setting
  5. Verify that:
    - Maps layers refetch data automatically
    - Search requests include project_routing parameter in the request body
    - Different CPS settings result in different project_routing values in requests (none for All projects)
Untitled.mov

@mbondyra mbondyra added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Dec 15, 2025
@mbondyra mbondyra changed the title [CPS][Maps] Support CPS Picker support in Maps [CPS][Maps] Support CPS Picker support in Maps (doesn't allow to save, but reads the picker setting) Dec 15, 2025
@mbondyra mbondyra force-pushed the maps_readonly branch 2 times, most recently from 357f7b5 to 8cdfac6 Compare December 16, 2025 20:55
@mbondyra mbondyra changed the title [CPS][Maps] Support CPS Picker support in Maps (doesn't allow to save, but reads the picker setting) [CPS][Maps] Support CPS Picker support in Maps Dec 16, 2025
@mbondyra mbondyra marked this pull request as ready for review December 16, 2025 21:02
@mbondyra mbondyra requested a review from a team as a code owner December 16, 2025 21:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@mbondyra mbondyra changed the title [CPS][Maps] Support CPS Picker support in Maps [CPS][Maps] Support CPS Picker in Maps Dec 16, 2025

params.filter = buildEsQuery(undefined, query, filters, getEsQueryConfig(getUiSettings()));

if (requestMeta.projectRouting) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

how does this interact with project routing defined in ESQL statement? Should param only be set of there is no project routing in ESQL statement

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

actually no, we can send both and es will prioritize the SET query param over the body param. We're safe to have both.

@@ -0,0 +1,50 @@
/*
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is not a hook, could you rename to something like project_routing_manager?

Copy link
Contributor Author

@mbondyra mbondyra Dec 16, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call! I initially started it as a hook but then forgot to change the file name: 01dee99

}

const initialProjectRouting = cpsManager.getProjectRouting();
const projectRouting$ = new BehaviorSubject<ProjectRouting | undefined>(initialProjectRouting);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is projectRouting$ needed? It is never returned and is only used in this file for change detection. Maybe instead, just use distinctUntilChanged operator when subscribing to cpsManager.getProjectRouting$()

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 1309 1310 +1

Async chunks

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

id before after diff
maps 3.1MB 3.1MB +696.0B

Page load bundle

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

id before after diff
maps 41.2KB 41.3KB +23.0B

History

Copy link
Contributor

@nreese nreese left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

kibana-presentation changes LGTM
code review only

@mbondyra mbondyra merged commit bb1f55f into elastic:main Dec 17, 2025
13 checks passed
@mbondyra mbondyra deleted the maps_readonly branch December 17, 2025 14:49
mbondyra added a commit to mbondyra/kibana that referenced this pull request Dec 17, 2025
…donly

* commit 'bb1f55fa520b30ceb923af069ef403b24dcb1606': (52 commits)
  [CPS][Maps] Support CPS Picker in Maps  (elastic#246382)
  [APM] Migrate the Transaction Overview tests to Scout/Playwright/Component/API tests (elastic#245972)
  [Cases] Change nested field search to be case insensitive (elastic#246643)
  [ES|QL] PromQL parser initial implementation (elastic#246552)
  [Agent Builder] Adds keyboard shortcut and toggle behavior to AI Agent button (elastic#246659)
  Retry on "all shards failed" from ES (elastic#246533)
  [Streams] Test enable wired streams flow (elastic#246113)
  [Agent Builder] Fast-follow bugfixes for MCP Tool type  (elastic#246665)
  [Entity Store][API] Fix snake case on CRUD API List response (elastic#246003)
  [ResponseOps][Slack] Simplify channel configuration  (elastic#245423)
  Add Canonical Name Badge to Documentation (elastic#246647)
  [Streams] Add simulation filtering by conditions (elastic#245400)
  [o11y AI] Add `get_hosts` tool (elastic#246541)
  [agent builder] create_visualization: support heatmap and regionmap (elastic#246671)
  [AI Infra] Chat experience: Selection modal title change (elastic#246683)
  [Background search] Change polling behavior (elastic#244760)
  [ES|QL  ]  Common Lookup Join Fields Are Not Listed First (elastic#246582)
  Add missing `dynamic: false` (elastic#246685)
  [Metrics in Discover] Unskip metrics api test (elastic#246593)
  [ES|QL] Show next actions after simple field assignment in RERANK ON Clause (elastic#246676)
  ...
KodeRad pushed a commit to KodeRad/kibana that referenced this pull request Dec 17, 2025
## Summary

Supports CPS project picker in Maps. When changing the picker setting,
maps refetch the data with the correct `project_routing` parameter.
*Note*: This does NOT allow yet saving the project routing setting to
the maps saved object

Also fixes the fact I forgot to pass `project_routing` to esql source.

#### To test: 
1. Navigate to Maps and create a new map
2. Add a few layers with Elasticsearch data sources (e.g., documents,
clusters, heatmap)
3. Open browser DevTools Network tab (optionally, filter for search
requests)
  4. Click the CPS picker and change the project routing setting
  5. Verify that:
    - Maps layers refetch data automatically
- Search requests include `project_routing` parameter in the request
body
- Different CPS settings result in different project_routing values in
requests (none for All projects)


https://github.com/user-attachments/assets/8cbd4348-e2b0-445b-b260-64d5b1a3077f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants