[ML] Redesign index-based Data Visualizer#85726
Conversation
- Clear charts data upon unamounting explorer page - Avoid rendering three times per ChartContainer - Avoid expensive chartData/scaleCategoriesSet lookup
…emove vertical spacker
|
Some suggestions:
|
| @@ -1,2 +1,3 @@ | |||
| @import 'file_based/index'; | |||
| @import 'index_based/index'; | |||
| @import "stats_datagrid/index"; | |||
There was a problem hiding this comment.
The other imports have single quotes.
| 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'; |
There was a problem hiding this comment.
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'}> |
There was a problem hiding this comment.
Can you explain why we need a flex layout with a single item here?
| .mlTopValuesLabelContainer { | ||
| padding-right: $euiSizeM; | ||
|
|
||
| &.small { | ||
| width: 50px !important; | ||
| } | ||
|
|
||
| &.large { | ||
| width: 200px !important; | ||
| } | ||
| } |
There was a problem hiding this comment.
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.
| className={classNames( | ||
| 'eui-textTruncate', | ||
| 'mlTopValuesLabelContainer', | ||
| compressed === true ? 'small' : 'large' |
There was a problem hiding this comment.
With the SASS changes suggested in the other comment this should become e.g. mlTopValuesLabelContainer--${compressed === true ? 'small' : 'large'}
@mdefazio @walterra I have updated the colors of the chart here, with additional paddings in between here 59e11f9 |
mdefazio
left a comment
There was a problem hiding this comment.
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.
|
|
||
| .mlFieldDataCard__codeContent { | ||
| @include euiCodeFont; | ||
| font-family: $euiCodeFontFamily; |
There was a problem hiding this comment.
You shouldn't need this extra declaration.
| &.mlTopValuesLabelContainer--small { | ||
| width: 50px !important; | ||
| } | ||
|
|
||
| &.mlTopValuesLabelContainer--large { | ||
| width: 200px !important; | ||
| } |
There was a problem hiding this comment.
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.
| } | ||
| .mlFieldDataCard__codeContent { | ||
| @include euiCodeFont; | ||
| font-family: $euiCodeFontFamily; |
There was a problem hiding this comment.
Again, don't need this with the mixin.
| .euiTableRowCell{ | ||
| background-color: transparent !important; | ||
| border-top: 0px; | ||
| border-bottom: 1px solid $euiColorLightShade; |
There was a problem hiding this comment.
We can use $euiBorderThin instead of writing this out (both instances of this).
| text-transform: uppercase; | ||
| text-align: left; | ||
| color: $euiColorDarkShade; | ||
| font-weight: bold; |
There was a problem hiding this comment.
If we use EuiTitle we can do much of this as props. More of an FYI in the future.
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |








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.

Show empty fieldsenabled:Distributionspreview off:Distributionspreview on:To follow up
Checklist
Delete any items that are not applicable to this PR.