Geomap: Update to panelcfg (#63169)

* Geomap: Update to panelcfg

* Generate geomappanelcfg docs

---------

Co-authored-by: Tania B <yalyna.ts@gmail.com>
pull/63189/head
Alex Khomenko 2 years ago committed by GitHub
parent 4570131fe5
commit d660e3acb9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 92
      docs/sources/developers/kinds/composable/geomappanelcfg/schema-reference.md
  2. 18
      pkg/kindsys/report.json
  3. 76
      public/app/plugins/panel/geomap/models.cue
  4. 78
      public/app/plugins/panel/geomap/panelcfg.cue
  5. 2
      public/app/plugins/panel/geomap/panelcfg.gen.ts
  6. 4
      public/app/plugins/panel/geomap/types.ts

@ -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:<br/>https://openlayers.org/en/latest/apidoc/module-ol_layer_Base-BaseLayer.html<br/>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`. |

@ -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",

@ -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")
},
]
},
]
}

@ -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")
},
]
},
]
}
}

@ -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;

@ -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<TConfig = unknown> extends LayerElement {
mouseEvents: Subject<FeatureLike | undefined>;
}
export { PanelOptions, MapViewConfig, TooltipOptions, TooltipMode, defaultMapViewConfig } from './models.gen';
export { PanelOptions, MapViewConfig, TooltipOptions, TooltipMode, defaultMapViewConfig } from './panelcfg.gen';

Loading…
Cancel
Save