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

[ML] Job Selector - ensure relative ganttBar width set on initial render #36249

Merged

Conversation

alvarezmelissa87
Copy link
Contributor

@alvarezmelissa87 alvarezmelissa87 commented May 8, 2019

Summary

Addresses follow ups described in #35638

  • sets ganttBar width based on the flyout table's last column width - ensures it's set on first render.

image

  • ensures a minimum ganttBar range width of 1px so that something always shows up even when jobs cover a large time range.

  • breaks JobSelector into smaller components

  • Changes Job selector bar to display badges to the left of the link, changes the copy to read Edit job selection and adds an edit icon to the link

image

  • replaces fixed px in css with proper Eui variables
    • We currently don't have in EUI the colors used for the ganttBar (dashed line and blue filled in area representing the range). Using eui colors it would look like the screenshot below. I'm happy to change it to this if those colors seem good. Otherwise we'll have to stick with the existing hex codes.

timerange_screenshot

Final follow-up

I'll be breaking out the JobSelectorTable into smaller components as well and adding tests for those components so expect one last follow up 😄

Checklist

Use strikethroughs to remove checklist items you don't feel are applicable to this PR.

For maintainers

- [ ] This was checked for breaking API changes and was labeled appropriately
- [ ] This includes a feature addition or change that requires a release note and was labeled appropriately

@alvarezmelissa87 alvarezmelissa87 added non-issue Indicates to automation that a pull request should not appear in the release notes :ml Feature:ml-results legacy - do not use v7.2.0 labels May 8, 2019
@alvarezmelissa87 alvarezmelissa87 requested review from a team as code owners May 8, 2019 02:23
@elasticmachine
Copy link
Contributor

Pinging @elastic/ml-ui

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@@ -1,6 +1,5 @@
.mlJobSelectorBar {
padding: 10px;
background-color: $euiColorLightShade
padding: $euiSizeS;
Copy link
Contributor

Choose a reason for hiding this comment

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

At the moment the padding looks like this:

image

I'd like to suggest to align the padding with the elements further down (filter bar, Top Influencers) and change this to $euiSize, with this additional change in _explorer.scss (0px instead of $euiSize for top padding):

  .results-container {
    padding: 0px 0px $euiSize 0px;
    ...

image

const tzConfig = config.get('dateFormat:tz');
const dateFormatTz = (tzConfig !== 'Browser') ? tzConfig : moment.tz.guess();
// Give the ganttBar a little more than a 3rd of the width of the flyout
const derivedWidth = Math.round(flyoutEl.current.flyout.offsetWidth / 3.6);
Copy link
Member

@jgowdyelastic jgowdyelastic May 8, 2019

Choose a reason for hiding this comment

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

rather than using an estimate for the col width, the actual column width could be used by examining the table.

// get all the cols in the table header
const tableHeaderCols = flyoutEl.current.flyout.querySelectorAll('table thead th');
// get the width of the last col
const derivedWidth = tableHeaderCols[tableHeaderCols.length - 1].offsetWidth - 16;

Minus 16 because the cell has a padding of 8px
I couldn't find a numerical representation of $euiSize for this. the values in '@elastic/eui/dist/eui_theme_light.json'; are all strings.
Could use theme.euiSize.replace('px, '') but it's a bit hacky :)

Copy link
Contributor

@walterra walterra left a comment

Choose a reason for hiding this comment

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

Overall LGTM, just added a comment about aligning the job badges.

Copy link
Member

@jgowdyelastic jgowdyelastic left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

LGTM, but just want to check that it's by design that when you have more than 1 row of badges that the 'Edit job selection' button goes to the right, rather than say always to the immediate right of the last badge in the list:

image

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87
Copy link
Contributor Author

@peteharverson - re: when you have more than 1 row of badges that the 'Edit job selection' button goes to the right
Yes, that is by design. I've got as a flexItem the Id badges (which are themselves a flexgroup) and as the other flexItem the link to open the flyout. Both of these are wrapped in a containing flexgroup to ensure they are always side by side.
image

Because of the way the wrap works - you'll sometimes see this gap if badge is too long to fit and gets moved to the next row.

image

I'm happy to change the design if you'd prefer it always be after the last badge.

Copy link
Contributor

@peteharverson peteharverson left a comment

Choose a reason for hiding this comment

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

Happy to go with current layout of badges. LGTM!

Copy link
Contributor

@cchaos cchaos left a comment

Choose a reason for hiding this comment

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

Thanks again for using EUI vars where possible!

border-left: 1px solid #d6d6d6;
border-right: 1px solid #d6d6d6;
margin-bottom: -16px;
padding-top: 9px;
margin-bottom: -14px;
Copy link
Contributor

Choose a reason for hiding this comment

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

Is there any way this could be a EUI sizing variable instead? Is 14px a must?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, that's the only value I could make work for the ganttBar style.

@alvarezmelissa87
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alvarezmelissa87
Copy link
Contributor Author

retest

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@alvarezmelissa87 alvarezmelissa87 merged commit d4540b2 into elastic:master May 8, 2019
alvarezmelissa87 added a commit to alvarezmelissa87/kibana that referenced this pull request May 8, 2019
…der (elastic#36249)

* calc ganttBar width on first render;

* Move all badges into separate components. Update css to use vars

* check group not undefined

* update job selector padding and base ganttBar width on columns
@alvarezmelissa87 alvarezmelissa87 deleted the ml-job-selector-follow-ups branch May 8, 2019 21:48
alvarezmelissa87 added a commit that referenced this pull request May 9, 2019
…der (#36249) (#36313)

* calc ganttBar width on first render;

* Move all badges into separate components. Update css to use vars

* check group not undefined

* update job selector padding and base ganttBar width on columns
@sophiec20 sophiec20 added the Feature:Anomaly Detection ML anomaly detection label Jun 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Anomaly Detection ML anomaly detection Feature:ml-results legacy - do not use :ml non-issue Indicates to automation that a pull request should not appear in the release notes v7.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants