Skip to content

[8.x] [ES|QL] Starred queries in the editor (#198362)#200672

Merged
stratoula merged 1 commit intoelastic:8.xfrom
stratoula:backport/8.x/pr-198362
Nov 19, 2024
Merged

[8.x] [ES|QL] Starred queries in the editor (#198362)#200672
stratoula merged 1 commit intoelastic:8.xfrom
stratoula:backport/8.x/pr-198362

Conversation

@stratoula
Copy link
Contributor

Backport

This will backport the following commits from main to 8.x:

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
@stratoula stratoula added the backport This PR is a backport of another PR label Nov 19, 2024
@stratoula stratoula enabled auto-merge (squash) November 19, 2024 06:45
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
esql 99 112 +13
lens 1478 1491 +13
stackAlerts 169 182 +13
total +39

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
@kbn/content-management-favorites-common - 1 +1
@kbn/content-management-favorites-public 44 42 -2
@kbn/content-management-favorites-server 7 13 +6
contentManagement 125 126 +1
total +6

Async chunks

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

id before after diff
dashboard 647.2KB 647.4KB +139.0B
esql 183.8KB 194.3KB +10.5KB
eventAnnotationListing 229.4KB 229.5KB +74.0B
filesManagement 123.1KB 123.2KB +74.0B
graph 415.8KB 415.9KB +74.0B
maps 3.0MB 3.0MB +74.0B
visualizations 318.2KB 318.3KB +74.0B
total +11.0KB

Public APIs missing exports

Total count of every type that is part of your API that should be exported but is not. This will cause broken links in the API documentation system. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats exports for more detailed information.

id before after diff
@kbn/content-management-favorites-public 0 1 +1
@kbn/content-management-favorites-server 0 1 +1
total +2

Page load bundle

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

id before after diff
esql 6.5KB 6.9KB +445.0B
Unknown metric groups

API count

id before after diff
@kbn/content-management-favorites-common - 1 +1
@kbn/content-management-favorites-public 45 43 -2
@kbn/content-management-favorites-server 7 13 +6
contentManagement 149 150 +1
total +6

async chunk count

id before after diff
esql 3 4 +1

ESLint disabled line counts

id before after diff
@kbn/content-management-favorites-server 0 1 +1
@kbn/esql-editor 5 6 +1
contentManagement 6 5 -1
total +1

miscellaneous assets size

id before after diff
esql 0.0B 225.5KB ⚠️ +225.5KB
lens 931.7KB 1.1MB ⚠️ +225.5KB
stackAlerts 0.0B 225.5KB ⚠️ +225.5KB
total +676.6KB

Total ESLint disabled count

id before after diff
@kbn/content-management-favorites-server 0 1 +1
@kbn/esql-editor 5 6 +1
contentManagement 6 5 -1
total +1

@stratoula stratoula disabled auto-merge November 19, 2024 08:24
@stratoula stratoula merged commit f5ca0f7 into elastic:8.x Nov 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport This PR is a backport of another PR

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants