mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Geomap: support hide from tooltip (#43127)
This commit is contained in:
parent
198f947d0b
commit
c2392598ea
@ -43,12 +43,14 @@ export class DataHoverView extends PureComponent<Props> {
|
||||
return (
|
||||
<table className={this.style.infoWrap}>
|
||||
<tbody>
|
||||
{data.fields.map((f, i) => (
|
||||
<tr key={`${i}/${rowIndex}`} className={i === columnIndex ? this.style.highlight : ''}>
|
||||
<th>{getFieldDisplayName(f, data)}:</th>
|
||||
<td>{fmt(f, rowIndex)}</td>
|
||||
</tr>
|
||||
))}
|
||||
{data.fields
|
||||
.filter((f) => !Boolean(f.config.custom?.hideFrom?.tooltip))
|
||||
.map((f, i) => (
|
||||
<tr key={`${i}/${rowIndex}`} className={i === columnIndex ? this.style.highlight : ''}>
|
||||
<th>{getFieldDisplayName(f, data)}:</th>
|
||||
<td>{fmt(f, rowIndex)}</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
);
|
||||
|
@ -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<GeomapPanelOptions>(GeomapPanel)
|
||||
.setNoPadding()
|
||||
.setPanelChangeHandler(mapPanelChangedHandler)
|
||||
.setMigrationHandler(mapMigrationHandler)
|
||||
.useFieldConfig()
|
||||
.useFieldConfig({
|
||||
useCustomConfig: (builder) => {
|
||||
commonOptionsBuilder.addHideFrom(builder);
|
||||
},
|
||||
})
|
||||
.setPanelOptions((builder, context) => {
|
||||
let category = ['Map view'];
|
||||
builder.addCustomEditor({
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user