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] Redesign index-based Data Visualizer #85726

Merged
merged 84 commits into from
Dec 15, 2020

Conversation

qn895
Copy link
Member

@qn895 qn895 commented Dec 14, 2020

Summary

This PR brings a redesign to the index based data visualizer, where instead of cards for fields, we use table in order to save space and provide more information in a compact way.
Data Visualizer - Machine Learning - Elastic (5)

  • With the Show empty fields enabled:

Screen Shot 2020-12-14 at 18 40 57

  • With Distributions preview off:

Screen Shot 2020-12-13 at 20 03 49

  • With Distributions preview on:

Screen Shot 2020-12-13 at 20 03 12

To follow up

  • Replace the file based data visualizer with the table
  • Expand the functional tests to validate the content of the expanded cards

Checklist

Delete any items that are not applicable to this PR.

qn895 added 30 commits November 23, 2020 11:33
 - Clear charts data upon unamounting explorer page
 - Avoid rendering three times per ChartContainer
 - Avoid expensive chartData/scaleCategoriesSet lookup
@walterra
Copy link
Contributor

Some suggestions:

  • The blue chart's axis labels are missing the padding the other chart has
  • Should we align the styling so both charts have the same thin white padding between bars?
  • Is there a need to use different colors? I'd opt to use the same color like we do in the data grid. If different colors, IMHO it should match the icon colors in the type column.

@mdefazio
Copy link
Contributor

Overall layout is looking good. Just a few tiny items:

  • Add some space between the 'Distribution' column heading and the icon button to show distribution charts
    image
    image
    With 4px between
    image

  • The top chart, search/filter bar and field counters feel cramped—I would suggest perhaps a large spacer between these.
    image

  • I think the distribution charts a bit big and could use some extra padding on the top / bottom so they aren't so close to the edges of the rows

    • Some of these have their x-axis labels touching the chart
      image
    • Can we get the axis font size to be the same as the axis font size on the main document distribution chart?
      image

@@ -1,2 +1,3 @@
@import 'file_based/index';
@import 'index_based/index';
@import "stats_datagrid/index";
Copy link
Contributor

Choose a reason for hiding this comment

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

The other imports have single quotes.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 0dcdf2e

@@ -7,6 +7,7 @@
import { Direction, EuiBasicTableProps, Pagination, PropertySort } from '@elastic/eui';
import { useCallback, useMemo } from 'react';
import { ListingPageUrlState } from '../../../../../../../common/types/common';
import { DataVisualizerIndexBasedAppState } from '../../../../../../../common/types/ml_url_generator';
Copy link
Contributor

Choose a reason for hiding this comment

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

Since useTableSettings() is now used in other places than just from within the analytics management page, should we move the file to a more general place?

latestFormatted: formatDate(latest, TIME_FORMAT),
}}
return (
<EuiFlexGroup direction={'row'}>
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you explain why we need a flex layout with a single item here?

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 0dcdf2e

Comment on lines 1 to 11
.mlTopValuesLabelContainer {
padding-right: $euiSizeM;

&.small {
width: 50px !important;
}

&.large {
width: 200px !important;
}
}
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use a different structure, with this we end up with non-prefixed very generic css classes in the DOM like small/large. Consider using the BEM-style described on the bottom of this page (Sass best practices) https://elastic.github.io/eui/#/guidelines/sass.

You should end up creating classes that look like mlTopValuesLabelContainer--small. In the react code you will need to use both the base class and this modifier.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 0dcdf2e

className={classNames(
'eui-textTruncate',
'mlTopValuesLabelContainer',
compressed === true ? 'small' : 'large'
Copy link
Contributor

Choose a reason for hiding this comment

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

With the SASS changes suggested in the other comment this should become e.g. mlTopValuesLabelContainer--${compressed === true ? 'small' : 'large'}

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here 0dcdf2e

@qn895
Copy link
Member Author

qn895 commented Dec 15, 2020

  • Add some space between the 'Distribution' column heading and the icon button to show distribution charts

  • The top chart, search/filter bar and field counters feel cramped—I would suggest perhaps a large spacer between these.

  • I think the distribution charts a bit big and could use some extra padding on the top / bottom so they aren't so close to the edges of the rows

    • Some of these have their x-axis labels touching the chart
    • Can we get the axis font size to be the same as the axis font size on the main document distribution chart?

@mdefazio @walterra I have updated the colors of the chart here, with additional paddings in between here 59e11f9

Data Visualizer - Machine Learning - Elastic (6)

Copy link
Contributor

@darnautov darnautov 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

@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.

There were a few small things (also mentioned on Slack) that can be cleaned up. Fine if this is done in a follow-up PR.

@@ -57,6 +57,7 @@
}

.mlFieldDataCard__codeContent {
@include euiCodeFont;
font-family: $euiCodeFontFamily;
Copy link
Contributor

Choose a reason for hiding this comment

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

You shouldn't need this extra declaration.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here c16d60d

Comment on lines 5 to 11
&.mlTopValuesLabelContainer--small {
width: 50px !important;
}

&.mlTopValuesLabelContainer--large {
width: 200px !important;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Ideally we would avoid both the pixel values and the use of !important. I understand if this needs to be done in a follow-up PR but we try to avoid these sort of things.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here c16d60d

}
.mlFieldDataCard__codeContent {
@include euiCodeFont;
font-family: $euiCodeFontFamily;
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, don't need this with the mixin.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated here c16d60d

.euiTableRowCell{
background-color: transparent !important;
border-top: 0px;
border-bottom: 1px solid $euiColorLightShade;
Copy link
Contributor

Choose a reason for hiding this comment

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

We can use $euiBorderThin instead of writing this out (both instances of this).

Comment on lines +6 to +9
text-transform: uppercase;
text-align: left;
color: $euiColorDarkShade;
font-weight: bold;
Copy link
Contributor

Choose a reason for hiding this comment

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

If we use EuiTitle we can do much of this as props. More of an FYI in the future.

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
ml 1593 1604 +11

Async chunks

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

id before after diff
ml 5.3MB 5.3MB +31.1KB

Distributable file count

id before after diff
default 47241 48005 +764

History

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
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants