Skip to content

Commit

Permalink
[Maps] show layer name in tooltip (#97175)
Browse files Browse the repository at this point in the history
* [Maps] show layer name in tooltip

* update snapshot

* add jest test for Header

* add comment for clarity

* add header element and classes to truncate text

* add layer icon in tooltip header

* handle case where layer does not exist

* tslint and update jest test and snapshot

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
nreese and kibanamachine authored Apr 20, 2021
1 parent 660af0f commit 0e5f12f
Show file tree
Hide file tree
Showing 10 changed files with 342 additions and 137 deletions.
4 changes: 2 additions & 2 deletions x-pack/plugins/maps/public/classes/layers/layer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import { Map as MbMap } from 'mapbox-gl';
import { Query } from 'src/plugins/data/public';
import _ from 'lodash';
import React, { ReactElement } from 'react';
import React, { ReactElement, ReactNode } from 'react';
import { EuiIcon } from '@elastic/eui';
import uuid from 'uuid/v4';
import { FeatureCollection } from 'geojson';
Expand Down Expand Up @@ -100,7 +100,7 @@ export interface ILayer {
}

export type CustomIconAndTooltipContent = {
icon: ReactElement<any> | null;
icon: ReactNode;
tooltipContent?: string | null;
areResultsTrimmed?: boolean;
};
Expand Down

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,9 @@
justify-content: flex-end;
}
}

.mapFeatureTooltip_layerIcon {
img {
margin-bottom: 0;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ import { EuiIcon, EuiLink } from '@elastic/eui';
import { FeatureProperties } from './feature_properties';
import { GEO_JSON_TYPE, ES_GEO_FIELD_TYPE } from '../../../../common/constants';
import { FeatureGeometryFilterForm } from './feature_geometry_filter_form';
import { TooltipHeader } from './tooltip_header';
import { Footer } from './footer';
import { Header } from './header';
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';

Expand Down Expand Up @@ -167,12 +168,12 @@ export class FeaturesTooltip extends Component {

return (
<Fragment>
<TooltipHeader
onClose={this.props.closeTooltip}
features={this.props.features}
isLocked={this.props.isLocked}
<Header
key={this.state.currentFeature.layerId}
layerId={this.state.currentFeature.layerId}
findLayerById={this.props.findLayerById}
setCurrentFeature={this._setCurrentFeature}
isLocked={this.props.isLocked}
onClose={this.props.closeTooltip}
/>
<FeatureProperties
featureId={this.state.currentFeature.id}
Expand All @@ -188,6 +189,12 @@ export class FeaturesTooltip extends Component {
showFilterActions={this._showFilterActionsView}
/>
{this._renderActions(geoFields)}
<Footer
features={this.props.features}
isLocked={this.props.isLocked}
findLayerById={this.props.findLayerById}
setCurrentFeature={this._setCurrentFeature}
/>
</Fragment>
);
}
Expand Down
Loading

0 comments on commit 0e5f12f

Please sign in to comment.