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

[Lens] Don't block render on missing field #149262

Conversation

drewdaemon
Copy link
Contributor

@drewdaemon drewdaemon commented Jan 19, 2023

Summary

Resolve #143673
Resolve #147485

This PR introduces the new error/warning UI outlined in #147485. In addition

  1. Missing fields are now treated as non-blocking errors ([Lens] Don't block render on missing field validation errors  #143673) and are shown in the toolbar, the dimension button, and the embeddable
  2. Precision warnings are now shown on the corresponding dimension button as well as in the editor toolbar. I included this so that there is an example of warnings on dimension buttons to see.

Screenshots

Editor

Errors

Screen Shot 2023-01-26 at 11 43 58 AM

Screen Shot 2023-01-26 at 11 43 41 AM

Warnings

Screen Shot 2023-01-26 at 11 44 14 AM

Screen Shot 2023-01-26 at 12 14 26 PM

Both

Screen Shot 2023-01-26 at 9 17 05 AM

Embeddable

Errors

Screen Shot 2023-01-27 at 9 26 11 AM

Warnings

Screen Shot 2023-01-27 at 9 21 30 AM

Both

Screen Shot 2023-01-27 at 9 25 17 AM

Checklist

Delete any items that are not applicable to this PR.

drewdaemon and others added 30 commits December 16, 2022 13:14
…m:andrewctate/kibana into 143673/dont-block-render-on-missing-field
@MichaelMarcialis
Copy link
Contributor

@drewdaemon: Thanks for those comments. Some quick responses below:

the EuiCode component wraps text in a code element, which wouldn't be semantically correct in this instance (potential accessibility issue).

I verified that the tooltip text was accessible to a screenreader, however the rest of your reasons for preferring bold typography make sense.

Thanks for checking! In this case though, my accessibility concern was more about the semantics of the element and that the string would be presented as a chunk of code to users, when it's actually not code.


When using the clientip field from the Kibana Sample Data Logs data view to produce the Top 3 values of clientip might be an approximation. warning, I noticed that the warning wasn't showing up when the visualization was placed in a dashboard. Is that intentional?

This warning wasn't shown on the dashboard before and I didn't change that. We can decide to show it, but just be aware that it's a change in behavior. WDYT?

Interesting. Ultimately, I'll defer to the product folks on this. To my mind though, unless the warning doesn't make sense in the context of a dashboard or embed, I think it would make sense to include it (minus the corrective action button, since the user is outside the editor at that point). CCing @ninoslavmiskovic, in case he has an opinion on it.


I had one additional last-minute thought. Originally, I was keen on the notion of having the error/warning icons replace any other prepended icons that were shown on the related dimension item (color swatch, swatch with slash, collapse, hidden, etc.), as you've shown here in your PR. Upon further reflection and after testing, I'm now thinking it may be too heavy-handed for us to replace those icons outright (as some meta information about the dimension may be lost in the process in some instances. Instead, could we show both, but have it so the error/warning icons appear adjacent to the text (rather than sandwiching the other icon in between), as they share the same color? Example below:

image

I don't think this is critical though, so if you'd prefer this to be spun off as a separate issue, let me know.

@drewdaemon
Copy link
Contributor Author

@MichaelMarcialis

Instead, could we show both, but have it so the error/warning icons appear adjacent to the text (rather than sandwiching the other icon in between), as they share the same color?

Done. This is what it looks like

Screenshot 2023-02-02 at 12 04 50 PM

WDYT?

@drewdaemon
Copy link
Contributor Author

@MichaelMarcialis also, here's the new dimension button styling with a color palette dimension

Screenshot 2023-02-02 at 11 49 24 AM

When the delete button is hovered, it runs into the color palette indicator. I'll leave it to you to decide whether that's an issue.
Screenshot 2023-02-02 at 12 10 02 PM

@ninoslavmiskovic
Copy link
Contributor

A couple of comments @MichaelMarcialis and @drewdaemon :

  • I think it is important to showcase to the user that he/she should focus on the warning, and therefore it make sense to overwrite the existing icon to nudge the user to hover over the warning and figure out what is wrong.
  • Adding to icons does not feels scalable - What if we want to add an "i" icon in the future for information etc.

I have in similar indicator exercises gotten lucky and used text and the field border to indicate something is wrong. Red text + red border. Or even making the background of the form field red.

@drewdaemon
Copy link
Contributor Author

@MichaelMarcialis here are the icons with the new padding.

Screenshot 2023-02-02 at 2 14 49 PM

Screenshot 2023-02-02 at 2 13 42 PM

@ninoslavmiskovic thanks for your feedback. I believe @MichaelMarcialis will be out for the first of next week, so if you don't mind, I think we can take your objections to the dimension button icon pattern as a follow up discussion. It's easily changed—if we decide to go another route it can make it in for 8.8 or even sneak in as a bug fix after feature freeze for 8.7 if need be.

With feature freeze looming, I don't want to hold up this PR.

@MichaelMarcialis
Copy link
Contributor

A couple of comments @MichaelMarcialis and @drewdaemon :

  • I think it is important to showcase to the user that he/she should focus on the warning, and therefore it make sense to overwrite the existing icon to nudge the user to hover over the warning and figure out what is wrong.
  • Adding to icons does not feels scalable - What if we want to add an "i" icon in the future for information etc.

I have in similar indicator exercises gotten lucky and used text and the field border to indicate something is wrong. Red text + red border. Or even making the background of the form field red.

@ninoslavmiskovic: For dimension items specifically, I would try to avoid altering the border or background color in an error or warning state (at least, not without some other stylistic changes first). The border styling is currently being used to on hover to indicate drag-and-drop. The changing the background color also becomes problematic/conflicting when you take into account the other elements of color already being used in the dimension items (color swatches, color palettes, delete button, etc.). Not saying we can't do these things, but we'd need to make other adjustments to accommodate.

As for retaining the swatch/visibility/collapse icon before the error/warning icon, I'll ultimately defer to you on that. I agree with your scalability concerns. I was worried that the user may lose some context about the dimension in the process, but if you feel that loss is not significant or important, we can just have the error/warning icons overtake those other icon prepends as @drewdaemon previously had it. As he mentioned, I'm out Monday and Tuesday next week, so I'm good with whatever ya'll decide there.

Copy link
Contributor

@MichaelMarcialis MichaelMarcialis left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes, @drewdaemon! I've left some small comments below for my re-review, but nothing worth blocking you on. I'll go ahead and approve now, as I'll be out early next week. Great work here.

As for the outstanding questions on how to handle the prepended icons and whether to show that warning I mentioned previous on dashboards/embeds, I'll defer to whatever you and the team decide.

<EuiIcon
{...baseIconProps}
type="color"
color="text"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we change this to subdued to match the other prepend icons?

Suggested change
color="text"
color="subdued"

<EuiButtonIcon
className="lnsLayerPanel__dimensionRemove"
data-test-subj="indexPattern-dimension-remove"
iconType="cross"
iconSize="s"
iconType="trash"
size="s"
Copy link
Contributor

Choose a reason for hiding this comment

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

Possible to reduce the size here to xs to fit more comfortably in the dimension item box?

Suggested change
size="s"
size="xs"

>
<ColorIndicator accessorConfig={accessorConfig}>{children}</ColorIndicator>
</EuiLink>
<EuiFlexItem>
Copy link
Contributor

Choose a reason for hiding this comment

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

Is EuiFlexItem needed here? May be able to replace with a regular old div.

Comment on lines +86 to +102
{errorCount > 0 && (
<>
<EuiIcon type={IconError} />
{errorCount}
</>
)}
{warningCount > 0 && (
<>
<EuiIcon
type={IconWarning}
css={css`
margin-left: 4px;
`}
/>
{warningCount}
</>
)}
Copy link
Contributor

Choose a reason for hiding this comment

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

Would it be possible to give the error and warning icons a prop of size="s" when used on dashboard panels and embeds (but not in the Lens toolbar) to better match the designs?

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 890 891 +1

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
lens 599 597 -2

Async chunks

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

id before after diff
lens 1.3MB 1.3MB +3.6KB

Page load bundle

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

id before after diff
data 407.3KB 407.0KB -310.0B
Unknown metric groups

API count

id before after diff
lens 694 692 -2

History

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

@drewdaemon drewdaemon merged commit be37fa1 into elastic:main Feb 3, 2023
@kibanamachine kibanamachine added v8.7.0 backport:skip This commit does not require backporting labels Feb 3, 2023
@drewdaemon
Copy link
Contributor Author

@MichaelMarcialis I've merged the PR with the understanding that I will address your final round of feedback in #150241

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:Lens release_note:enhancement Team:Visualizations Visualization editors, elastic-charts and infrastructure ui-copy Review of UI copy with docs team is recommended v8.7.0
Projects
None yet
10 participants