mirror of
https://github.com/grafana/grafana.git
synced 2025-02-12 00:25:46 -06:00
Geomap: Promote route + photos layer to beta, promote geojson layer to stable (#72233)
This commit is contained in:
parent
cfb1656968
commit
bc0bf0ee4b
@ -12,7 +12,6 @@ import {
|
|||||||
MapLayerRegistryItem,
|
MapLayerRegistryItem,
|
||||||
MapLayerOptions,
|
MapLayerOptions,
|
||||||
GrafanaTheme2,
|
GrafanaTheme2,
|
||||||
PluginState,
|
|
||||||
EventBus,
|
EventBus,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { ComparisonOperation } from '@grafana/schema';
|
import { ComparisonOperation } from '@grafana/schema';
|
||||||
@ -66,7 +65,6 @@ export const geojsonLayer: MapLayerRegistryItem<GeoJSONMapperConfig> = {
|
|||||||
name: 'GeoJSON',
|
name: 'GeoJSON',
|
||||||
description: 'Load static data from a geojson file',
|
description: 'Load static data from a geojson file',
|
||||||
isBaseMap: false,
|
isBaseMap: false,
|
||||||
state: PluginState.beta,
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that configures transformation and returns a transformer
|
* Function that configures transformation and returns a transformer
|
||||||
|
@ -69,7 +69,7 @@ export const photosLayer: MapLayerRegistryItem<PhotoConfig> = {
|
|||||||
isBaseMap: false,
|
isBaseMap: false,
|
||||||
showLocation: true,
|
showLocation: true,
|
||||||
hideOpacity: true,
|
hideOpacity: true,
|
||||||
state: PluginState.alpha,
|
state: PluginState.beta,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that configures transformation and returns a transformer
|
* Function that configures transformation and returns a transformer
|
||||||
|
@ -69,7 +69,7 @@ export const routeLayer: MapLayerRegistryItem<RouteConfig> = {
|
|||||||
description: 'Render data points as a route',
|
description: 'Render data points as a route',
|
||||||
isBaseMap: false,
|
isBaseMap: false,
|
||||||
showLocation: true,
|
showLocation: true,
|
||||||
state: PluginState.alpha,
|
state: PluginState.beta,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function that configures transformation and returns a transformer
|
* Function that configures transformation and returns a transformer
|
||||||
|
@ -57,33 +57,44 @@ interface RegistrySelectInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getLayersSelection(items: Array<MapLayerRegistryItem<any>>, current?: string): RegistrySelectInfo {
|
function getLayersSelection(items: Array<MapLayerRegistryItem<any>>, current?: string): RegistrySelectInfo {
|
||||||
const res: RegistrySelectInfo = { options: [], current: [] };
|
const registry: RegistrySelectInfo = { options: [], current: [] };
|
||||||
const alpha: Array<SelectableValue<string>> = [];
|
const alpha: Array<SelectableValue<string>> = [];
|
||||||
|
|
||||||
for (const layer of items) {
|
for (const layer of items) {
|
||||||
const opt: SelectableValue<string> = { label: layer.name, value: layer.id, description: layer.description };
|
const option: SelectableValue<string> = { label: layer.name, value: layer.id, description: layer.description };
|
||||||
if (layer.state === PluginState.alpha) {
|
|
||||||
if (!hasAlphaPanels) {
|
switch (layer.state) {
|
||||||
continue;
|
case PluginState.alpha:
|
||||||
}
|
if (!hasAlphaPanels) {
|
||||||
opt.label = `${layer.name} (Alpha)`;
|
break;
|
||||||
opt.icon = 'bolt';
|
}
|
||||||
alpha.push(opt);
|
option.label = `${layer.name} (Alpha)`;
|
||||||
} else {
|
option.icon = 'bolt';
|
||||||
res.options.push(opt);
|
alpha.push(option);
|
||||||
|
break;
|
||||||
|
case PluginState.beta:
|
||||||
|
option.label = `${layer.name} (Beta)`;
|
||||||
|
default:
|
||||||
|
registry.options.push(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layer.id === current) {
|
if (layer.id === current) {
|
||||||
res.current.push(opt);
|
registry.current.push(option);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (const p of alpha) {
|
|
||||||
res.options.push(p);
|
// Position alpha layers at the end of the layers list
|
||||||
|
for (const layer of alpha) {
|
||||||
|
registry.options.push(layer);
|
||||||
}
|
}
|
||||||
return res;
|
|
||||||
|
return registry;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getLayersOptions(basemap: boolean, current?: string): RegistrySelectInfo {
|
export function getLayersOptions(basemap: boolean, current?: string): RegistrySelectInfo {
|
||||||
if (basemap) {
|
if (basemap) {
|
||||||
return getLayersSelection([defaultBaseLayer, ...basemapLayers], current);
|
return getLayersSelection([defaultBaseLayer, ...basemapLayers], current);
|
||||||
}
|
}
|
||||||
|
|
||||||
return getLayersSelection([...dataLayers, ...basemapLayers], current);
|
return getLayersSelection([...dataLayers, ...basemapLayers], current);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user