-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ES|QL] Starred queries in the editor #198362
Conversation
packages/content-management/favorites/favorites_public/src/favorites_client.ts
Outdated
Show resolved
Hide resolved
…a into d/2024-10-30-esql-favorites
… src/core/server/integration_tests/ci_checks'
…a into d/2024-10-30-esql-favorites
packages/content-management/favorites/favorites_server/src/favorites_service.ts
Outdated
Show resolved
Hide resolved
… src/core/server/integration_tests/ci_checks'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codeowner changes LGMT, tested locally in 2 browsers with the same account, starred queries show up in both. Works as expected.
2 non blocking questions:
- What's the reason we add those new tests to x-pack?
- Should we add this nice new feature to our serverless tests?
🙇
@kertal why in x-pack I explain it here #198362 (comment)
Hmmm we could possibly on a follow - up PR, wdyt @Dosant ? (although I am trying to be conversative on our FTs). If the backend service is being tested in serverless maybe is not needed. But I will evaluate with Anton |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally, feature works as advertised.
thanks, I agree, I'd like to follow up (also for dashboard favorites). I'll create an issue and will work on it shortly |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and LGTM 🎉
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
async chunk count
ESLint disabled line counts
miscellaneous assets size
Total ESLint disabled count
History
|
Starting backport for target branches: 8.x https://github.com/elastic/kibana/actions/runs/11900903246 |
💚 All backports created successfully
Note: Successful backport PRs will be merged automatically after passing CI. Questions ?Please refer to the Backport tool documentation |
## Summary close elastic#194165 close elastic/kibana-team#1245 ### User-facing <img width="1680" alt="image" src="https://github.com/user-attachments/assets/6df4ee9f-1b4d-404c-a764-592998a1d430"> This PRs adds a new tab in the editor history component. You can star your query from the history and then you will see it in the Starred list. The started queries are scoped to a user and a space. ### Server To allow starring ESQL query, this PR extends [favorites service](elastic#189285) with ability to store metadata in addition to an id. To make metadata strict and in future to support proper metadata migrations if needed, metadata needs to be defined as schema: ``` plugins.contentManagement.favorites.registerFavoriteType('esql_query', { typeMetadataSchema: schema.object({ query: schema.string(), timeRange:...., etc... }), }) ``` Notable changes: - Add support for registering a favorite type and a schema for favorite type metadata. Previosly the `dashboard` type was the only supported type and was hardcoded - Add `favoriteMetadata` property to a saved object mapping and make it `enabled:false` we don't want to index it, but just want to store metadata in addition to an id. [code](https://github.com/elastic/kibana/pull/198362/files#diff-d1a39e36f1de11a1110520d7607e6aee7d506c76626993842cb58db012b760a2R74-R87) - Add a 100 favorite items limit (per type per space per user). Just do it for sanity to prevent too large objects due to metadata stored in addtion to ids. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Stratoula Kalafateli <stratoula1@gmail.com> (cherry picked from commit 4597237) # Conflicts: # .github/CODEOWNERS
# Backport This will backport the following commits from `main` to `8.x`: - [[ES|QL] Starred queries in the editor (#198362)](#198362) <!--- Backport version: 8.9.8 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2024-11-18T20:53:46Z","message":"[ES|QL] Starred queries in the editor (#198362)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/194165\r\nclose https://github.com/elastic/kibana-team/issues/1245\r\n\r\n### User-facing\r\n\r\n<img width=\"1680\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6df4ee9f-1b4d-404c-a764-592998a1d430\">\r\n\r\nThis PRs adds a new tab in the editor history component. You can star\r\nyour query from the history and then you will see it in the Starred\r\nlist. The started queries are scoped to a user and a space.\r\n\r\n\r\n### Server\r\n\r\nTo allow starring ESQL query, this PR extends [favorites\r\nservice](#189285) with ability to\r\nstore metadata in addition to an id. To make metadata strict and in\r\nfuture to support proper metadata migrations if needed, metadata needs\r\nto be defined as schema:\r\n\r\n```\r\nplugins.contentManagement.favorites.registerFavoriteType('esql_query', {\r\n typeMetadataSchema: schema.object({ query: schema.string(), timeRange:...., etc... }),\r\n})\r\n```\r\n\r\nNotable changes: \r\n\r\n- Add support for registering a favorite type and a schema for favorite\r\ntype metadata. Previosly the `dashboard` type was the only supported\r\ntype and was hardcoded\r\n- Add `favoriteMetadata` property to a saved object mapping and make it\r\n`enabled:false` we don't want to index it, but just want to store\r\nmetadata in addition to an id.\r\n[code](https://github.com/elastic/kibana/pull/198362/files#diff-d1a39e36f1de11a1110520d7607e6aee7d506c76626993842cb58db012b760a2R74-R87)\r\n- Add a 100 favorite items limit (per type per space per user). Just do\r\nit for sanity to prevent too large objects due to metadata stored in\r\naddtion to ids.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>","sha":"45972374f06a6189ec9e225fd00b191838f33e52","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["v9.0.0","release_note:feature","Team:SharedUX","Feature:ES|QL","Team:ESQL","backport:version","v8.17.0"],"number":198362,"url":"https://github.com/elastic/kibana/pull/198362","mergeCommit":{"message":"[ES|QL] Starred queries in the editor (#198362)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/194165\r\nclose https://github.com/elastic/kibana-team/issues/1245\r\n\r\n### User-facing\r\n\r\n<img width=\"1680\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6df4ee9f-1b4d-404c-a764-592998a1d430\">\r\n\r\nThis PRs adds a new tab in the editor history component. You can star\r\nyour query from the history and then you will see it in the Starred\r\nlist. The started queries are scoped to a user and a space.\r\n\r\n\r\n### Server\r\n\r\nTo allow starring ESQL query, this PR extends [favorites\r\nservice](#189285) with ability to\r\nstore metadata in addition to an id. To make metadata strict and in\r\nfuture to support proper metadata migrations if needed, metadata needs\r\nto be defined as schema:\r\n\r\n```\r\nplugins.contentManagement.favorites.registerFavoriteType('esql_query', {\r\n typeMetadataSchema: schema.object({ query: schema.string(), timeRange:...., etc... }),\r\n})\r\n```\r\n\r\nNotable changes: \r\n\r\n- Add support for registering a favorite type and a schema for favorite\r\ntype metadata. Previosly the `dashboard` type was the only supported\r\ntype and was hardcoded\r\n- Add `favoriteMetadata` property to a saved object mapping and make it\r\n`enabled:false` we don't want to index it, but just want to store\r\nmetadata in addition to an id.\r\n[code](https://github.com/elastic/kibana/pull/198362/files#diff-d1a39e36f1de11a1110520d7607e6aee7d506c76626993842cb58db012b760a2R74-R87)\r\n- Add a 100 favorite items limit (per type per space per user). Just do\r\nit for sanity to prevent too large objects due to metadata stored in\r\naddtion to ids.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>","sha":"45972374f06a6189ec9e225fd00b191838f33e52"}},"sourceBranch":"main","suggestedTargetBranches":["8.x"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","labelRegex":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/198362","number":198362,"mergeCommit":{"message":"[ES|QL] Starred queries in the editor (#198362)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/194165\r\nclose https://github.com/elastic/kibana-team/issues/1245\r\n\r\n### User-facing\r\n\r\n<img width=\"1680\" alt=\"image\"\r\nsrc=\"https://github.com/user-attachments/assets/6df4ee9f-1b4d-404c-a764-592998a1d430\">\r\n\r\nThis PRs adds a new tab in the editor history component. You can star\r\nyour query from the history and then you will see it in the Starred\r\nlist. The started queries are scoped to a user and a space.\r\n\r\n\r\n### Server\r\n\r\nTo allow starring ESQL query, this PR extends [favorites\r\nservice](#189285) with ability to\r\nstore metadata in addition to an id. To make metadata strict and in\r\nfuture to support proper metadata migrations if needed, metadata needs\r\nto be defined as schema:\r\n\r\n```\r\nplugins.contentManagement.favorites.registerFavoriteType('esql_query', {\r\n typeMetadataSchema: schema.object({ query: schema.string(), timeRange:...., etc... }),\r\n})\r\n```\r\n\r\nNotable changes: \r\n\r\n- Add support for registering a favorite type and a schema for favorite\r\ntype metadata. Previosly the `dashboard` type was the only supported\r\ntype and was hardcoded\r\n- Add `favoriteMetadata` property to a saved object mapping and make it\r\n`enabled:false` we don't want to index it, but just want to store\r\nmetadata in addition to an id.\r\n[code](https://github.com/elastic/kibana/pull/198362/files#diff-d1a39e36f1de11a1110520d7607e6aee7d506c76626993842cb58db012b760a2R74-R87)\r\n- Add a 100 favorite items limit (per type per space per user). Just do\r\nit for sanity to prevent too large objects due to metadata stored in\r\naddtion to ids.\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>\r\nCo-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co>\r\nCo-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>","sha":"45972374f06a6189ec9e225fd00b191838f33e52"}},{"branch":"8.x","label":"v8.17.0","labelRegex":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
…00985) ## Summary close elastic#200701 As a follow-up to elastic#198362 would like to add very basic serverless test that check that the favorites (starred) API works (cherry picked from commit 38fab2d)
…0985) (#201946) # Backport This will backport the following commits from `main` to `8.x`: - [Add smoke serverless tests for favorites (starred) feature (#200985)](#200985) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Anton Dosov","email":"anton.dosov@elastic.co"},"sourceCommit":{"committedDate":"2024-11-27T11:30:49Z","message":"Add smoke serverless tests for favorites (starred) feature (#200985)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/200701\r\n\r\nAs a follow-up to #198362 would\r\nlike to add very basic serverless test that check that the favorites\r\n(starred) API works","sha":"38fab2df6ca857e5f03b1392c63bfd8a353430ea","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","Team:SharedUX","backport:prev-minor"],"title":"Add smoke serverless tests for favorites (starred) feature","number":200985,"url":"https://github.com/elastic/kibana/pull/200985","mergeCommit":{"message":"Add smoke serverless tests for favorites (starred) feature (#200985)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/200701\r\n\r\nAs a follow-up to #198362 would\r\nlike to add very basic serverless test that check that the favorites\r\n(starred) API works","sha":"38fab2df6ca857e5f03b1392c63bfd8a353430ea"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/200985","number":200985,"mergeCommit":{"message":"Add smoke serverless tests for favorites (starred) feature (#200985)\n\n## Summary\r\n\r\nclose https://github.com/elastic/kibana/issues/200701\r\n\r\nAs a follow-up to #198362 would\r\nlike to add very basic serverless test that check that the favorites\r\n(starred) API works","sha":"38fab2df6ca857e5f03b1392c63bfd8a353430ea"}}]}] BACKPORT--> Co-authored-by: Anton Dosov <anton.dosov@elastic.co>
## Summary close elastic#194165 close elastic/kibana-team#1245 ### User-facing <img width="1680" alt="image" src="https://github.com/user-attachments/assets/6df4ee9f-1b4d-404c-a764-592998a1d430"> This PRs adds a new tab in the editor history component. You can star your query from the history and then you will see it in the Starred list. The started queries are scoped to a user and a space. ### Server To allow starring ESQL query, this PR extends [favorites service](elastic#189285) with ability to store metadata in addition to an id. To make metadata strict and in future to support proper metadata migrations if needed, metadata needs to be defined as schema: ``` plugins.contentManagement.favorites.registerFavoriteType('esql_query', { typeMetadataSchema: schema.object({ query: schema.string(), timeRange:...., etc... }), }) ``` Notable changes: - Add support for registering a favorite type and a schema for favorite type metadata. Previosly the `dashboard` type was the only supported type and was hardcoded - Add `favoriteMetadata` property to a saved object mapping and make it `enabled:false` we don't want to index it, but just want to store metadata in addition to an id. [code](https://github.com/elastic/kibana/pull/198362/files#diff-d1a39e36f1de11a1110520d7607e6aee7d506c76626993842cb58db012b760a2R74-R87) - Add a 100 favorite items limit (per type per space per user). Just do it for sanity to prevent too large objects due to metadata stored in addtion to ids. --------- Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Stratoula Kalafateli <efstratia.kalafateli@elastic.co> Co-authored-by: Stratoula Kalafateli <stratoula1@gmail.com>
…00985) ## Summary close elastic#200701 As a follow-up to elastic#198362 would like to add very basic serverless test that check that the favorites (starred) API works
Summary
close #194165
close https://github.com/elastic/kibana-team/issues/1245
User-facing
This PRs adds a new tab in the editor history component. You can star your query from the history and then you will see it in the Starred list. The started queries are scoped to a user and a space.
Server
To allow starring ESQL query, this PR extends favorites service with ability to store metadata in addition to an id. To make metadata strict and in future to support proper metadata migrations if needed, metadata needs to be defined as schema:
Notable changes:
dashboard
type was the only supported type and was hardcodedfavoriteMetadata
property to a saved object mapping and make itenabled:false
we don't want to index it, but just want to store metadata in addition to an id. code