diff --git a/public/app/plugins/panel/geomap/components/DataHoverView.tsx b/public/app/plugins/panel/geomap/components/DataHoverView.tsx index 5f9be545374..ec6b2e361a2 100644 --- a/public/app/plugins/panel/geomap/components/DataHoverView.tsx +++ b/public/app/plugins/panel/geomap/components/DataHoverView.tsx @@ -43,12 +43,14 @@ export class DataHoverView extends PureComponent { return ( - {data.fields.map((f, i) => ( - - - - - ))} + {data.fields + .filter((f) => !Boolean(f.config.custom?.hideFrom?.tooltip)) + .map((f, i) => ( + + + + + ))}
{getFieldDisplayName(f, data)}:{fmt(f, rowIndex)}
{getFieldDisplayName(f, data)}:{fmt(f, rowIndex)}
); diff --git a/public/app/plugins/panel/geomap/module.tsx b/public/app/plugins/panel/geomap/module.tsx index 45c7892d737..f1805ef7a30 100644 --- a/public/app/plugins/panel/geomap/module.tsx +++ b/public/app/plugins/panel/geomap/module.tsx @@ -7,12 +7,17 @@ import { mapPanelChangedHandler, mapMigrationHandler } from './migrations'; import { getLayerEditor } from './editor/layerEditor'; import { LayersEditor } from './editor/LayersEditor'; import { config } from '@grafana/runtime'; +import { commonOptionsBuilder } from '@grafana/ui'; export const plugin = new PanelPlugin(GeomapPanel) .setNoPadding() .setPanelChangeHandler(mapPanelChangedHandler) .setMigrationHandler(mapMigrationHandler) - .useFieldConfig() + .useFieldConfig({ + useCustomConfig: (builder) => { + commonOptionsBuilder.addHideFrom(builder); + }, + }) .setPanelOptions((builder, context) => { let category = ['Map view']; builder.addCustomEditor({ diff --git a/public/app/plugins/panel/geomap/types.ts b/public/app/plugins/panel/geomap/types.ts index 1f33ea45cb4..f39c6955f93 100644 --- a/public/app/plugins/panel/geomap/types.ts +++ b/public/app/plugins/panel/geomap/types.ts @@ -1,4 +1,5 @@ import { MapLayerHandler, MapLayerOptions, SelectableValue } from '@grafana/data'; +import { HideableFieldConfig } from '@grafana/schema'; import { LayerElement } from 'app/core/components/Layers/types'; import BaseLayer from 'ol/layer/Base'; import { Units } from 'ol/proj/Units'; @@ -40,6 +41,11 @@ export const defaultView: MapViewConfig = { zoom: 1, }; +/** Support hide from legend/tooltip */ +export interface GeomapFieldConfig extends HideableFieldConfig { + // nothing custom yet +} + export interface GeomapPanelOptions { view: MapViewConfig; controls: ControlsOptions;