Skip to content

Conversation

@wanglam
Copy link
Collaborator

@wanglam wanglam commented Oct 23, 2025

Description

This PR enhances the global search functionality by adding two new capabilities:

  1. Assets Search Command: Enables searching for dashboards and visualizations directly from the global search bar. Users can now quickly find and navigate to saved objects without leaving their current context.

  2. Search Submit Commands: Introduces a new command type that executes when users press Enter in the search bar, providing a more intuitive way to perform search-related actions.

Key changes include:

  • Added searchAssets function to search for dashboards and visualizations via the saved objects API
  • Implemented GlobalSearchSubmitCommand interface for Enter-key triggered actions
  • Enhanced the search bar UI to display submit command hints and handle Enter key events
  • Updated global search service to support both regular and submit commands

Issues

#10741

Screenshot

image

Changelog

  • feat: Add assets search command to find dashboards and visualizations from global search
  • feat: Add search submit commands for Enter-key triggered actions in global search

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

@codecov
Copy link

codecov bot commented Oct 23, 2025

Codecov Report

❌ Patch coverage is 67.04545% with 29 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.53%. Comparing base (c9d8c62) to head (fd01ac3).
⚠️ Report is 17 commits behind head on main.

Files with missing lines Patch % Lines
...core/public/chrome/ui/header/header_search_bar.tsx 60.00% 13 Missing and 3 partials ⚠️
src/plugins/workspace/public/plugin.ts 22.22% 7 Missing ⚠️
...components/global_search/search_assets_command.tsx 86.95% 0 Missing and 3 partials ⚠️
...blic/chrome/global_search/global_search_service.ts 85.71% 1 Missing and 1 partial ⚠️
src/core/public/chrome/chrome_service.mock.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #10789      +/-   ##
==========================================
- Coverage   60.56%   60.53%   -0.04%     
==========================================
  Files        4492     4512      +20     
  Lines      120315   121375    +1060     
  Branches    19952    20251     +299     
==========================================
+ Hits        72869    73471     +602     
- Misses      42403    42754     +351     
- Partials     5043     5150     +107     
Flag Coverage Δ
Linux_1 26.56% <27.27%> (-0.01%) ⬇️
Linux_2 38.84% <66.07%> (+0.02%) ⬆️
Linux_3 ?
Linux_4 33.60% <3.57%> (+0.29%) ⬆️
Windows_1 26.58% <27.27%> (-0.01%) ⬇️
Windows_2 38.82% <66.07%> (+0.02%) ⬆️
Windows_3 39.06% <3.57%> (-0.11%) ⬇️
Windows_4 33.60% <3.57%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>
Signed-off-by: Lin Wang <[email protected]>

export interface GlobalSearchServiceSetupContract {
registerSearchCommand(searchCommand: GlobalSearchCommand): void;
registerSearchSubmitCommand(searchResultCommand: GlobalSearchSubmitCommand): void;
Copy link
Member

Choose a reason for hiding this comment

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

what's the difference between registerSearchCommand and registerSearchSubmitCommand? would be nice to add comment to each of them

public setup(): GlobalSearchServiceSetupContract {
return {
registerSearchCommand: this.registerSearchCommand.bind(this),
registerSearchSubmitCommand: this.registerSearchSubmitCommand,
Copy link
Member

Choose a reason for hiding this comment

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

I don't seem to see where is this function called registerSearchSubmitCommand, did I miss anything?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

For now the only search submit command is in the dashboards-assistant repo. Will raise a new PR for adding an example for this new methods.

@ruanyl
Copy link
Member

ruanyl commented Oct 24, 2025

Can we specify the type of assets when searching? Right now it seems to search all types of saved object, can we specify type in the query? for example: @vis:test, this will search visualization with keyword test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants