From 47f5f9f3733a0c33b2382c11ef768a27fce5d5a3 Mon Sep 17 00:00:00 2001 From: cchaos Date: Tue, 17 Sep 2019 18:52:08 -0400 Subject: [PATCH 1/3] Updated top values --- .../indexpattern_plugin/_field_itm.scss | 15 +++ .../public/indexpattern_plugin/field_item.tsx | 95 +++++++++---------- .../indexpattern_plugin/indexpattern.scss | 1 + 3 files changed, 62 insertions(+), 49 deletions(-) create mode 100644 x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss new file mode 100644 index 0000000000000..b991e5b0e2eb6 --- /dev/null +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss @@ -0,0 +1,15 @@ +.lnsFieldItem__topValue { + margin-bottom: $euiSizeS; + + &:last-of-type { + margin-bottom: 0; + } +} + +.lnsFieldItem__topValueProgress { + background-color: $euiColorLightestShade; + + &::-webkit-progress-bar { + background-color: $euiColorLightestShade; + } +} diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx index 0fe94356579a9..81be8f08ea685 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx @@ -16,6 +16,8 @@ import { EuiToolTip, EuiButtonGroup, EuiSpacer, + EuiPopoverFooter, + EuiPopoverTitle, } from '@elastic/eui'; import { Chart, @@ -319,39 +321,36 @@ export function FieldItem({ {state.topValues && state.sampledValues && (!state.histogram || !showingHistogram) && (
{state.topValues.buckets.map(topValue => ( - - +
+ - - {formatter.convert(topValue.key)} + + + {formatter.convert(topValue.key)} + - + {((topValue.count / state.sampledValues!) * 100).toFixed(1)}% -
- - - -
- - - + +
))} {otherCount ? ( <> - + - + {i18n.translate('xpack.lens.indexPattern.otherDocsLabel', { defaultMessage: 'Other', })} @@ -365,14 +364,13 @@ export function FieldItem({ -
- -
+ ) : ( <> @@ -381,27 +379,26 @@ export function FieldItem({ )} {state.totalDocuments ? ( -
- - {state.sampledDocuments ? ( - - {i18n.translate('xpack.lens.indexPattern.percentageOfTotalDocsLabel', { - defaultMessage: '{percentage}% of {docCount} documents', - values: { - docCount: state.totalDocuments, - percentage: ((state.sampledDocuments / state.totalDocuments) * 100).toFixed(1), - }, - })} - - ) : ( - - {i18n.translate('xpack.lens.indexPattern.totalDocsLabel', { - defaultMessage: '{docCount} documents', - values: { docCount: state.totalDocuments }, - })} - - )} -
+ + + {state.sampledDocuments && ( + <> + {i18n.translate('xpack.lens.indexPattern.percentageOfLabel', { + defaultMessage: '{percentage}% of', + values: { + percentage: ((state.sampledDocuments / state.totalDocuments) * 100).toFixed( + 1 + ), + }, + })} + + )}{' '} + {state.totalDocuments}{' '} + {i18n.translate('xpack.lens.indexPattern.ofDocumentsLabel', { + defaultMessage: 'documents', + })} + + ) : ( <> )} diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/indexpattern.scss b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/indexpattern.scss index 2ebdf1a2c7e59..cc48d3d36d6b8 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/indexpattern.scss +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/indexpattern.scss @@ -1,3 +1,4 @@ +@import './field_itm'; @import './dimension_panel/index'; From 6b018a4e43b013fdf637dc8d56003887136f031a Mon Sep 17 00:00:00 2001 From: cchaos Date: Tue, 17 Sep 2019 19:05:29 -0400 Subject: [PATCH 2/3] Fixed up overall layout including adding a popover header --- .../indexpattern_plugin/_field_itm.scss | 10 +++ .../public/indexpattern_plugin/field_item.tsx | 74 +++++++++++-------- .../indexpattern_plugin/indexpattern.scss | 9 --- 3 files changed, 52 insertions(+), 41 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss index b991e5b0e2eb6..4b72f24470f4b 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss @@ -13,3 +13,13 @@ background-color: $euiColorLightestShade; } } + +.lnsFieldItem__distributionChart { + min-height: 200px; +} + +.lnsFieldItem__fieldPopoverPanel { + min-width: 260px; + max-width: 300px; +} + diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx index 81be8f08ea685..68dcaac482a11 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx @@ -248,49 +248,59 @@ export function FieldItem({ isOpen={infoIsOpen} closePopover={() => setOpen(false)} anchorPosition="rightUp" - panelClassName="lnsFieldListPanel__fieldPopover" + panelClassName="lnsFieldItem__fieldPopoverPanel" > -
- {state.isLoading && } - + {state.histogram && state.histogram.buckets.length && state.topValues && state.topValues.buckets.length && ( - <> - { - setShowingHistogram(optionId === 'histogram'); - }} - idSelected={showingHistogram ? 'histogram' : 'topValues'} - /> - - + { + setShowingHistogram(optionId === 'histogram'); + }} + idSelected={showingHistogram ? 'histogram' : 'topValues'} + /> )} + {state.topValues && state.sampledValues && !state.histogram && !showingHistogram && ( + <> + {i18n.translate('xpack.lens.indexPattern.fieldTopValuesLabel', { + defaultMessage: 'Top Values', + })} + + )} + +
+ {state.isLoading && } {state.histogram && (!state.topValues || showingHistogram) && ( - + Date: Tue, 17 Sep 2019 19:22:01 -0400 Subject: [PATCH 3/3] Fix up time display --- .../lens/public/indexpattern_plugin/_field_itm.scss | 4 ---- .../lens/public/indexpattern_plugin/field_item.tsx | 10 ++++++++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss index 4b72f24470f4b..be957dbb403bf 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/_field_itm.scss @@ -14,10 +14,6 @@ } } -.lnsFieldItem__distributionChart { - min-height: 200px; -} - .lnsFieldItem__fieldPopoverPanel { min-width: 260px; max-width: 300px; diff --git a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx index 68dcaac482a11..51df6cce026ea 100644 --- a/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx +++ b/x-pack/legacy/plugins/lens/public/indexpattern_plugin/field_item.tsx @@ -15,7 +15,6 @@ import { EuiText, EuiToolTip, EuiButtonGroup, - EuiSpacer, EuiPopoverFooter, EuiPopoverTitle, } from '@elastic/eui'; @@ -288,14 +287,21 @@ export function FieldItem({ })} )} + {field.type === 'date' && ( + <> + {i18n.translate('xpack.lens.indexPattern.fieldTimeDistributionLabel', { + defaultMessage: 'Time distribution', + })} + + )}
{state.isLoading && } {state.histogram && (!state.topValues || showingHistogram) && (