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 (
|
return (
|
||||||
<table className={this.style.infoWrap}>
|
<table className={this.style.infoWrap}>
|
||||||
<tbody>
|
<tbody>
|
||||||
{data.fields.map((f, i) => (
|
{data.fields
|
||||||
<tr key={`${i}/${rowIndex}`} className={i === columnIndex ? this.style.highlight : ''}>
|
.filter((f) => !Boolean(f.config.custom?.hideFrom?.tooltip))
|
||||||
<th>{getFieldDisplayName(f, data)}:</th>
|
.map((f, i) => (
|
||||||
<td>{fmt(f, rowIndex)}</td>
|
<tr key={`${i}/${rowIndex}`} className={i === columnIndex ? this.style.highlight : ''}>
|
||||||
</tr>
|
<th>{getFieldDisplayName(f, data)}:</th>
|
||||||
))}
|
<td>{fmt(f, rowIndex)}</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
);
|
);
|
||||||
|
@ -7,12 +7,17 @@ import { mapPanelChangedHandler, mapMigrationHandler } from './migrations';
|
|||||||
import { getLayerEditor } from './editor/layerEditor';
|
import { getLayerEditor } from './editor/layerEditor';
|
||||||
import { LayersEditor } from './editor/LayersEditor';
|
import { LayersEditor } from './editor/LayersEditor';
|
||||||
import { config } from '@grafana/runtime';
|
import { config } from '@grafana/runtime';
|
||||||
|
import { commonOptionsBuilder } from '@grafana/ui';
|
||||||
|
|
||||||
export const plugin = new PanelPlugin<GeomapPanelOptions>(GeomapPanel)
|
export const plugin = new PanelPlugin<GeomapPanelOptions>(GeomapPanel)
|
||||||
.setNoPadding()
|
.setNoPadding()
|
||||||
.setPanelChangeHandler(mapPanelChangedHandler)
|
.setPanelChangeHandler(mapPanelChangedHandler)
|
||||||
.setMigrationHandler(mapMigrationHandler)
|
.setMigrationHandler(mapMigrationHandler)
|
||||||
.useFieldConfig()
|
.useFieldConfig({
|
||||||
|
useCustomConfig: (builder) => {
|
||||||
|
commonOptionsBuilder.addHideFrom(builder);
|
||||||
|
},
|
||||||
|
})
|
||||||
.setPanelOptions((builder, context) => {
|
.setPanelOptions((builder, context) => {
|
||||||
let category = ['Map view'];
|
let category = ['Map view'];
|
||||||
builder.addCustomEditor({
|
builder.addCustomEditor({
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { MapLayerHandler, MapLayerOptions, SelectableValue } from '@grafana/data';
|
import { MapLayerHandler, MapLayerOptions, SelectableValue } from '@grafana/data';
|
||||||
|
import { HideableFieldConfig } from '@grafana/schema';
|
||||||
import { LayerElement } from 'app/core/components/Layers/types';
|
import { LayerElement } from 'app/core/components/Layers/types';
|
||||||
import BaseLayer from 'ol/layer/Base';
|
import BaseLayer from 'ol/layer/Base';
|
||||||
import { Units } from 'ol/proj/Units';
|
import { Units } from 'ol/proj/Units';
|
||||||
@ -40,6 +41,11 @@ export const defaultView: MapViewConfig = {
|
|||||||
zoom: 1,
|
zoom: 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Support hide from legend/tooltip */
|
||||||
|
export interface GeomapFieldConfig extends HideableFieldConfig {
|
||||||
|
// nothing custom yet
|
||||||
|
}
|
||||||
|
|
||||||
export interface GeomapPanelOptions {
|
export interface GeomapPanelOptions {
|
||||||
view: MapViewConfig;
|
view: MapViewConfig;
|
||||||
controls: ControlsOptions;
|
controls: ControlsOptions;
|
||||||
|
Loading…
Reference in New Issue
Block a user