Skip to content

[serverless] Advanced Settings - Field Row components#165286

Merged
clintandrewhall merged 4 commits intoelastic:mainfrom
clintandrewhall:advanced_settings/field
Sep 11, 2023
Merged

[serverless] Advanced Settings - Field Row components#165286
clintandrewhall merged 4 commits intoelastic:mainfrom
clintandrewhall:advanced_settings/field

Conversation

@clintandrewhall
Copy link
Copy Markdown
Contributor

@clintandrewhall clintandrewhall commented Aug 31, 2023

Caveat: the functional flow logic here is not one I would encourage, specifically, using "drilled" onChange handlers and a composing component-based store. Ideally, we'd use a redux store, or, at the very least a React reducer.

In the interest of time and compatibility, we've opted to use the pattern from the original components in advancedSettings. We plan to revisit the state management and prop-drilling when advancedSettings is refactored with these components.

Summary

This is a PR for new inputs and field row components for Advanced Settings.

form_row

This code was extracted from the advancedSettings plugin and refactored/simplified/typed for a modern Kibana. The PR has been divided into several commits for ease of review: components and stories. Tests and documentation will follow in additional commits.

Next steps

Testing

The Storybook build will be the best way to view/test these new components, aside from applying the code to your branch. These are pure additions-- integration will happen in Serverless soon, and likely in Advanced Settings sometime after.

Code coverage stands at 87%. Some components are incredibly difficult to test, but this coverage is pretty good. Run node scripts/jest packages/kbn-management/settings --coverage for details.

-----------------------------------|---------|----------|---------|---------|-------------------
File                               | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s
-----------------------------------|---------|----------|---------|---------|-------------------
All files                          |   87.27 |    85.36 |   84.26 |   87.21 |
 components/field_input            |   71.81 |    78.33 |   33.33 |   71.81 |
  code_editor.tsx                  |    9.67 |        0 |       0 |    9.67 | 38-101
  field_input.tsx                  |     100 |      100 |     100 |     100 |
  services.tsx                     |      75 |       50 |      50 |      75 | 32-35,52
 components/field_input/input      |   91.76 |    93.61 |      92 |   91.66 |
  array_input.tsx                  |     100 |      100 |     100 |     100 |
  boolean_input.tsx                |     100 |      100 |     100 |     100 |
  code_editor_input.tsx            |     100 |    91.66 |     100 |     100 | 89
  color_picker_input.tsx           |     100 |      100 |     100 |     100 |
  image_input.tsx                  |   74.07 |    81.81 |   66.66 |   74.07 | 33,36,67-68,80-83
  index.ts                         |     100 |      100 |     100 |     100 |
  number_input.tsx                 |     100 |      100 |     100 |     100 |
  select_input.tsx                 |     100 |      100 |     100 |     100 |
  text_input.tsx                   |     100 |      100 |     100 |     100 |
 components/field_row              |   95.23 |    81.25 |    87.5 |   95.23 |
  field_row.styles.ts              |     100 |       75 |     100 |     100 | 48
  field_row.tsx                    |     100 |       90 |     100 |     100 | 123
  services.tsx                     |   81.81 |       50 |   66.66 |   81.81 | 42,60
 components/field_row/description  |   96.29 |    81.25 |      75 |   96.29 |
  default_value.tsx                |     100 |     87.5 |     100 |     100 | 47
  deprecation.tsx                  |    87.5 |      100 |      50 |    87.5 | 52
  description.tsx                  |     100 |    66.66 |     100 |     100 | 54,66
 components/field_row/input_footer |   96.55 |      100 |      80 |   96.55 |
  change_image_link.tsx            |    90.9 |      100 |      50 |    90.9 | 73
  input_footer.tsx                 |     100 |      100 |     100 |     100 |
  overridden_message.tsx           |     100 |      100 |     100 |     100 |
  reset_link.tsx                   |     100 |      100 |     100 |     100 |
 components/field_row/title        |     100 |       75 |     100 |     100 |
  icon_custom.tsx                  |     100 |      100 |     100 |     100 |
  icon_unsaved.tsx                 |     100 |       70 |     100 |     100 | 48-53
  title.tsx                        |     100 |      100 |     100 |     100 |
 field_definition                  |   69.23 |    66.66 |      80 |   69.23 |
  get_definition.ts                |   69.23 |    66.66 |      80 |   69.23 | 45-57
 field_definition/is               |     100 |      100 |     100 |     100 |
  field_definition.ts              |     100 |      100 |     100 |     100 |
  unsaved_change.ts                |     100 |      100 |     100 |     100 |
 section_registry                  |     100 |      100 |     100 |     100 |
  section_registry.ts              |     100 |      100 |     100 |     100 |
 utilities                         |     100 |      100 |     100 |     100 |
  get_input_value.ts               |     100 |      100 |     100 |     100 |
  has_unsaved_change.ts            |     100 |      100 |     100 |     100 |
  is_unsaved_value.ts              |     100 |      100 |     100 |     100 |
