mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Geomap: fix esri server config (#37283)
This commit is contained in:
parent
ee51df3715
commit
5f41c2f334
@ -102,5 +102,5 @@ export interface MapLayerRegistryItem<TConfig = MapLayerOptions> extends Registr
|
|||||||
/**
|
/**
|
||||||
* Show custom elements in the panel edit UI
|
* Show custom elements in the panel edit UI
|
||||||
*/
|
*/
|
||||||
registerOptionsUI?: (builder: PanelOptionsEditorBuilder<TConfig>) => void;
|
registerOptionsUI?: (builder: PanelOptionsEditorBuilder<MapLayerOptions<TConfig>>) => void;
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ export const LayerEditor: FC<LayerEditorProps> = ({ options, onChange, data, fil
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
const builder = new PanelOptionsEditorBuilder();
|
const builder = new PanelOptionsEditorBuilder<MapLayerOptions>();
|
||||||
if (layer.showLocation) {
|
if (layer.showLocation) {
|
||||||
builder
|
builder
|
||||||
.addRadio({
|
.addRadio({
|
||||||
@ -65,7 +65,7 @@ export const LayerEditor: FC<LayerEditorProps> = ({ options, onChange, data, fil
|
|||||||
filter: (f: Field) => f.type === FieldType.number,
|
filter: (f: Field) => f.type === FieldType.number,
|
||||||
noFieldsMessage: 'No numeric fields found',
|
noFieldsMessage: 'No numeric fields found',
|
||||||
},
|
},
|
||||||
showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Coords,
|
showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Coords,
|
||||||
})
|
})
|
||||||
.addFieldNamePicker({
|
.addFieldNamePicker({
|
||||||
path: 'location.longitude',
|
path: 'location.longitude',
|
||||||
@ -74,7 +74,7 @@ export const LayerEditor: FC<LayerEditorProps> = ({ options, onChange, data, fil
|
|||||||
filter: (f: Field) => f.type === FieldType.number,
|
filter: (f: Field) => f.type === FieldType.number,
|
||||||
noFieldsMessage: 'No numeric fields found',
|
noFieldsMessage: 'No numeric fields found',
|
||||||
},
|
},
|
||||||
showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Coords,
|
showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Coords,
|
||||||
})
|
})
|
||||||
.addFieldNamePicker({
|
.addFieldNamePicker({
|
||||||
path: 'location.geohash',
|
path: 'location.geohash',
|
||||||
@ -83,7 +83,7 @@ export const LayerEditor: FC<LayerEditorProps> = ({ options, onChange, data, fil
|
|||||||
filter: (f: Field) => f.type === FieldType.string,
|
filter: (f: Field) => f.type === FieldType.string,
|
||||||
noFieldsMessage: 'No strings fields found',
|
noFieldsMessage: 'No strings fields found',
|
||||||
},
|
},
|
||||||
showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Geohash,
|
showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Geohash,
|
||||||
// eslint-disable-next-line react/display-name
|
// eslint-disable-next-line react/display-name
|
||||||
// info: (props) => <div>HELLO</div>,
|
// info: (props) => <div>HELLO</div>,
|
||||||
})
|
})
|
||||||
@ -94,14 +94,14 @@ export const LayerEditor: FC<LayerEditorProps> = ({ options, onChange, data, fil
|
|||||||
filter: (f: Field) => f.type === FieldType.string,
|
filter: (f: Field) => f.type === FieldType.string,
|
||||||
noFieldsMessage: 'No strings fields found',
|
noFieldsMessage: 'No strings fields found',
|
||||||
},
|
},
|
||||||
showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Lookup,
|
showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Lookup,
|
||||||
})
|
})
|
||||||
.addCustomEditor({
|
.addCustomEditor({
|
||||||
id: 'gazetteer',
|
id: 'gazetteer',
|
||||||
path: 'location.gazetteer',
|
path: 'location.gazetteer',
|
||||||
name: 'Gazetteer',
|
name: 'Gazetteer',
|
||||||
editor: GazetteerPathEditor,
|
editor: GazetteerPathEditor,
|
||||||
showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Lookup,
|
showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Lookup,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (layer.registerOptionsUI) {
|
if (layer.registerOptionsUI) {
|
||||||
|
@ -49,9 +49,7 @@ export const publicServiceRegistry = new Registry<PublicServiceItem>(() => [
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
export interface ESRIXYZConfig extends XYZConfig {
|
export interface ESRIXYZConfig extends XYZConfig {
|
||||||
config: {
|
|
||||||
server: string;
|
server: string;
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const esriXYZTiles: MapLayerRegistryItem<ESRIXYZConfig> = {
|
export const esriXYZTiles: MapLayerRegistryItem<ESRIXYZConfig> = {
|
||||||
@ -61,7 +59,7 @@ export const esriXYZTiles: MapLayerRegistryItem<ESRIXYZConfig> = {
|
|||||||
|
|
||||||
create: async (map: Map, options: MapLayerOptions<ESRIXYZConfig>, theme: GrafanaTheme2) => {
|
create: async (map: Map, options: MapLayerOptions<ESRIXYZConfig>, theme: GrafanaTheme2) => {
|
||||||
const cfg = { ...options.config };
|
const cfg = { ...options.config };
|
||||||
const svc = publicServiceRegistry.getIfExists(cfg.config?.server ?? DEFAULT_SERVICE)!;
|
const svc = publicServiceRegistry.getIfExists(cfg.server ?? DEFAULT_SERVICE)!;
|
||||||
if (svc.id !== CUSTOM_SERVICE) {
|
if (svc.id !== CUSTOM_SERVICE) {
|
||||||
const base = 'https://services.arcgisonline.com/ArcGIS/rest/services/';
|
const base = 'https://services.arcgisonline.com/ArcGIS/rest/services/';
|
||||||
cfg.url = `${base}${svc.slug}/MapServer/tile/{z}/{y}/{x}`;
|
cfg.url = `${base}${svc.slug}/MapServer/tile/{z}/{y}/{x}`;
|
||||||
|
Loading…
Reference in New Issue
Block a user