The open and composable observability and data visualization platform. Visualize metrics, logs, and traces from multiple sources like Prometheus, Loki, Elasticsearch, InfluxDB, Postgres and many more.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
grafana/public/app/plugins/panel/geomap/module.tsx

97 lines
2.9 KiB

import { PanelPlugin } from '@grafana/data';
import { BaseLayerEditor } from './editor/BaseLayerEditor';
import { DataLayersEditor } from './editor/DataLayersEditor';
import { GeomapPanel } from './GeomapPanel';
import { MapViewEditor } from './editor/MapViewEditor';
import { defaultView, GeomapPanelOptions } from './types';
import { mapPanelChangedHandler } from './migrations';
import { defaultMarkersConfig } from './layers/data/markersLayer';
import { DEFAULT_BASEMAP_CONFIG } from './layers/registry';
export const plugin = new PanelPlugin<GeomapPanelOptions>(GeomapPanel)
.setNoPadding()
.setPanelChangeHandler(mapPanelChangedHandler)
.useFieldConfig()
.setPanelOptions((builder) => {
let category = ['Map View'];
builder.addCustomEditor({
category,
id: 'view',
path: 'view',
name: 'Initial view', // don't show it
description: 'This location will show when the panel first loads',
editor: MapViewEditor,
defaultValue: defaultView,
});
builder.addBooleanSwitch({
category,
path: 'view.shared',
description: 'Use the same view across multiple panels. Note: this may require a dashboard reload.',
name: 'Share view',
defaultValue: defaultView.shared,
});
builder.addCustomEditor({
category: ['Base Layer'],
id: 'basemap',
path: 'basemap',
name: 'Base Layer',
editor: BaseLayerEditor,
defaultValue: DEFAULT_BASEMAP_CONFIG,
});
builder.addCustomEditor({
category: ['Data Layer'],
id: 'layers',
path: 'layers',
name: 'Data Layer',
editor: DataLayersEditor,
defaultValue: [defaultMarkersConfig],
});
// The controls section
category = ['Map Controls'];
builder
.addBooleanSwitch({
category,
path: 'controls.showZoom',
description: 'show buttons in the upper left',
name: 'Show zoom control',
defaultValue: true,
})
.addBooleanSwitch({
category,
path: 'controls.mouseWheelZoom',
name: 'Mouse wheel zoom',
defaultValue: true,
})
.addBooleanSwitch({
category,
path: 'controls.showLegend',
name: 'Show legend',
description: 'Show legend',
defaultValue: true,
})
.addBooleanSwitch({
category,
path: 'controls.showAttribution',
name: 'Show attribution',
description: 'Show the map source attribution info in the lower right',
defaultValue: true,
})
.addBooleanSwitch({
category,
path: 'controls.showScale',
name: 'Show scale',
description: 'Indicate map scale',
defaultValue: false,
})
.addBooleanSwitch({
category,
path: 'controls.showDebug',
name: 'Show debug',
description: 'show map info',
defaultValue: false,
});
});