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

Index pattern field editor - Add warning on name or type change #95528

Merged

Conversation

mattkime
Copy link
Contributor

@mattkime mattkime commented Mar 26, 2021

Summary

Adds a warning when field name or type is changed.

Screen Shot 2021-04-13 at 1 50 43 PM

@mattkime mattkime changed the title add warning on name or type change Index pattern field editor - Add warning on name or type change Mar 26, 2021
@mattkime
Copy link
Contributor Author

@sebelga It seems that adding the onChange prop to the name field triggers validation when the form is initially opened. Do you know why this might be happening? Its also possible that there's a better way to solve the problem than what I'm doing here.

Screen.Recording.2021-03-25.at.6.36.04.PM.mov

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

@mattkime mattkime added Team:AppServices 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 labels Apr 5, 2021
@mattkime
Copy link
Contributor Author

mattkime commented Apr 5, 2021

@elasticmachine merge upstream

@@ -137,6 +138,11 @@ const geti18nTexts = (): {
},
});

const changeWarning = i18n.translate('indexPatternFieldEditor.editor.form.changeWarning', {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: this might be better inside the geti18nTexts handler above.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The geti18nTexts returns { title: string; description: JSX.Element | string }; and this is a single string.

Copy link
Contributor

Choose a reason for hiding this comment

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

Oh I missed that!

@mattkime mattkime requested a review from sebelga April 5, 2021 19:40
@mattkime mattkime marked this pull request as ready for review April 5, 2021 19:40
@mattkime mattkime requested a review from a team as a code owner April 5, 2021 19:40
@elasticmachine
Copy link
Contributor

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

@sebelga
Copy link
Contributor

sebelga commented Apr 6, 2021

@elasticmachine merge upstream

@mattkime mattkime requested a review from Dosant April 6, 2021 21:12
…_editor/field_editor.tsx

Co-authored-by: gchaps <33642766+gchaps@users.noreply.github.com>
Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

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

LGTM! Thanks for adding this @mattkime .

As I put in the comment, I think it would be better to have a warning callout instead of a form error message. As this is not a form error but a caution for the user.

@@ -221,6 +233,9 @@ const FieldEditorComponent = ({
</EuiFlexItem>
</EuiFlexGroup>

{(nameHasChanged || typeHasChanged) && (
<EuiFormErrorText data-test-subj="changeWarning">{changeWarning}</EuiFormErrorText>
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if a callout warning wouldn't be more appropriate?

Screenshot 2021-04-07 at 11 56 59

{(nameHasChanged || typeHasChanged) && (
  <>
    <EuiSpacer size="xs" />
    <EuiCallOut color="warning" title="Name/type change" iconType="alert" size="s">
      {changeWarning}
    </EuiCallOut>
  </>
)}

If we go that path we can then have the translation (title and description) as part of the geti18nTexts() handler.

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 curious what @ryankeairns thinks - I agree that its not the best to conflate designs for errors and warnings, but its also odd to have a warning thats larger than an error.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@sebelga @ryankeairns is out on vacation for a week. I think we should move forward with this and circle back later.

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe @mdefazio could give us his opinion? Basically between the warning message in the screenshot here and the one in the PR description. Thanks!

Copy link
Contributor

Choose a reason for hiding this comment

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

Here's some quick thoughts:

  1. Can we append (or prepend) the warning icon to the form field if it's changed? and then show that message on hover or click?
  2. Maybe just use the title in the callout instead of title+description. This will shrink the height of the callout and maybe find a middle ground between our concerns.
  3. Perhaps a simpler option would be to show a confirmation dialog with this message when saving. If we do option 1, I think we would still need this approach too.

Happy to work through some more options as well as these are just some that come to mind.

Copy link
Contributor Author

@mattkime mattkime Apr 11, 2021

Choose a reason for hiding this comment

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

To me, the warning callout is too loud. We follow it up with confirm dialog with the same content. Do we really need both? I'm afraid that if we're too loud people might think they're doing something unwise.

I really don't like just showing the title of the warning as then we're failing to explain why we're showing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't want to block on this, just sharing the pattern we've been applying in almost all of our forms. When there is something the user needs to be aware of in a form we either user the yellow or the blue callout. Even if it might look "big", if we consider that it is an important information for him to know we use the EuiCallout as they are meant for that.

If we consider it is not that important in the form and prefer just to have to confirm modal, that could be enough. But personally I don't mind having both to inform the user as soon as possible.

But again, happy if we go either way and don't want to block this PR on this. 😊

Copy link
Contributor

@mdefazio mdefazio Apr 12, 2021

Choose a reason for hiding this comment

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

I really don't like just showing the title of the warning as then we're failing to explain why we're showing it.

I agree with this, and to be clearer, my thought was putting Changing name or type... into the title prop of the callout. I don't think we need the Name / type change

I don't mean to block this either. So I would prefer seeing either both a callout + modal confirmation or just the modal confirmation.

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 spoke to the runtime fields ui working group about this and we've decided to go with the single line warning callout with icon.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated description with new screenshot

@mattkime
Copy link
Contributor Author

mattkime commented Apr 8, 2021

@elasticmachine merge upstream

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.

Code LGTM,
I agree with https://github.com/elastic/kibana/pull/95528/files#r608551323 that error label doesn't seem like the best fit here

@mattkime
Copy link
Contributor Author

mattkime commented Apr 9, 2021

@elasticmachine merge upstream

@mattkime
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@mdefazio mdefazio left a comment

Choose a reason for hiding this comment

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

LGTM

@gchaps
Copy link
Contributor

gchaps commented Apr 13, 2021

Copy LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
indexPatternFieldEditor 21.2KB 22.1KB +974.0B

History

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

@mattkime mattkime merged commit 1cd90d7 into elastic:master Apr 13, 2021
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 14, 2021
…ax_primary_shard_size

* 'master' of github.com:elastic/kibana: (99 commits)
  added missing optional chain for bracket notation (elastic#96939)
  [Discover][DocViewer] Fix toggle columns from doc viewer table tab (elastic#95748)
  [TSVB] Fix per-request caching of index patterns (elastic#97043)
  [Datatable] Fix filter cell flakiness (elastic#96934)
  Unskip heatmap suite and fixes flakiness (elastic#96941)
  [Fleet] Improve performance of data stream API (elastic#97058)
  [ML] Data Frame Analytics: remove beta badge (elastic#96977)
  [App Search] Migrate expanded rows for meta engines table in Engines Overview (elastic#96251)
  Instances latency distribution chart tooltips and axis fixes (elastic#95577)
  [Monitoring] Using primary average shard size (elastic#96177)
  [Workplace Search] Hide Kibana chrome on 3rd party connector redirects (elastic#97028)
  ## [Security Solution] Fixes `Exit full screen` and `Copy to cliboard` styling issues (elastic#96676)
  Index pattern field editor - Add warning on name or type change (elastic#95528)
  [App Search] Add small engine breadcrumb utility helper (elastic#96917)
  Copy esArchiver commands from ./reassign.ts to fix tests (elastic#97012)
  [Security Solution][Detections] Updates MITRE Tactics, Techniques, and Subtechniques for 7.13 (elastic#97011)
  Index patterns server - throw correct error on field caps 404 (elastic#95879)
  Use `EuiThemeProvider` in lists plugin tests and stories (elastic#96129)
  [npm] upgrade caniuse database (elastic#97002)
  chore(NA): moving @kbn/apm-utils into bazel (elastic#96227)
  ...

# Conflicts:
#	x-pack/plugins/index_lifecycle_management/__jest__/client_integration/edit_policy/serialization/policy_serialization.test.ts
#	x-pack/plugins/index_lifecycle_management/public/application/sections/edit_policy/form/schema.ts
phillipb added a commit to phillipb/kibana that referenced this pull request Apr 14, 2021
…to-metrics-tab

* 'master' of github.com:elastic/kibana: (61 commits)
  [Usage collection] Usage counters (elastic#96696)
  UI actions readme (elastic#96925)
  [TSVB] Enable brush for visualizations created with no index patterns (elastic#96727)
  [Data telemetry] Add Async Search to the tests (elastic#96693)
  added missing optional chain for bracket notation (elastic#96939)
  [Discover][DocViewer] Fix toggle columns from doc viewer table tab (elastic#95748)
  [TSVB] Fix per-request caching of index patterns (elastic#97043)
  [Datatable] Fix filter cell flakiness (elastic#96934)
  Unskip heatmap suite and fixes flakiness (elastic#96941)
  [Fleet] Improve performance of data stream API (elastic#97058)
  [ML] Data Frame Analytics: remove beta badge (elastic#96977)
  [App Search] Migrate expanded rows for meta engines table in Engines Overview (elastic#96251)
  Instances latency distribution chart tooltips and axis fixes (elastic#95577)
  [Monitoring] Using primary average shard size (elastic#96177)
  [Workplace Search] Hide Kibana chrome on 3rd party connector redirects (elastic#97028)
  ## [Security Solution] Fixes `Exit full screen` and `Copy to cliboard` styling issues (elastic#96676)
  Index pattern field editor - Add warning on name or type change (elastic#95528)
  [App Search] Add small engine breadcrumb utility helper (elastic#96917)
  Copy esArchiver commands from ./reassign.ts to fix tests (elastic#97012)
  [Security Solution][Detections] Updates MITRE Tactics, Techniques, and Subtechniques for 7.13 (elastic#97011)
  ...
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 15, 2021
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 95528 or prevent reminders by adding the backport:skip label.

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 95528 or prevent reminders by adding the backport:skip label.

mattkime added a commit to mattkime/kibana that referenced this pull request Apr 17, 2021
mattkime added a commit that referenced this pull request Apr 17, 2021
…) (#97386)

* add warning on name or type change

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Apr 17, 2021
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.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants