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

[Discover] Add field types in-product help #126657

Merged
merged 33 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from 7 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
9098107
added base popover
andreadelrio Jan 27, 2022
1fc6acd
add field types popover
andreadelrio Mar 2, 2022
57db5f6
Merge branch 'main' into field-types-help
kibanamachine Mar 2, 2022
750d2fb
replace callout
andreadelrio Mar 2, 2022
f8c49ce
Merge branch 'field-types-help' of https://github.com/andreadelrio/ki…
andreadelrio Mar 2, 2022
bea575b
fix anchor
andreadelrio Mar 2, 2022
1038e96
use another euifilterbutton
andreadelrio Mar 3, 2022
5cf6f73
clean up table and add more field types
andreadelrio Mar 4, 2022
8e924c4
Merge branch 'main' into field-types-help
kibanamachine Mar 14, 2022
38642cd
[Discover] add pagination
dimaanj Mar 15, 2022
892702c
Merge pull request #4 from Dmitriynj/field-types-help
andreadelrio Mar 15, 2022
69541c3
[Discover] show field types which are present in current data view, s…
dimaanj Mar 16, 2022
4be422a
Merge pull request #5 from Dmitriynj/field-types-help
andreadelrio Mar 16, 2022
13f3310
renaming
andreadelrio Mar 17, 2022
dc11636
more progress
andreadelrio Mar 18, 2022
7b998ed
remove _source
andreadelrio Mar 29, 2022
6a8e518
fix mobile view
andreadelrio Mar 29, 2022
0dd77a4
update icon
andreadelrio Mar 29, 2022
ef05603
Merge branch 'main' into field-types-help
dimaanj Apr 1, 2022
71c38d8
[Discover] improve unit tests
dimaanj Apr 1, 2022
0faad6d
Merge pull request #6 from Dmitriynj/field-types-help
andreadelrio Apr 1, 2022
36a9dae
Merge branch 'main' into field-types-help
kibanamachine Apr 4, 2022
33e1507
Scrolling instead of pagination
Apr 5, 2022
66ced34
Merge pull request #7 from cchaos/field-types-help
andreadelrio Apr 5, 2022
1435c12
i18n feedback
andreadelrio Apr 6, 2022
0f97f0b
cleanup
andreadelrio Apr 6, 2022
1fb3afb
Update src/plugins/discover/public/application/main/components/sideba…
andreadelrio Apr 6, 2022
24dfdba
Merge branch 'main' into field-types-help
kibanamachine Apr 7, 2022
ea7cdd2
Update discover_field_search.tsx
kertal Apr 7, 2022
df5dfac
add missing links
andreadelrio Apr 7, 2022
e24a184
fix conflic
andreadelrio Apr 7, 2022
17b25b8
Merge branch 'main' into field-types-help
kibanamachine Apr 7, 2022
58c07f7
Merge branch 'main' into field-types-help
kibanamachine Apr 11, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
padding: $euiSizeM;
}

