mirror of https://github.com/grafana/grafana
Codegen: Generate docs for composable kinds (#61719)
* Generate docs for composable kinds * Fix getting the kind schema * Generate composable kinds docs * Add disclaimer to the generated docs * Change docs disclaimerpull/61474/head
parent
65127d4913
commit
5f93e67419
@ -0,0 +1,8 @@ |
||||
--- |
||||
title: Composable kinds |
||||
weight: 200 |
||||
--- |
||||
|
||||
# Grafana composable kinds |
||||
|
||||
{{< section >}} |
@ -0,0 +1,37 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: AnnotationsListPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# AnnotationsListPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------| |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------------------|----------|----------|-------------------| |
||||
| `limit` | integer | **Yes** | Default: `10`. | |
||||
| `navigateAfter` | string | **Yes** | Default: `10m`. | |
||||
| `navigateBefore` | string | **Yes** | Default: `10m`. | |
||||
| `navigateToPanel` | boolean | **Yes** | Default: `true`. | |
||||
| `onlyFromThisDashboard` | boolean | **Yes** | Default: `false`. | |
||||
| `onlyInTimeRange` | boolean | **Yes** | Default: `false`. | |
||||
| `showTags` | boolean | **Yes** | Default: `true`. | |
||||
| `showTime` | boolean | **Yes** | Default: `true`. | |
||||
| `showUser` | boolean | **Yes** | Default: `true`. | |
||||
| `tags` | string[] | **Yes** | | |
||||
|
||||
|
@ -0,0 +1,61 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: BarChartPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# BarChartPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|--------------------|-----------------------------|----------|-------------| |
||||
| `PanelFieldConfig` | [object](#panelfieldconfig) | **Yes** | | |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelFieldConfig |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------------|-----------------------------------------------------------|----------|--------------------------------------------------------------------| |
||||
| `fillOpacity` | integer | No | Controls the fill opacity of the bars. Default: `80`. | |
||||
| `gradientMode` | string | No | TODO docs Possible values are: `none`, `opacity`, `hue`, `scheme`. | |
||||
| `lineWidth` | integer | No | Controls line width of the bars. Default: `1`. | |
||||
| `thresholdsStyle` | [GraphThresholdsStyleConfig](#graphthresholdsstyleconfig) | No | TODO docs | |
||||
|
||||
### GraphThresholdsStyleConfig |
||||
|
||||
TODO docs |
||||
|
||||
#### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------|--------|----------|-------------------------------------------------------------------------------------------------------| |
||||
| `mode` | string | **Yes** | TODO docs Possible values are: `off`, `line`, `dashed`, `area`, `line+area`, `dashed+area`, `series`. | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-----------------------|---------|----------|------------------------------------------------------------------------------------------------------------------------------------| |
||||
| `barRadius` | number | No | TODO docs Default: `0`. | |
||||
| `barWidth` | number | No | Controls the width of bars. 1 = Max width, 0 = Min width. Default: `0.97`. | |
||||
| `colorByField` | string | No | TODO docs | |
||||
| `fullHighlight` | boolean | No | Enables mode which highlights the entire bar area and shows tooltip when cursor<br/>hovers over highlighted area Default: `false`. | |
||||
| `groupWidth` | number | No | Controls the width of groups. 1 = max with, 0 = min width. Default: `0.7`. | |
||||
| `orientation` | string | No | TODO docs Possible values are: `auto`, `vertical`, `horizontal`. | |
||||
| `showValue` | string | No | TODO docs Possible values are: `auto`, `never`, `always`. | |
||||
| `stacking` | string | No | TODO docs Possible values are: `none`, `normal`, `percent`. | |
||||
| `xField` | string | No | TODO docs | |
||||
| `xTickLabelMaxLength` | integer | No | TODO docs | |
||||
| `xTickLabelRotation` | integer | No | TODO docs Default: `0`. | |
||||
| `xTickLabelSpacing` | integer | No | TODO docs<br/>negative values indicate backwards skipping behavior Default: `0`. | |
||||
|
||||
|
@ -0,0 +1,31 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: BarGaugePanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# BarGaugePanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------| |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|---------|----------|-------------------------------------------------------------------------------------------------------------------------------------------| |
||||
| `displayMode` | string | No | Enum expressing the possible display modes<br/>for the bar gauge component of Grafana UI Possible values are: `basic`, `lcd`, `gradient`. | |
||||
| `minVizHeight` | integer | No | Default: `10`. | |
||||
| `minVizWidth` | integer | No | Default: `0`. | |
||||
| `showUnfilled` | boolean | No | Default: `true`. | |
||||
|
||||
|
@ -0,0 +1,37 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: DashboardListPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# DashboardListPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|------------------------------------------| |
||||
| `PanelLayout` | string | **Yes** | Possible values are: `list`, `previews`. | |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------------|----------|----------|------------------------------------------| |
||||
| `maxItems` | integer | **Yes** | Default: `10`. | |
||||
| `query` | string | **Yes** | Default: ``. | |
||||
| `showHeadings` | boolean | **Yes** | Default: `true`. | |
||||
| `showRecentlyViewed` | boolean | **Yes** | Default: `false`. | |
||||
| `showSearch` | boolean | **Yes** | Default: `false`. | |
||||
| `showStarred` | boolean | **Yes** | Default: `true`. | |
||||
| `tags` | string[] | **Yes** | | |
||||
| `folderId` | integer | No | | |
||||
| `layout` | string | No | Possible values are: `list`, `previews`. | |
||||
|
||||
|
@ -0,0 +1,29 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: GaugePanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# GaugePanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------| |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|------------------------|---------|----------|-------------------| |
||||
| `showThresholdLabels` | boolean | No | Default: `false`. | |
||||
| `showThresholdMarkers` | boolean | No | Default: `true`. | |
||||
|
||||
|
@ -0,0 +1,41 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: HistogramPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# HistogramPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|--------------------|-----------------------------|----------|-------------| |
||||
| `PanelFieldConfig` | [object](#panelfieldconfig) | **Yes** | | |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelFieldConfig |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|---------|----------|--------------------------------------------------------------------| |
||||
| `fillOpacity` | integer | No | Controls the fill opacity of the bars. Default: `80`. | |
||||
| `gradientMode` | string | No | TODO docs Possible values are: `none`, `opacity`, `hue`, `scheme`. | |
||||
| `lineWidth` | integer | No | Controls line width of the bars. Default: `1`. | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|---------|----------|--------------------------------------------------| |
||||
| `bucketOffset` | integer | No | Offset buckets by this amount Default: `0`. | |
||||
| `bucketSize` | integer | No | Size of each bucket | |
||||
| `combine` | boolean | No | Combines multiple series into a single histogram | |
||||
|
||||
|
@ -0,0 +1,29 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: NewsPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# NewsPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------| |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------|---------|----------|--------------------------------------------| |
||||
| `feedUrl` | string | No | empty/missing will default to grafana blog | |
||||
| `showImage` | boolean | No | Default: `true`. | |
||||
|
||||
|
@ -0,0 +1,73 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: PieChartPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# PieChartPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------------------|---------------------------------------------|----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
||||
| `PanelFieldConfig` | [HideableFieldConfig](#hideablefieldconfig) | **Yes** | TODO docs | |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
| `PieChartLabels` | string | **Yes** | Select labels to display on the pie chart.<br/> - Name - The series or field name.<br/> - Percent - The percentage of the whole.<br/> - Value - The raw numerical value. Possible values are: `name`, `value`, `percent`. | |
||||
| `PieChartLegendOptions` | [object](#piechartlegendoptions) | **Yes** | | |
||||
| `PieChartLegendValues` | string | **Yes** | Select values to display in the legend.<br/> - Percent: The percentage of the whole.<br/> - Value: The raw numerical value. Possible values are: `value`, `percent`. | |
||||
| `PieChartType` | string | **Yes** | Select the pie chart display style. Possible values are: `pie`, `donut`. | |
||||
|
||||
## HideableFieldConfig |
||||
|
||||
TODO docs |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|------------|---------------------------------------|----------|-------------| |
||||
| `hideFrom` | [HideSeriesConfig](#hideseriesconfig) | No | TODO docs | |
||||
|
||||
### HideSeriesConfig |
||||
|
||||
TODO docs |
||||
|
||||
#### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-----------|---------|----------|-------------| |
||||
| `legend` | boolean | **Yes** | | |
||||
| `tooltip` | boolean | **Yes** | | |
||||
| `viz` | boolean | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-----------------|-------------------------------------------------|----------|--------------------------------------------------------------------------| |
||||
| `displayLabels` | string[] | No | | |
||||
| `legend` | [PieChartLegendOptions](#piechartlegendoptions) | No | | |
||||
| `pieType` | string | No | Select the pie chart display style. Possible values are: `pie`, `donut`. | |
||||
|
||||
### PieChartLegendOptions |
||||
|
||||
#### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------|----------|----------|-------------| |
||||
| `values` | string[] | No | | |
||||
|
||||
## PieChartLegendOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------|----------|----------|-------------| |
||||
| `values` | string[] | No | | |
||||
|
||||
|
@ -0,0 +1,31 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: StatPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# StatPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------| |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|---------------|--------|----------|-----------------------------------------------------------------------------------| |
||||
| `colorMode` | string | No | TODO docs Possible values are: `value`, `background`, `none`. | |
||||
| `graphMode` | string | No | TODO docs Possible values are: `none`, `line`, `area`. | |
||||
| `justifyMode` | string | No | TODO docs Possible values are: `auto`, `center`. | |
||||
| `textMode` | string | No | TODO docs Possible values are: `auto`, `value`, `value_and_name`, `name`, `none`. | |
||||
|
||||
|
@ -0,0 +1,53 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: TextPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# TextPanelCfg kind |
||||
|
||||
### Maturity: experimental |
||||
### Version: 0.0 |
||||
|
||||
## Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|----------------|-------------------------|----------|-------------------------------------------------------------------------------------------------------------------------------| |
||||
| `CodeLanguage` | string | **Yes** | Possible values are: `plaintext`, `yaml`, `xml`, `typescript`, `sql`, `go`, `markdown`, `html`, `json`. Default: `plaintext`. | |
||||
| `CodeOptions` | [object](#codeoptions) | **Yes** | | |
||||
| `PanelOptions` | [object](#paneloptions) | **Yes** | | |
||||
| `TextMode` | string | **Yes** | Possible values are: `html`, `markdown`, `code`. | |
||||
|
||||
## CodeOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------------|---------|----------|-------------------------------------------------------------------------------------------------------------------------------| |
||||
| `language` | string | **Yes** | Possible values are: `plaintext`, `yaml`, `xml`, `typescript`, `sql`, `go`, `markdown`, `html`, `json`. Default: `plaintext`. | |
||||
| `showLineNumbers` | boolean | **Yes** | Default: `false`. | |
||||
| `showMiniMap` | boolean | **Yes** | Default: `false`. | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-----------|-----------------------------|----------|------------------------------------------------------------------------------------------------------------| |
||||
| `content` | string | **Yes** | Default: `# Title<br/><br/>For markdown syntax help: [commonmark.org/help](https://commonmark.org/help/)`. | |
||||
| `mode` | string | **Yes** | Possible values are: `html`, `markdown`, `code`. | |
||||
| `code` | [CodeOptions](#codeoptions) | No | | |
||||
|
||||
### CodeOptions |
||||
|
||||
#### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------------|---------|----------|-------------------------------------------------------------------------------------------------------------------------------| |
||||
| `language` | string | **Yes** | Possible values are: `plaintext`, `yaml`, `xml`, `typescript`, `sql`, `go`, `markdown`, `html`, `json`. Default: `plaintext`. | |
||||
| `showLineNumbers` | boolean | **Yes** | Default: `false`. | |
||||
| `showMiniMap` | boolean | **Yes** | Default: `false`. | |
||||
|
||||
|
@ -0,0 +1,28 @@ |
||||
package codegen |
||||
|
||||
import ( |
||||
"github.com/grafana/codejen" |
||||
"github.com/grafana/grafana/pkg/plugins/pfs" |
||||
) |
||||
|
||||
func PluginDocsJenny(inner codejen.OneToOne[*pfs.PluginDecl]) codejen.OneToOne[*pfs.PluginDecl] { |
||||
return &docsJenny{ |
||||
inner: inner, |
||||
} |
||||
} |
||||
|
||||
type docsJenny struct { |
||||
inner codejen.OneToOne[*pfs.PluginDecl] |
||||
} |
||||
|
||||
func (j *docsJenny) JennyName() string { |
||||
return "PluginDocsJenny" |
||||
} |
||||
|
||||
func (j *docsJenny) Generate(decl *pfs.PluginDecl) (*codejen.File, error) { |
||||
if !decl.HasSchema() { |
||||
return nil, nil |
||||
} |
||||
|
||||
return j.inner.Generate(decl) |
||||
} |
Loading…
Reference in new issue