From 5f41c2f334daea55844079a07a2e2348ee13161d Mon Sep 17 00:00:00 2001 From: Ryan McKinley Date: Tue, 27 Jul 2021 22:26:42 -0700 Subject: [PATCH] Geomap: fix esri server config (#37283) --- packages/grafana-data/src/geo/layer.ts | 2 +- .../app/plugins/panel/geomap/editor/LayerEditor.tsx | 12 ++++++------ .../app/plugins/panel/geomap/layers/basemaps/esri.ts | 6 ++---- 3 files changed, 9 insertions(+), 11 deletions(-) diff --git a/packages/grafana-data/src/geo/layer.ts b/packages/grafana-data/src/geo/layer.ts index 8c148f97e5c..c954c495d96 100644 --- a/packages/grafana-data/src/geo/layer.ts +++ b/packages/grafana-data/src/geo/layer.ts @@ -102,5 +102,5 @@ export interface MapLayerRegistryItem extends Registr /** * Show custom elements in the panel edit UI */ - registerOptionsUI?: (builder: PanelOptionsEditorBuilder) => void; + registerOptionsUI?: (builder: PanelOptionsEditorBuilder>) => void; } diff --git a/public/app/plugins/panel/geomap/editor/LayerEditor.tsx b/public/app/plugins/panel/geomap/editor/LayerEditor.tsx index c77bb87deeb..5446380d6b8 100644 --- a/public/app/plugins/panel/geomap/editor/LayerEditor.tsx +++ b/public/app/plugins/panel/geomap/editor/LayerEditor.tsx @@ -41,7 +41,7 @@ export const LayerEditor: FC = ({ options, onChange, data, fil return null; } - const builder = new PanelOptionsEditorBuilder(); + const builder = new PanelOptionsEditorBuilder(); if (layer.showLocation) { builder .addRadio({ @@ -65,7 +65,7 @@ export const LayerEditor: FC = ({ options, onChange, data, fil filter: (f: Field) => f.type === FieldType.number, noFieldsMessage: 'No numeric fields found', }, - showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Coords, + showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Coords, }) .addFieldNamePicker({ path: 'location.longitude', @@ -74,7 +74,7 @@ export const LayerEditor: FC = ({ options, onChange, data, fil filter: (f: Field) => f.type === FieldType.number, noFieldsMessage: 'No numeric fields found', }, - showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Coords, + showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Coords, }) .addFieldNamePicker({ path: 'location.geohash', @@ -83,7 +83,7 @@ export const LayerEditor: FC = ({ options, onChange, data, fil filter: (f: Field) => f.type === FieldType.string, 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 // info: (props) =>
HELLO
, }) @@ -94,14 +94,14 @@ export const LayerEditor: FC = ({ options, onChange, data, fil filter: (f: Field) => f.type === FieldType.string, noFieldsMessage: 'No strings fields found', }, - showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Lookup, + showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Lookup, }) .addCustomEditor({ id: 'gazetteer', path: 'location.gazetteer', name: 'Gazetteer', editor: GazetteerPathEditor, - showIf: (opts: MapLayerOptions) => opts.location?.mode === FrameGeometrySourceMode.Lookup, + showIf: (opts) => opts.location?.mode === FrameGeometrySourceMode.Lookup, }); } if (layer.registerOptionsUI) { diff --git a/public/app/plugins/panel/geomap/layers/basemaps/esri.ts b/public/app/plugins/panel/geomap/layers/basemaps/esri.ts index 7cf5e3bd7af..6d2cd519c62 100644 --- a/public/app/plugins/panel/geomap/layers/basemaps/esri.ts +++ b/public/app/plugins/panel/geomap/layers/basemaps/esri.ts @@ -49,9 +49,7 @@ export const publicServiceRegistry = new Registry(() => [ ]); export interface ESRIXYZConfig extends XYZConfig { - config: { - server: string; - }; + server: string; } export const esriXYZTiles: MapLayerRegistryItem = { @@ -61,7 +59,7 @@ export const esriXYZTiles: MapLayerRegistryItem = { create: async (map: Map, options: MapLayerOptions, theme: GrafanaTheme2) => { 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) { const base = 'https://services.arcgisonline.com/ArcGIS/rest/services/'; cfg.url = `${base}${svc.slug}/MapServer/tile/{z}/{y}/{x}`;