diff --git a/docs/sources/developers/kinds/composable/geomappanelcfg/schema-reference.md b/docs/sources/developers/kinds/composable/geomappanelcfg/schema-reference.md new file mode 100644 index 00000000000..1b5929f4c7e --- /dev/null +++ b/docs/sources/developers/kinds/composable/geomappanelcfg/schema-reference.md @@ -0,0 +1,92 @@ +--- +keywords: + - grafana + - schema +title: GeomapPanelCfg kind +--- +> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. + +## GeomapPanelCfg + +#### Maturity: [experimental](../../../maturity/#experimental) +#### Version: 0.0 + + + +| Property | Type | Required | Description | +|-------------------|----------------------------|----------|-----------------------------------------------| +| `ControlsOptions` | [object](#controlsoptions) | **Yes** | | +| `MapCenterID` | string | **Yes** | Possible values are: `zero`, `coords`, `fit`. | +| `MapViewConfig` | [object](#mapviewconfig) | **Yes** | | +| `PanelOptions` | [object](#paneloptions) | **Yes** | | +| `TooltipMode` | string | **Yes** | Possible values are: `none`, `details`. | +| `TooltipOptions` | [object](#tooltipoptions) | **Yes** | | + +### ControlsOptions + +| Property | Type | Required | Description | +|-------------------|---------|----------|--------------------------| +| `mouseWheelZoom` | boolean | No | let the mouse wheel zoom | +| `showAttribution` | boolean | No | Lower right | +| `showDebug` | boolean | No | Show debug | +| `showMeasure` | boolean | No | Show measure | +| `showScale` | boolean | No | Scale options | +| `showZoom` | boolean | No | Zoom (upper left) | + +### MapViewConfig + +| Property | Type | Required | Description | +|-------------|---------|----------|------------------| +| `id` | string | **Yes** | Default: `zero`. | +| `allLayers` | boolean | No | Default: `true`. | +| `lastOnly` | boolean | No | | +| `lat` | integer | No | Default: `0`. | +| `layer` | string | No | | +| `lon` | integer | No | Default: `0`. | +| `maxZoom` | integer | No | | +| `minZoom` | integer | No | | +| `padding` | integer | No | | +| `shared` | boolean | No | | +| `zoom` | integer | No | Default: `1`. | + +### PanelOptions + +| Property | Type | Required | Description | +|------------|---------------------------------------|----------|-------------| +| `basemap` | [MapLayerOptions](#maplayeroptions) | **Yes** | | +| `controls` | [ControlsOptions](#controlsoptions) | **Yes** | | +| `layers` | [MapLayerOptions](#maplayeroptions)[] | **Yes** | | +| `tooltip` | [TooltipOptions](#tooltipoptions) | **Yes** | | +| `view` | [MapViewConfig](#mapviewconfig) | **Yes** | | + +### MapLayerOptions + +| Property | Type | Required | Description | +|--------------|---------------------------------------------|----------|----------------------------------------------------------------------------------------------------------------------------| +| `name` | string | **Yes** | configured unique display name | +| `type` | string | **Yes** | | +| `config` | | No | Custom options depending on the type | +| `filterData` | | No | Defines a frame MatcherConfig that may filter data for the given layer | +| `location` | [FrameGeometrySource](#framegeometrysource) | No | | +| `opacity` | integer | No | Common properties:
https://openlayers.org/en/latest/apidoc/module-ol_layer_Base-BaseLayer.html
Layer opacity (0-1) | +| `tooltip` | boolean | No | Check tooltip (defaults to true) | + +### FrameGeometrySource + +| Property | Type | Required | Description | +|-------------|--------|----------|-------------------------------------------------------------| +| `mode` | string | **Yes** | Possible values are: `auto`, `geohash`, `coords`, `lookup`. | +| `gazetteer` | string | No | Path to Gazetteer | +| `geohash` | string | No | Field mappings | +| `latitude` | string | No | | +| `longitude` | string | No | | +| `lookup` | string | No | | +| `wkt` | string | No | | + +### TooltipOptions + +| Property | Type | Required | Description | +|----------|--------|----------|-----------------------------------------| +| `mode` | string | **Yes** | Possible values are: `none`, `details`. | + + diff --git a/pkg/kindsys/report.json b/pkg/kindsys/report.json index d0a4881b619..3cb6c78a04d 100644 --- a/pkg/kindsys/report.json +++ b/pkg/kindsys/report.json @@ -548,7 +548,9 @@ }, "geomappanelcfg": { "category": "composable", - "codeowners": [], + "codeowners": [ + "grafana/grafana-edge-squad" + ], "currentVersion": [ 0, 0 @@ -556,13 +558,13 @@ "grafanaMaturityCount": 0, "lineageIsGroup": true, "links": { - "docs": "n/a", + "docs": "https://grafana.com/docs/grafana/next/developers/kinds/composable/geomappanelcfg/schema-reference", "go": "n/a", - "schema": "n/a", - "ts": "n/a" + "schema": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/geomap/panelcfg.cue", + "ts": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/geomap/panelcfg.gen.ts" }, "machineName": "geomappanelcfg", - "maturity": "planned", + "maturity": "experimental", "name": "GeomapPanelCfg", "pluralMachineName": "geomappanelcfgs", "pluralName": "GeomapPanelCfgs", @@ -1989,6 +1991,7 @@ "debugpanelcfg", "elasticsearchdataquery", "gaugepanelcfg", + "geomappanelcfg", "histogrampanelcfg", "librarypanel", "lokidataquery", @@ -2005,7 +2008,7 @@ "textpanelcfg", "xychartpanelcfg" ], - "count": 23 + "count": 24 }, "mature": { "name": "mature", @@ -2041,7 +2044,6 @@ "elasticsearchdatasourcecfg", "flamegraphpanelcfg", "folder", - "geomappanelcfg", "gettingstartedpanelcfg", "googlecloudmonitoringdataquery", "googlecloudmonitoringdatasourcecfg", @@ -2078,7 +2080,7 @@ "zipkindataquery", "zipkindatasourcecfg" ], - "count": 48 + "count": 47 }, "stable": { "name": "stable", diff --git a/public/app/plugins/panel/geomap/models.cue b/public/app/plugins/panel/geomap/models.cue deleted file mode 100644 index 5d5fcff0ea8..00000000000 --- a/public/app/plugins/panel/geomap/models.cue +++ /dev/null @@ -1,76 +0,0 @@ -// 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") - }, - ] - }, - ] -} diff --git a/public/app/plugins/panel/geomap/panelcfg.cue b/public/app/plugins/panel/geomap/panelcfg.cue new file mode 100644 index 00000000000..2778bb076e4 --- /dev/null +++ b/public/app/plugins/panel/geomap/panelcfg.cue @@ -0,0 +1,78 @@ +// 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 ( + ui "github.com/grafana/grafana/packages/grafana-schema/src/common" +) + +composableKinds: PanelCfg: { + maturity: "experimental" + + lineage: { + 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") + }, + ] + }, + ] + } +} diff --git a/public/app/plugins/panel/geomap/models.gen.ts b/public/app/plugins/panel/geomap/panelcfg.gen.ts similarity index 96% rename from public/app/plugins/panel/geomap/models.gen.ts rename to public/app/plugins/panel/geomap/panelcfg.gen.ts index 14e35dcc58e..bed8730a6a2 100644 --- a/public/app/plugins/panel/geomap/models.gen.ts +++ b/public/app/plugins/panel/geomap/panelcfg.gen.ts @@ -10,7 +10,7 @@ import * as ui from '@grafana/schema'; -export const PanelModelVersion = Object.freeze([0, 0]); +export const PanelCfgModelVersion = Object.freeze([0, 0]); export interface PanelOptions { basemap: ui.MapLayerOptions; diff --git a/public/app/plugins/panel/geomap/types.ts b/public/app/plugins/panel/geomap/types.ts index 2a913c8dde5..f4dfa7f8093 100644 --- a/public/app/plugins/panel/geomap/types.ts +++ b/public/app/plugins/panel/geomap/types.ts @@ -7,7 +7,7 @@ import { Subject } from 'rxjs'; import { MapLayerHandler, MapLayerOptions } from '@grafana/data'; import { LayerElement } from 'app/core/components/Layers/types'; -import { ControlsOptions as ControlsOptionsBase } from './models.gen'; +import { ControlsOptions as ControlsOptionsBase } from './panelcfg.gen'; import { StyleConfig } from './style/types'; export interface ControlsOptions extends ControlsOptionsBase { @@ -61,4 +61,4 @@ export interface MapLayerState extends LayerElement { mouseEvents: Subject; } -export { PanelOptions, MapViewConfig, TooltipOptions, TooltipMode, defaultMapViewConfig } from './models.gen'; +export { PanelOptions, MapViewConfig, TooltipOptions, TooltipMode, defaultMapViewConfig } from './panelcfg.gen';