Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
abeb735
tmp commit
thomasneirynck Mar 20, 2019
1993951
rough outline for term filtering
thomasneirynck Mar 20, 2019
cc5f69a
fix formatter for joins
thomasneirynck Mar 20, 2019
b5fced7
fix formatter for grids
thomasneirynck Mar 20, 2019
aafc0ee
tooltip edits
thomasneirynck Mar 20, 2019
79aa4ae
add tooltip filtering to join sources
thomasneirynck Mar 21, 2019
9a84f6e
some cleanup
thomasneirynck Mar 21, 2019
af68a46
fix joins/close tooltip
thomasneirynck Mar 21, 2019
35479ee
Merge branch 'master' into maps/tooltip_filter
thomasneirynck Mar 28, 2019
a819d10
track filterable in store
thomasneirynck Mar 29, 2019
b2db40b
only render close button when locked
thomasneirynck Mar 29, 2019
2ba9cc7
Merge branch 'master' into maps/tooltip_filter
thomasneirynck Mar 29, 2019
7ef8afb
move files
thomasneirynck Mar 29, 2019
5ab79ef
change cursor
thomasneirynck Mar 29, 2019
7528759
use proportional values for tooltips
thomasneirynck Apr 1, 2019
1373553
improve flex code
thomasneirynck Apr 1, 2019
7b50cf2
add unit tests
thomasneirynck Apr 1, 2019
ae98244
improve test names
thomasneirynck Apr 1, 2019
06ac55c
Merge branch 'master' into maps/tooltip_filter
thomasneirynck Apr 3, 2019
0234129
simplify
thomasneirynck Apr 3, 2019
9a6e15f
feedback
thomasneirynck Apr 3, 2019
93a1619
regenerate snapshots
thomasneirynck Apr 3, 2019
5c9ccd6
add other fields
thomasneirynck Apr 3, 2019
abd78a7
Merge branch 'master' into maps/tooltip_filter
thomasneirynck Apr 5, 2019
3fe31a0
rename for consistency
thomasneirynck Apr 5, 2019
9a082e7
add snapshot file
thomasneirynck Apr 5, 2019
01a7436
Merge branch 'master' into maps/tooltip_filter
thomasneirynck Apr 5, 2019
1f9cefe
fix test
thomasneirynck Apr 8, 2019
6b4ae94
touch up
thomasneirynck Apr 8, 2019
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 @@ -174,9 +174,7 @@ export class FilterEditor extends Component {
/>
</h5>
</EuiTitle>

{this._renderQuery()}

{this._renderQueryPopover()}
</Fragment>
);
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

91 changes: 66 additions & 25 deletions x-pack/plugins/maps/public/components/map/feature_tooltip.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,52 +11,93 @@ import { i18n } from '@kbn/i18n';

export class FeatureTooltip extends React.Component {

_renderFilterButton(tooltipProperty) {
if (!this.props.showFilterButtons || !tooltipProperty.isFilterable()) {
return null;
}

_renderProperties() {
return Object.keys(this.props.properties).map(propertyName => {
return (
<EuiFlexItem grow={false}>
<EuiButtonIcon
iconType="plusInCircle"
title={i18n.translate('xpack.maps.tooltip.filterOnPropertyTitle', {
defaultMessage: 'Filter on property'
})}
onClick={() => {
this.props.closeTooltip();
const filterAction = tooltipProperty.getFilterAction();
filterAction();
}}
aria-label={i18n.translate('xpack.maps.tooltip.filterOnPropertyAriaLabel', {
defaultMessage: 'Filter on property'
})}
className="mapFeatureTooltipFilterButton"
/>
</EuiFlexItem>
);
}

_renderProperties(hasFilters) {
Comment thread
thomasneirynck marked this conversation as resolved.
return this.props.properties.map((tooltipProperty, index) => {
/*
* Justification for dangerouslySetInnerHTML:
* Propery value contains value generated by Field formatter
* Property value contains value generated by Field formatter
* Since these formatters produce raw HTML, this component needs to be able to render them as-is, relying
* on the field formatter to only produce safe HTML.
*/

const htmlValue = (<span
// eslint-disable-next-line react/no-danger
dangerouslySetInnerHTML={{
__html: this.props.properties[propertyName]
__html: tooltipProperty.getHtmlDisplayValue()
}}
/>);

return (
<div key={propertyName}>
<span><strong>{propertyName}</strong></span>
<span>{' '}</span>
{htmlValue}
</div>
<EuiFlexGroup key={index}>
<EuiFlexItem grow={4}>
<strong>{tooltipProperty.getPropertyName()}</strong>
</EuiFlexItem>
<EuiFlexItem grow={6}>
{htmlValue}
</EuiFlexItem>
{this._renderFilterButton(tooltipProperty, hasFilters)}
</EuiFlexGroup>
);
});
}

_renderCloseButton() {
if (!this.props.showCloseButton) {
return null;
}
return (
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexItem grow={true}>
<EuiFlexGroup alignItems="flexEnd" direction="row" justifyContent="flexEnd">
<EuiFlexItem grow={false}>
<EuiButtonIcon
onClick={this.props.closeTooltip}
iconType="cross"
aria-label={i18n.translate('xpack.maps.tooltip.closeAriaLabel', {
defaultMessage: 'Close tooltip'
})}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
);
}

render() {
return (
<Fragment>
<EuiFlexGroup direction="column" gutterSize="none">
<EuiFlexItem grow={true}>
<EuiFlexGroup alignItems="flexEnd" direction="row" justifyContent="spaceBetween">
<EuiFlexItem>&nbsp;</EuiFlexItem>
<EuiFlexItem grow={false}>
<EuiButtonIcon
onClick={this.props.onCloseClick}
iconType="cross"
aria-label={i18n.translate('xpack.maps.tooltip.closeAreaLabel', {
defaultMessage: 'Close tooltip'
})}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{this._renderCloseButton()}
<EuiFlexItem>
{this._renderProperties()}
<EuiFlexGroup direction="column" gutterSize="none">
{this._renderProperties()}
</EuiFlexGroup>
</EuiFlexItem>
</EuiFlexGroup>
</Fragment>
Expand Down
Loading