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] Thresholds: Add text to markers body #113629

Merged
merged 39 commits into from
Oct 11, 2021
Merged

Conversation

dej611
Copy link
Contributor

@dej611 dej611 commented Oct 1, 2021

Summary

Fixes #112921

Screenshot 2021-10-01 at 16 53 43

Screenshot 2021-10-01 at 17 00 15

Screenshot 2021-10-01 at 17 00 37

Screenshot 2021-10-01 at 17 01 08

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

For maintainers

dej611 and others added 27 commits September 23, 2021 12:09
…reshold_panel.tsx

Co-authored-by: Michael Marcialis <michael@marcial.is>
@ghudgins
Copy link
Contributor

ghudgins commented Oct 1, 2021

can we align this in the center

image

@dej611
Copy link
Contributor Author

dej611 commented Oct 4, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

merge conflict between base and head

@MichaelMarcialis
Copy link
Contributor

In terms of where to put the Show marker label switch.. I have no better idea. Maybe instead of being about "showing label", something about what to show in the marker may work best? Something like Marker: None | Icon | Label | Full?

That is an interesting idea to unify the icon and text labels under a common term. The two concerns I have with such an approach are 1) that it complicates the icon selection flow (requires additional clicks, must conditionally disable the icon selector, etc.) and 2) that it turns a simple switch into a more complex selector or button group. I'm curious if we can instead address @mbondyra's concerns with some verbiage and ordering changes.

For example:

  • Rename Show label to Show display name
  • Move the Show display name row to appear immediately after Display name
  • Move the Icon row to appear immediately after Show display name
  • Rename Marker position to Decoration position
  • Move the Decoration position row to appear immediately after Icon

So the new final order would be something like:

  • Display name
  • Show display name
  • Icon
  • Decoration position
  • Color
  • Line style
  • Line thickness
  • Fill

Would an approach like this address the original concern?

@dej611
Copy link
Contributor Author

dej611 commented Oct 6, 2021

I've updated the panel with the new order:
Screenshot 2021-10-06 at 15 50 50

Also aligned the content in the tooltip to mention display name rather than label:

Screenshot 2021-10-06 at 15 51 42

The switch label is a bit too long for smaller screens:
Screenshot 2021-10-06 at 15 51 03

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.

This is looking great, @dej611! Leaving you a few comments and questions below for my review:

  • Do you have any thoughts about changing all the references to the Display name input to simply Name? Display name always seemed overly verbose to me, and doing so means we could also shorten Show display name to Show name. CCing @ghudgins for thoughts on this as well.

  • Regarding @markov00's excellent suggestions for improving the in-visualization threshold label styling, is this an enhancement the dataviz team would provide via an enhancement to Elastic charts? Or is the assumption that such an enhancement would be on us (the Lens team) to implement on our end? If it's something we'd be responsible for implementing, is this something we wish to address in this PR or separately in a future issue?

Comment on lines 141 to 167
<div
style={{
display: 'inline-block',
overflow: 'hidden',
width: THRESHOLD_MARKER_SIZE,
lineHeight: 1.5,
}}
>
<div
className="eui-textTruncate"
style={{
display: 'inline-block',
whiteSpace: 'nowrap',
transform: 'translate(0, 100%) rotate(-90deg)',
transformOrigin: '0 0',
maxWidth: THRESHOLD_MARKER_SIZE * 3,
}}
>
{label}
<div
style={{
float: 'left',
marginTop: '100%',
}}
/>
</div>
</div>
Copy link
Contributor

Choose a reason for hiding this comment

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

Aside from the styles that reference the THRESHOLD_MARKER_SIZE variable, what is the reason for using inline styles versus using classes that apply styles via an external SCSS file? I'm only asking for the sake of consistency with how we appear to handle styles elsewhere in Lens.

Comment on lines 160 to 165
<div
style={{
float: 'left',
marginTop: '100%',
}}
/>
Copy link
Contributor

Choose a reason for hiding this comment

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

If you end up changing these inline styles to SCSS (as described in the previous comment), consider also switching from styling this empty div element to an ::after pseudo element.

@flash1293
Copy link
Contributor

If it's something we'd be responsible for implementing, is this something we wish to address in this PR or separately in a future issue?

To me it makes sense what @ghudgins wrote here: #112921 (comment)

