mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 17:59:23 -04:00
[Maps] expose map title and description to reporting and embeddable container (#79325)
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
This commit is contained in:
parent
c88d2d3ae0
commit
a64aa686bd
5 changed files with 26 additions and 7 deletions
|
@ -50,6 +50,8 @@ interface Props {
|
|||
refreshConfig: MapRefreshConfig;
|
||||
renderTooltipContent?: RenderToolTipContent;
|
||||
triggerRefreshTimer: () => void;
|
||||
title?: string;
|
||||
description?: string;
|
||||
}
|
||||
|
||||
interface State {
|
||||
|
@ -197,7 +199,12 @@ export class MapContainer extends Component<Props, State> {
|
|||
|
||||
if (mapInitError) {
|
||||
return (
|
||||
<div data-render-complete data-shared-item>
|
||||
<div
|
||||
data-render-complete
|
||||
data-shared-item
|
||||
data-title={this.props.title}
|
||||
data-description={this.props.description}
|
||||
>
|
||||
<EuiCallOut
|
||||
title={i18n.translate('xpack.maps.map.initializeErrorTitle', {
|
||||
defaultMessage: 'Unable to initialize map',
|
||||
|
@ -231,6 +238,8 @@ export class MapContainer extends Component<Props, State> {
|
|||
data-dom-id={this.state.domId}
|
||||
data-render-complete={this.state.isInitialLoadRenderTimeoutComplete}
|
||||
data-shared-item
|
||||
data-title={this.props.title}
|
||||
data-description={this.props.description}
|
||||
>
|
||||
<EuiFlexItem className="mapMapWrapper">
|
||||
<MBMap
|
||||
|
|
|
@ -62,6 +62,7 @@ export { MapEmbeddableInput, MapEmbeddableConfig };
|
|||
export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableOutput> {
|
||||
type = MAP_SAVED_OBJECT_TYPE;
|
||||
|
||||
private _description: string;
|
||||
private _renderTooltipContent?: RenderToolTipContent;
|
||||
private _eventHandlers?: EventHandlers;
|
||||
private _layerList: LayerDescriptor[];
|
||||
|
@ -95,6 +96,7 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableO
|
|||
parent
|
||||
);
|
||||
|
||||
this._description = config.description ? config.description : '';
|
||||
this._renderTooltipContent = renderTooltipContent;
|
||||
this._eventHandlers = eventHandlers;
|
||||
this._layerList = config.layerList;
|
||||
|
@ -104,6 +106,10 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableO
|
|||
this._subscription = this.getInput$().subscribe((input) => this.onContainerStateChanged(input));
|
||||
}
|
||||
|
||||
public getDescription() {
|
||||
return this._description;
|
||||
}
|
||||
|
||||
supportedTriggers(): Array<keyof TriggerContextMapping> {
|
||||
return [APPLY_FILTER_TRIGGER];
|
||||
}
|
||||
|
@ -238,6 +244,8 @@ export class MapEmbeddable extends Embeddable<MapEmbeddableInput, MapEmbeddableO
|
|||
getFilterActions={this.getFilterActions}
|
||||
getActionContext={this.getActionContext}
|
||||
renderTooltipContent={this._renderTooltipContent}
|
||||
title={this.getTitle()}
|
||||
description={this._description}
|
||||
/>
|
||||
</I18nContext>
|
||||
</Provider>,
|
||||
|
|
|
@ -109,6 +109,7 @@ export class MapEmbeddableFactory implements EmbeddableFactoryDefinition {
|
|||
{
|
||||
layerList,
|
||||
title: savedMap.title,
|
||||
description: savedMap.description,
|
||||
editUrl: getHttp().basePath.prepend(getExistingMapPath(savedObjectId)),
|
||||
editApp: APP_ID,
|
||||
editPath: `/${MAP_PATH}/${savedObjectId}`,
|
||||
|
|
|
@ -6,15 +6,12 @@
|
|||
|
||||
import { IIndexPattern } from '../../../../../src/plugins/data/common/index_patterns';
|
||||
import { MapSettings } from '../reducers/map';
|
||||
import {
|
||||
EmbeddableInput,
|
||||
EmbeddableOutput,
|
||||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths
|
||||
} from '../../../../../src/plugins/embeddable/public/lib/embeddables';
|
||||
import { EmbeddableInput, EmbeddableOutput } from '../../../../../src/plugins/embeddable/public';
|
||||
import { Filter, Query, RefreshInterval, TimeRange } from '../../../../../src/plugins/data/common';
|
||||
import { LayerDescriptor, MapCenterAndZoom } from '../../common/descriptor_types';
|
||||
|
||||
export interface MapEmbeddableConfig {
|
||||
description?: string;
|
||||
editUrl?: string;
|
||||
editApp?: string;
|
||||
editPath?: string;
|
||||
|
|
|
@ -459,7 +459,11 @@ export class MapsAppView extends React.Component<Props, State> {
|
|||
{this._renderTopNav()}
|
||||
<h1 className="euiScreenReaderOnly">{`screenTitle placeholder`}</h1>
|
||||
<div id="react-maps-root">
|
||||
<MapContainer addFilters={this._addFilter} />
|
||||
<MapContainer
|
||||
addFilters={this._addFilter}
|
||||
title={this.props.savedMap.title}
|
||||
description={this.props.savedMap.description}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
) : null;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue