Skip to content
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

[Data views] Implement persistable state #132959

Merged
merged 14 commits into from
Jun 7, 2022

Conversation

lukasolson
Copy link
Member

@lukasolson lukasolson commented May 25, 2022

Summary

Part of #129480.

Implements the PersistableState interface for data views. Currently these are a no-op, but this could change in the future.

As PersistableState interface requires Serializable to be implemented, I needed to update some of the types from DataViewSpec to properly implement Serializable. For many types, this was simply a matter of converting from an interface to a type.

Checklist

For maintainers

@lukasolson lukasolson added Feature:Data Views Data Views code and UI - index patterns before 8.0 Team:AppServicesSv release_note:skip Skip the PR/issue when compiling release notes labels May 25, 2022
@lukasolson lukasolson requested a review from a team as a code owner May 25, 2022 17:37
@lukasolson lukasolson self-assigned this May 25, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-services (Team:AppServicesSv)

Copy link
Member Author

@lukasolson lukasolson left a comment

Choose a reason for hiding this comment

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

Need to add to data view service as well.

import { PersistableStateService } from '@kbn/kibana-utils-plugin/common';

export const DataViewPersistableStateService: PersistableStateService<DataViewBaseSerializable> = {
inject: (state, references) => {
Copy link
Member

Choose a reason for hiding this comment

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

As data view spec can contain fields we should call field methods inside each of this.

cc @mattkime @sixstringcode if we don't plan to work on local runtime fields (if local data views can satisfy that requirement for some time) then we don't need to implement persistable state interface for fields.

Copy link
Member Author

Choose a reason for hiding this comment

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

I believe from my conversation with @mattkime that this is still up in the air, so I'll remove the implementation for fields from this PR.

@lukasolson lukasolson requested a review from a team as a code owner June 2, 2022 20:43
@lukasolson lukasolson requested a review from Dosant June 2, 2022 20:45
@@ -34,7 +36,8 @@ export interface IFieldSubTypeNested {
* A base interface for an index pattern field
* @public
*/
export interface DataViewFieldBase {
// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
export type DataViewFieldBase = {
Copy link
Member Author

Choose a reason for hiding this comment

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

These changes are necessary for DataViewFieldBase to meet the SerializableRecord definition, which is necessary for implementing persistable state. I could also do export interface DataViewFieldBase extends SerializableRecord but that add unnamed properties to the DataViewFieldBase spec.

@lukasolson lukasolson requested a review from a team as a code owner June 2, 2022 23:10
@lukasolson lukasolson requested a review from a team as a code owner June 2, 2022 23:53
Copy link
Contributor

@darnautov darnautov left a comment

Choose a reason for hiding this comment

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

ML changes LGTM

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

VisEditors type changes LGTM

Copy link
Contributor

@Dosant Dosant left a comment

Choose a reason for hiding this comment

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

FF changes lgtm 👍

@lukasolson lukasolson requested a review from ppisljar June 3, 2022 18:04
Copy link
Member

@ppisljar ppisljar left a comment

Choose a reason for hiding this comment

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

LGTM

@lukasolson
Copy link
Member Author

@elasticmachine merge upstream

@kibanamachine kibanamachine requested a review from a team as a code owner June 6, 2022 17:05
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

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/es-query 168 162 -6
data 2522 2520 -2
dataViews 187 184 -3
fieldFormats 251 245 -6
total -17

Async chunks

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

id before after diff
dataViewFieldEditor 147.9KB 148.0KB +30.0B
lens 1.2MB 1.2MB +2.0B
total +32.0B

Page load bundle

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

id before after diff
data 424.6KB 424.7KB +24.0B
Unknown metric groups

API count

id before after diff
@kbn/es-query 222 213 -9
data 3431 3398 -33
dataViews 987 914 -73
fieldFormats 290 284 -6
total -121

ESLint disabled line counts

id before after diff
@kbn/es-query 4 8 +4
dataViews 4 10 +6
fieldFormats 3 5 +2
total +12

Total ESLint disabled count

id before after diff
@kbn/es-query 5 9 +4
dataViews 6 12 +6
fieldFormats 3 5 +2
total +12

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

cc @lukasolson

Copy link
Contributor

@shahzad31 shahzad31 left a comment

Choose a reason for hiding this comment

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

Uptime code owner changes LGTM !!

@lukasolson lukasolson merged commit 6a7ad6f into elastic:main Jun 7, 2022
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jun 9, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 132959 locally

2 similar comments
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 132959 locally

@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 132959 locally

@flash1293 flash1293 removed the v9.0.0 label Jun 13, 2022
@kibanamachine kibanamachine added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Jun 13, 2022
@flash1293 flash1293 removed the backport:skip This commit does not require backporting label Jun 13, 2022
@kibanamachine kibanamachine added the backport:skip This commit does not require backporting label Jun 13, 2022
@bhavyarm
Copy link
Contributor

@lukasolson how do I make sure this is working fine? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Data Views Data Views code and UI - index patterns before 8.0 release_note:skip Skip the PR/issue when compiling release notes v8.4.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants