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

Typescript index pattern field editor #63495

Merged
merged 31 commits into from
Apr 27, 2020

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Apr 14, 2020

Summary

Convert index pattern field editor to typescript

Note: This code could really use a larger refactoring as objects are created and modified in some very typescript unfriendly ways. I would prefer to track these items in a tech debt ticket so index pattern management can be migrated to the new platform in 7.8.

Part of #51322

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@elastic elastic deleted a comment from kibanamachine Apr 23, 2020
@mattkime mattkime changed the title Typescript ui field editor Typescript index pattern field editor Apr 24, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app-arch (Team:AppArch)

@mattkime mattkime added this to In progress in kibana-app-arch via automation Apr 24, 2020
@mattkime mattkime added Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages labels Apr 24, 2020
@mattkime mattkime added the release_note:skip Skip the PR/issue when compiling release notes label Apr 24, 2020
@mattkime mattkime marked this pull request as ready for review April 24, 2020 03:33
@mattkime mattkime requested a review from a team as a code owner April 24, 2020 03:33
@elastic elastic deleted a comment from kibanamachine Apr 24, 2020
@@ -609,7 +609,7 @@ export class Plugin implements Plugin_2<PluginSetup, PluginStart> {
// (undocumented)
setup(core: CoreSetup, { usageCollection }: DataPluginSetupDependencies): {
fieldFormats: {
register: (customFieldFormat: import("../common").FieldFormatInstanceType) => number;
register: (customFieldFormat: import("../public").FieldFormatInstanceType) => number;
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm uncertain why this change appears since I'm unable to find a corresponding code change. Perhaps there's an indirect change.

@elastic elastic deleted a comment from kibanamachine Apr 24, 2020
@elastic elastic deleted a comment from kibanamachine Apr 24, 2020
Copy link
Contributor

@streamich streamich left a comment

Choose a reason for hiding this comment

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

Code changes LGTM. Below added few optional nits/questions.

I think I counted 62 .md files that are autogenerated in this PR, good that you raised this at our team sync, the autogenerated .md files seem indeed to be out of control, would be great to think about ways to reduce noise from them going forward.

@@ -793,10 +838,31 @@ exports[`FieldEditor should show deprecated lang warning 1`] = `
isVisible={false}
/>
<scripting-warning-callOut
docLinksScriptedFields={
Copy link
Contributor

Choose a reason for hiding this comment

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

In this snapshot a number of times snapshot of docLinksScriptedFields is take, is that something we want to save?

> {
static formatId = 'duration';
state = {
...defaultState,
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it safe to use defaultState here? I'm wondering if the state of parent class could change in the future. Maybe it is safer to keep

this.state.sampleInputs = [-123, 1, 12, 123, 658, 1988, 3857, 123292, 923528271];
this.state.hasDecimalError = false;

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm thinking about this from the perspective of "is there the potential for unwanted shared state?" Since instances of the classes will be created I think the answer is no. Yes, its possible that code might be shared in an unwanted manner somewhere down the line but 🤷

Array [
Object {
"content": <ScriptingSyntax
docLinksScriptedFields={
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe in this file, too, we can stub docLinksScriptedFields as empty object {}.

Comment on lines 221 to 222
// @ts-ignore
field[fieldName] = value;
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we avoid @ts-ignore here, maybe below would work

Suggested change
// @ts-ignore
field[fieldName] = value;
(field as any)[fieldName] = value;

kibana-app-arch automation moved this from In progress to Review in progress Apr 27, 2020
@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@mattkime mattkime merged commit 231de27 into elastic:master Apr 27, 2020
kibana-app-arch automation moved this from Review in progress to Done in current release Apr 27, 2020
mattkime added a commit to mattkime/kibana that referenced this pull request Apr 28, 2020
* Typescript index pattern field editor
mattkime added a commit that referenced this pull request Apr 28, 2020
* Typescript index pattern field editor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Data Views Data Views code and UI - index patterns before 8.0 Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages release_note:skip Skip the PR/issue when compiling release notes v7.8.0 v8.0.0
Projects
kibana-app-arch
  
Done in current release
Development

Successfully merging this pull request may close these issues.

None yet

4 participants