mirror of https://github.com/grafana/grafana
Geomap panel: Generate types (#61636)
parent
7ccc845187
commit
3006a457f2
@ -0,0 +1,33 @@ |
||||
package common |
||||
|
||||
MapLayerOptions: { |
||||
type: string |
||||
// configured unique display name |
||||
name: string |
||||
// Custom options depending on the type |
||||
config?: _ |
||||
// Common method to define geometry fields |
||||
location?: FrameGeometrySource |
||||
// Defines a frame MatcherConfig that may filter data for the given layer |
||||
filterData?: _ |
||||
// Common properties: |
||||
// https://openlayers.org/en/latest/apidoc/module-ol_layer_Base-BaseLayer.html |
||||
// Layer opacity (0-1) |
||||
opacity?: int64 |
||||
// Check tooltip (defaults to true) |
||||
tooltip?: bool |
||||
} @cuetsy(kind="interface") @grafana(TSVeneer="type") |
||||
|
||||
FrameGeometrySourceMode: "auto" | "geohash" |"coords" | "lookup" @cuetsy(kind="enum",memberNames="Auto|Geohash|Coords|Lookup") |
||||
|
||||
FrameGeometrySource: { |
||||
mode: FrameGeometrySourceMode |
||||
// Field mappings |
||||
geohash?: string |
||||
latitude?: string |
||||
longitude?: string |
||||
wkt?: string |
||||
lookup?: string |
||||
// Path to Gazetteer |
||||
gazetteer?: string |
||||
} @cuetsy(kind="interface") |
||||
@ -0,0 +1,76 @@ |
||||
// Copyright 2023 Grafana Labs |
||||
// |
||||
// Licensed under the Apache License, Version 2.0 (the "License") |
||||
// you may not use this file except in compliance with the License. |
||||
// You may obtain a copy of the License at |
||||
// |
||||
// http://www.apache.org/licenses/LICENSE-2.0 |
||||
// |
||||
// Unless required by applicable law or agreed to in writing, software |
||||
// distributed under the License is distributed on an "AS IS" BASIS, |
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||||
// See the License for the specific language governing permissions and |
||||
// limitations under the License. |
||||
|
||||
package grafanaplugin |
||||
|
||||
import ( |
||||
"github.com/grafana/thema" |
||||
ui "github.com/grafana/grafana/packages/grafana-schema/src/common" |
||||
) |
||||
|
||||
Panel: thema.#Lineage & { |
||||
name: "geomap" |
||||
seqs: [ |
||||
{ |
||||
schemas: [ |
||||
{ |
||||
PanelOptions: { |
||||
view: MapViewConfig |
||||
controls: ControlsOptions |
||||
basemap: ui.MapLayerOptions |
||||
layers: [...ui.MapLayerOptions] |
||||
tooltip: TooltipOptions |
||||
} @cuetsy(kind="interface") |
||||
|
||||
MapViewConfig: { |
||||
id: string | *"zero" |
||||
lat?: int64 | *0 |
||||
lon?: int64 | *0 |
||||
zoom?: int64 | *1 |
||||
minZoom?: int64 |
||||
maxZoom?: int64 |
||||
padding?: int64 |
||||
allLayers?: bool | *true |
||||
lastOnly?: bool |
||||
layer?: string |
||||
shared?: bool |
||||
} @cuetsy(kind="interface") |
||||
|
||||
ControlsOptions: { |
||||
// Zoom (upper left) |
||||
showZoom?: bool |
||||
// let the mouse wheel zoom |
||||
mouseWheelZoom?: bool |
||||
// Lower right |
||||
showAttribution?: bool |
||||
// Scale options |
||||
showScale?: bool |
||||
// Show debug |
||||
showDebug?: bool |
||||
// Show measure |
||||
showMeasure?: bool |
||||
} @cuetsy(kind="interface") |
||||
|
||||
TooltipOptions: { |
||||
mode: TooltipMode |
||||
} @cuetsy(kind="interface") |
||||
|
||||
TooltipMode: "none" | "details" @cuetsy(kind="enum",memberNames="None|Details") |
||||
|
||||
MapCenterID: "zero"|"coords"|"fit" @cuetsy(kind="enum",members="Zero|Coordinates|Fit") |
||||
}, |
||||
] |
||||
}, |
||||
] |
||||
} |
||||
@ -0,0 +1,89 @@ |
||||
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
|
||||
//
|
||||
// Generated by:
|
||||
// public/app/plugins/gen.go
|
||||
// Using jennies:
|
||||
// TSTypesJenny
|
||||
// PluginTSTypesJenny
|
||||
//
|
||||
// Run 'make gen-cue' from repository root to regenerate.
|
||||
|
||||
import * as ui from '@grafana/schema'; |
||||
|
||||
export const PanelModelVersion = Object.freeze([0, 0]); |
||||
|
||||
export interface PanelOptions { |
||||
basemap: ui.MapLayerOptions; |
||||
controls: ControlsOptions; |
||||
layers: Array<ui.MapLayerOptions>; |
||||
tooltip: TooltipOptions; |
||||
view: MapViewConfig; |
||||
} |
||||
|
||||
export const defaultPanelOptions: Partial<PanelOptions> = { |
||||
layers: [], |
||||
}; |
||||
|
||||
export interface MapViewConfig { |
||||
allLayers?: boolean; |
||||
id: string; |
||||
lastOnly?: boolean; |
||||
lat?: number; |
||||
layer?: string; |
||||
lon?: number; |
||||
maxZoom?: number; |
||||
minZoom?: number; |
||||
padding?: number; |
||||
shared?: boolean; |
||||
zoom?: number; |
||||
} |
||||
|
||||
export const defaultMapViewConfig: Partial<MapViewConfig> = { |
||||
allLayers: true, |
||||
id: 'zero', |
||||
lat: 0, |
||||
lon: 0, |
||||
zoom: 1, |
||||
}; |
||||
|
||||
export interface ControlsOptions { |
||||
/** |
||||
* let the mouse wheel zoom |
||||
*/ |
||||
mouseWheelZoom?: boolean; |
||||
/** |
||||
* Lower right |
||||
*/ |
||||
showAttribution?: boolean; |
||||
/** |
||||
* Show debug |
||||
*/ |
||||
showDebug?: boolean; |
||||
/** |
||||
* Show measure |
||||
*/ |
||||
showMeasure?: boolean; |
||||
/** |
||||
* Scale options |
||||
*/ |
||||
showScale?: boolean; |
||||
/** |
||||
* Zoom (upper left) |
||||
*/ |
||||
showZoom?: boolean; |
||||
} |
||||
|
||||
export interface TooltipOptions { |
||||
mode: TooltipMode; |
||||
} |
||||
|
||||
export enum TooltipMode { |
||||
Details = 'details', |
||||
None = 'none', |
||||
} |
||||
|
||||
export enum MapCenterID { |
||||
Coords = 'coords', |
||||
Fit = 'fit', |
||||
Zero = 'zero', |
||||
} |
||||
Loading…
Reference in new issue