if we are going to offer the experience we have right now anyway, let’s start with that and follow up with additional configuration options. We can discuss offline though.

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611 dej611 requested a review from a team as a code owner October 7, 2021 13:27
@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

@dej611
Copy link
Contributor Author

dej611 commented Oct 7, 2021

@elasticmachine merge upstream

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, @dej611. Left one small suggestion, but otherwise looks good to me. Approving now so I don't hold you up.

.lnsXyDecorationRotatedWrapper {
display: inline-block;
overflow: hidden;
line-height: 1.5;
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggest using the $euiLineHeight variable here:

Suggested change
line-height: 1.5;
line-height: $euiLineHeight;

Copy link
Contributor

@stratoula stratoula 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 tested it locally and it seems to work fine :) I think for a first iteration is a very cool addition!

@@ -187,6 +188,10 @@ export const yAxisConfig: ExpressionFunctionDefinition<
options: ['auto', 'above', 'below', 'left', 'right'],
help: 'The placement of the icon for the threshold line',
},
textVisibility: {
types: ['boolean'],
help: 'Visibility of the marker label',
Copy link
Contributor

@stratoula stratoula Oct 8, 2021

Choose a reason for hiding this comment

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

super nit: Can we also add to the help text that it is used for the reference line? Otherwise, both the variable name and help text are very generic. Moreover I can't see the word marker anywhere in the UI so this confuses even more

@dej611
Copy link
Contributor Author

dej611 commented Oct 11, 2021

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
lens 825 834 +9

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 234 235 +1

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.0MB 1.0MB +3.7KB

Page load bundle

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

id before after diff
lens 39.1KB 39.2KB +88.0B
Unknown metric groups

API count

id before after diff
lens 252 253 +1

History

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

@dej611 dej611 merged commit 1bf09e6 into elastic:master Oct 11, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Oct 11, 2021
* 🐛 Add padding to the tick label to fit threshold markers

* 🐛 Better icon detection

* 🐛 Fix edge cases with no title or labels

* 📸 Update snapshots

* ✨ Add icon placement flag

* ✨ Sync padding computation with marker positioning

* 👌 Make disabled when no icon is selected

* ✨ First text on marker implementation

* 🐛 Fix some edge cases with auto positioning

* Update x-pack/plugins/lens/public/xy_visualization/xy_config_panel/threshold_panel.tsx

Co-authored-by: Michael Marcialis <michael@marcial.is>

* 🐛 Fix minor details

* 💄 Small tweak

* ✨ Reduce the padding if no icon is shown on the axis

* ✅ Fix broken unit tests

* 💄 Fix vertical text centering

* 🚨 Fix linting issue

* 🐛 Fix issue

* 💄 Reorder panel inputs

* 💄 Move styling to sass

* 👌 Address feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Marcialis <michael@marcial.is>
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 13, 2021
kibanamachine added a commit that referenced this pull request Oct 13, 2021
* 🐛 Add padding to the tick label to fit threshold markers

* 🐛 Better icon detection

* 🐛 Fix edge cases with no title or labels

* 📸 Update snapshots

* ✨ Add icon placement flag

* ✨ Sync padding computation with marker positioning

* 👌 Make disabled when no icon is selected

* ✨ First text on marker implementation

* 🐛 Fix some edge cases with auto positioning

* Update x-pack/plugins/lens/public/xy_visualization/xy_config_panel/threshold_panel.tsx

Co-authored-by: Michael Marcialis <michael@marcial.is>

* 🐛 Fix minor details

* 💄 Small tweak

* ✨ Reduce the padding if no icon is shown on the axis

* ✅ Fix broken unit tests

* 💄 Fix vertical text centering

* 🚨 Fix linting issue

* 🐛 Fix issue

* 💄 Reorder panel inputs

* 💄 Move styling to sass

* 👌 Address feedback

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Co-authored-by: Michael Marcialis <michael@marcial.is>

Co-authored-by: Marco Liberati <dej611@users.noreply.github.com>
Co-authored-by: Michael Marcialis <michael@marcial.is>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Oct 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed Feature:Lens release_note:skip Skip the PR/issue when compiling release notes Team:Visualizations Visualization editors, elastic-charts and infrastructure v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Lens] Thresholds: ability to specify text as alternative to icons
8 participants