.dscFieldSearch__filterWrapper {
width: 100%;
.dscFieldTypesHelp__popover {
flex-grow: 0;
}

.dscFieldTypesHelp__button {
@include euiFocusBackground($euiColorDarkShade);
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import './discover_field_search.scss';
import React, { OptionHTMLAttributes, ReactNode, useState } from 'react';
import { i18n } from '@kbn/i18n';
import {
EuiBasicTable,
EuiFieldSearch,
EuiFilterGroup,
EuiFlexGroup,
Expand All @@ -27,6 +28,8 @@ import {
EuiOutsideClickDetector,
EuiFilterButton,
EuiSpacer,
EuiIcon,
EuiToken,
} from '@elastic/eui';
import { FormattedMessage } from '@kbn/i18n-react';

Expand Down Expand Up @@ -80,13 +83,71 @@ export function DiscoverFieldSearch({ onChange, value, types }: Props) {

const [activeFiltersCount, setActiveFiltersCount] = useState(0);
const [isPopoverOpen, setPopoverOpen] = useState(false);
const [isHelpOpen, setIsHelpOpen] = useState(false);
const [values, setValues] = useState<State>({
searchable: 'any',
aggregatable: 'any',
type: 'any',
missing: true,
});

const onHelpClick = () => {
setIsHelpOpen((isHelpOpen) => !isHelpOpen);
};
const closeHelp = () => setIsHelpOpen(false);

const columnsSidebar = [
{
field: 'type',
name: 'Icon',
width: '40px',
render: (name) => <EuiToken iconType={name} />,
},
{
field: 'dataType',
name: 'Data type',
width: '70px',
},
{
field: 'description',
name: 'Description',
},
];

const items = [
{
id: 0,
dataType: 'text',
type: 'tokenString',
description: 'Full text such as the body of an email or a product description.',
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
},
{
id: 1,
dataType: 'number',
type: 'tokenNumber',
description: 'Long, integer, short, byte, double, and float values.',
},
{
id: 2,
dataType: 'keyword',
type: 'tokenKeyword',
description:
'Structured content such as an ID, email address, hostname, status code, or tag.',
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
},
{
id: 3,
dataType: 'date',
type: 'tokenDate',
description: 'A date string or the number of seconds or milliseconds since 1/1/1970.',
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
},
{
id: 4,
dataType: 'geo_point',
type: 'tokenGeo',
description: 'Latitude and longitude points.',
},
];

const filterBtnAriaLabel = isPopoverOpen
? i18n.translate('discover.fieldChooser.toggleFieldFilterButtonHideAriaLabel', {
defaultMessage: 'Hide field filter settings',
Expand Down Expand Up @@ -257,6 +318,17 @@ export function DiscoverFieldSearch({ onChange, value, types }: Props) {
</div>
);

const helpButton = (
<EuiFilterButton
grow={false}
onClick={onHelpClick}
className="dscFieldTypesHelp__button"
aria-label="Filter type help"
>
<EuiIcon type="questionInCircle" title="Filter type help" />
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
</EuiFilterButton>
);

return (
<React.Fragment>
<EuiFlexGroup responsive={false} gutterSize={'s'}>
Expand All @@ -272,30 +344,51 @@ export function DiscoverFieldSearch({ onChange, value, types }: Props) {
</EuiFlexItem>
</EuiFlexGroup>
<EuiSpacer size="xs" />
<EuiOutsideClickDetector onOutsideClick={() => {}} isDisabled={!isPopoverOpen}>
<EuiFilterGroup className="dscFieldSearch__filterWrapper">
<EuiFlexItem>
<EuiFilterGroup fullWidth>
<EuiOutsideClickDetector onOutsideClick={() => {}} isDisabled={!isPopoverOpen}>
<EuiPopover
andreadelrio marked this conversation as resolved.
Show resolved Hide resolved
id="dataPanelTypeFilter"
panelClassName="euiFilterGroup__popoverPanel"
panelPaddingSize="none"
anchorPosition="rightUp"
display="block"
isOpen={isPopoverOpen}
closePopover={() => {
setPopoverOpen(false);
}}
button={buttonContent}
>
<EuiPopoverTitle paddingSize="s">
{i18n.translate('discover.fieldChooser.filter.filterByTypeLabel', {
defaultMessage: 'Filter by type',
})}
</EuiPopoverTitle>
{selectionPanel}
{footer()}
</EuiPopover>
</EuiOutsideClickDetector>
<EuiPopover
id="dataPanelTypeFilter"
panelClassName="euiFilterGroup__popoverPanel"
panelPaddingSize="none"
anchorPosition="rightUp"
display="block"
isOpen={isPopoverOpen}
closePopover={() => {
setPopoverOpen(false);
}}
button={buttonContent}
button={helpButton}
isOpen={isHelpOpen}
panelPaddingSize="s"
className="dscFieldTypesHelp__popover"
closePopover={closeHelp}
>
<EuiPopoverTitle paddingSize="s">
{i18n.translate('discover.fieldChooser.filter.filterByTypeLabel', {
defaultMessage: 'Filter by type',
})}
</EuiPopoverTitle>
{selectionPanel}
{footer()}
<EuiPopoverTitle paddingSize="s">Field types</EuiPopoverTitle>
<EuiBasicTable
style={{ width: 350 }}
tableCaption="Description of field types"
items={items}
compressed={true}
rowHeader="firstName"
columns={columnsSidebar}
/>
</EuiPopover>
</EuiFilterGroup>
</EuiOutsideClickDetector>
</EuiFlexItem>
</React.Fragment>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -327,7 +327,7 @@ export function DiscoverSidebarComponent({
responsive={false}
>
<EuiFlexItem grow={false}>
<EuiFlexGroup direction="row" alignItems="center" gutterSize="s">
<EuiFlexGroup responsive={false} direction="row" alignItems="center" gutterSize="s">
<EuiFlexItem grow={true} className="dscSidebar__indexPatternSwitcher">
<DiscoverIndexPattern
selectedIndexPattern={selectedIndexPattern}
Expand Down