-----------------------------------|---------|----------|---------|---------|-------------------

Test Suites: 18 passed, 18 total
Tests:       145 passed, 145 total

@clintandrewhall clintandrewhall added WIP Work in progress Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages ci:build-storybooks labels Aug 31, 2023
@clintandrewhall clintandrewhall requested review from a team and ElenaStoeva August 31, 2023 05:10
@clintandrewhall clintandrewhall force-pushed the advanced_settings/field branch 3 times, most recently from 7c22877 to 5bdfdde Compare August 31, 2023 18:40
Comment thread packages/kbn-management/settings/components/field_row/__stories__/common.tsx Outdated
@clintandrewhall clintandrewhall added review loe:large Large Level of Effort release_note:skip Skip the PR/issue when compiling release notes impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. and removed WIP Work in progress labels Sep 6, 2023
@clintandrewhall clintandrewhall marked this pull request as ready for review September 6, 2023 19:24
@clintandrewhall clintandrewhall requested a review from a team as a code owner September 6, 2023 19:24
@clintandrewhall clintandrewhall force-pushed the advanced_settings/field branch 2 times, most recently from 319dddc to a74ad4b Compare September 6, 2023 19:30
Copy link
Copy Markdown
Contributor

@jbudz jbudz left a comment

Choose a reason for hiding this comment

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

packages/kbn-storybook

@clintandrewhall clintandrewhall requested a review from a team as a code owner September 7, 2023 17:16
@clintandrewhall clintandrewhall requested a review from a team September 7, 2023 17:16
@clintandrewhall clintandrewhall requested review from a team as code owners September 7, 2023 17:16
@botelastic botelastic Bot added the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Sep 7, 2023
@clintandrewhall clintandrewhall force-pushed the advanced_settings/field branch 3 times, most recently from 081c421 to ff08583 Compare September 7, 2023 17:32
@clintandrewhall clintandrewhall requested review from a team and removed request for a team September 7, 2023 17:33
@elastic elastic deleted a comment from elasticmachine Sep 7, 2023
@clintandrewhall clintandrewhall removed the Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability label Sep 7, 2023
Copy link
Copy Markdown
Contributor

@ElenaStoeva ElenaStoeva left a comment

Choose a reason for hiding this comment

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

Amazing work @clintandrewhall, thanks a lot for making these improvements! Overall, looks great to me.

I only have a question about the storybook for the select component.

@clintandrewhall clintandrewhall force-pushed the advanced_settings/field branch 2 times, most recently from 4f4572b to 06940ab Compare September 11, 2023 14:51
@kibana-ci
Copy link
Copy Markdown

💚 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/management-settings-components-field-input - 1 +1
@kbn/management-settings-components-field-row - 2 +2
@kbn/management-settings-utilities - 30 +30
total +33
Unknown metric groups

API count

id before after diff
@kbn/management-settings-components-field-input - 20 +20
@kbn/management-settings-components-field-row - 11 +11
@kbn/management-settings-field-definition - 42 +42
@kbn/management-settings-types - 71 +71
@kbn/management-settings-utilities - 39 +39
total +183

ESLint disabled line counts

id before after diff
@kbn/management-settings-components-field-input - 1 +1
@kbn/management-settings-components-field-row - 2 +2
total +3

References to deprecated APIs

id before after diff
@kbn/management-settings-field-definition - 1 +1

Total ESLint disabled count

id before after diff
@kbn/management-settings-components-field-input - 1 +1
@kbn/management-settings-components-field-row - 2 +2
total +3

History

  • 💔 Build #158096 failed 2fe2fa01bbf6d72f9270269f78862cbb30a307fb
  • 💔 Build #158026 failed 06940ab75fb21bfc5beb50aa023e7be2fdb548a4
  • 💔 Build #157839 failed 4f4572b4d971a6b2705f607b6e7fd71c0de2b440
  • 💔 Build #157391 failed 357f90553e30b6d32974e20652f8e1ad59da1f6b
  • 💔 Build #157357 failed 23eac5fab3aa88ed8d3aab2f35a4dab862bb8c6f

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

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

Labels

backport:skip This PR does not require backporting ci:build-storybooks Feature:Kibana Management Feature label for Data Views, Advanced Setting, Saved Object management pages impact:high Addressing this issue will have a high level of impact on the quality/strength of our product. loe:large Large Level of Effort release_note:skip Skip the PR/issue when compiling release notes review v8.11.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants