Improve Dashboards schema docs (#68904)

Co-authored-by: Dominik Prokop <dominik.prokop@grafana.com>
Co-authored-by: Alexandra Vargas <alexa1866@gmail.com>
Co-authored-by: Ezequiel Victorero <ezequiel.victorero@grafana.com>
This commit is contained in:
Ivan Ortega Alba 2023-05-29 14:15:28 +02:00 committed by GitHub
parent 89088d6aa2
commit cb83861630
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 455 additions and 359 deletions

View File

@ -64,32 +64,32 @@ extraFields is reserved for any fields that are pulled from the API server metad
### Spec
| Property | Type | Required | Default | Description |
|------------------------|---------------------------------------------|----------|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editable` | boolean | **Yes** | `true` | Whether a dashboard is editable or not. |
| `graphTooltip` | integer | **Yes** | `0` | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. |
| `schemaVersion` | uint16 | **Yes** | `36` | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion |
| `style` | string | **Yes** | `dark` | Theme of dashboard.<br/>Possible values are: `dark`, `light`. |
| `annotations` | [AnnotationContainer](#annotationcontainer) | No | | TODO -- should not be a public interface on its own, but required for Veneer |
| `description` | string | No | | Description of dashboard. |
| `fiscalYearStartMonth` | integer | No | `0` | The month that the fiscal year starts on. 0 = January, 11 = December<br/>Constraint: `>=0 & <12`. |
| `gnetId` | string | No | | For dashboards imported from the https://grafana.com/grafana/dashboards/ portal |
| `id` | integer | No | | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? |
| `links` | [DashboardLink](#dashboardlink)[] | No | | TODO docs |
| `liveNow` | boolean | No | | When set to true, the dashboard will redraw panels at an interval matching the pixel width.<br/>This will keep data "moving left" regardless of the query refresh rate. This setting helps<br/>avoid dashboards presenting stale live data |
| `panels` | [object](#panels)[] | No | | |
| `refresh` | | No | | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". |
| `revision` | integer | No | | This property should only be used in dashboards defined by plugins. It is a quick check<br/>to see if the version has changed since the last time. Unclear why using the version property<br/>is insufficient. |
| `snapshot` | [Snapshot](#snapshot) | No | | TODO docs |
| `tags` | string[] | No | | Tags associated with dashboard. |
| `templating` | [object](#templating) | No | | TODO docs |
| `time` | [object](#time) | No | | Time range for dashboard, e.g. last 6 hours, last 7 days, etc |
| `timepicker` | [object](#timepicker) | No | | TODO docs<br/>TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes |
| `timezone` | string | No | `browser` | Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc". |
| `title` | string | No | | Title of dashboard. |
| `uid` | string | No | | Unique dashboard identifier that can be generated by anyone. string (8-40) |
| `version` | uint32 | No | | Version of the dashboard, incremented each time the dashboard is updated. |
| `weekStart` | string | No | | TODO docs |
| Property | Type | Required | Default | Description |
|------------------------|---------------------------------------------|----------|-----------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `editable` | boolean | **Yes** | `true` | Whether a dashboard is editable or not. |
| `graphTooltip` | integer | **Yes** | `0` | 0 for no shared crosshair or tooltip (default).<br/>1 for shared crosshair.<br/>2 for shared crosshair AND shared tooltip.<br/>Possible values are: `0`, `1`, `2`. |
| `schemaVersion` | uint16 | **Yes** | `36` | Version of the JSON schema, incremented each time a Grafana update brings<br/>changes to said schema.<br/>TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion |
| `style` | string | **Yes** | `dark` | Theme of dashboard.<br/>Possible values are: `dark`, `light`. |
| `annotations` | [AnnotationContainer](#annotationcontainer) | No | | TODO -- should not be a public interface on its own, but required for Veneer |
| `description` | string | No | | Description of dashboard. |
| `fiscalYearStartMonth` | integer | No | `0` | The month that the fiscal year starts on. 0 = January, 11 = December<br/>Constraint: `>=0 & <12`. |
| `gnetId` | string | No | | ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal |
| `id` | integer | No | | Unique numeric identifier for the dashboard.<br/>TODO must isolate or remove identifiers local to a Grafana instance...? |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Links with references to other dashboards or external websites. |
| `liveNow` | boolean | No | | When set to true, the dashboard will redraw panels at an interval matching the pixel width.<br/>This will keep data "moving left" regardless of the query refresh rate. This setting helps<br/>avoid dashboards presenting stale live data |
| `panels` | [object](#panels)[] | No | | |
| `refresh` | | No | | Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d". |
| `revision` | integer | No | | This property should only be used in dashboards defined by plugins. It is a quick check<br/>to see if the version has changed since the last time. Unclear why using the version property<br/>is insufficient. |
| `snapshot` | [Snapshot](#snapshot) | No | | A dashboard snapshot shares an interactive dashboard publicly.<br/>It is a read-only version of a dashboard, and is not editable.<br/>It is possible to create a snapshot of a snapshot.<br/>Grafana strips away all sensitive information from the dashboard.<br/>Sensitive information stripped: queries (metric, template,annotation) and panel links. |
| `tags` | string[] | No | | Tags associated with dashboard. |
| `templating` | [object](#templating) | No | | Contains the list of configured template variables with their saved values along with some other metadata |
| `time` | [object](#time) | No | | Time range for dashboard.<br/>Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}. |
| `timepicker` | [object](#timepicker) | No | | Configuration of the time picker shown at the top of a dashboard. |
| `timezone` | string | No | `browser` | Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc". |
| `title` | string | No | | Title of dashboard. |
| `uid` | string | No | | Unique dashboard identifier that can be generated by anyone. string (8-40) |
| `version` | uint32 | No | | Version of the dashboard, incremented each time the dashboard is updated. |
| `weekStart` | string | No | | Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday". |
### AnnotationContainer
@ -106,7 +106,7 @@ FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
| Property | Type | Required | Default | Description |
|--------------|-------------------------------------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `datasource` | [object](#datasource) | **Yes** | | TODO: Should be DataSourceRef |
| `datasource` | [DataSourceRef](#datasourceref) | **Yes** | | Ref to a DataSource instance |
| `enable` | boolean | **Yes** | `true` | When enabled the annotation query is issued with every dashboard refresh |
| `iconColor` | string | **Yes** | | Color to use for the annotation event markers |
| `name` | string | **Yes** | | Name of annotation. |
@ -134,50 +134,53 @@ these match the properties of the "grafana" datasouce that is default in most da
| `tags` | string[] | **Yes** | | Only required/valid for the grafana datasource...<br/>but code+tests is already depending on it so hard to change |
| `type` | string | **Yes** | | Only required/valid for the grafana datasource...<br/>but code+tests is already depending on it so hard to change |
### Datasource
### DataSourceRef
TODO: Should be DataSourceRef
Ref to a DataSource instance
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|-------------|
| `type` | string | No | | |
| `uid` | string | No | | |
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|------------------------------|
| `type` | string | No | | The plugin type-id |
| `uid` | string | No | | Specific datasource instance |
### DashboardLink
FROM public/app/features/dashboard/state/DashboardModels.ts - ish
TODO docs
Links with references to other dashboards or external resources
| Property | Type | Required | Default | Description |
|---------------|----------|----------|---------|----------------------------------------------------------|
| `asDropdown` | boolean | **Yes** | `false` | |
| `icon` | string | **Yes** | | |
| `includeVars` | boolean | **Yes** | `false` | |
| `keepTime` | boolean | **Yes** | `false` | |
| `tags` | string[] | **Yes** | | |
| `targetBlank` | boolean | **Yes** | `false` | |
| `title` | string | **Yes** | | |
| `tooltip` | string | **Yes** | | |
| `type` | string | **Yes** | | TODO docs<br/>Possible values are: `link`, `dashboards`. |
| `url` | string | **Yes** | | |
| Property | Type | Required | Default | Description |
|---------------|----------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `asDropdown` | boolean | **Yes** | `false` | If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards |
| `icon` | string | **Yes** | | Icon name to be displayed with the link |
| `includeVars` | boolean | **Yes** | `false` | If true, includes current template variables values in the link as query params |
| `keepTime` | boolean | **Yes** | `false` | If true, includes current time range in the link as query params |
| `tags` | string[] | **Yes** | | List of tags to limit the linked dashboards. If empty, all dashboards will be displayed. Only valid if the type is dashboards |
| `targetBlank` | boolean | **Yes** | `false` | If true, the link will be opened in a new tab |
| `title` | string | **Yes** | | Title to display with the link |
| `tooltip` | string | **Yes** | | Tooltip to display when the user hovers their mouse over it |
| `type` | string | **Yes** | | Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)<br/>Possible values are: `link`, `dashboards`. |
| `url` | string | **Yes** | | Link URL. Only required/valid if the type is link |
### Snapshot
TODO docs
A dashboard snapshot shares an interactive dashboard publicly.
It is a read-only version of a dashboard, and is not editable.
It is possible to create a snapshot of a snapshot.
Grafana strips away all sensitive information from the dashboard.
Sensitive information stripped: queries (metric, template,annotation) and panel links.
| Property | Type | Required | Default | Description |
|---------------|---------|----------|---------|-------------|
| `created` | string | **Yes** | | TODO docs |
| `expires` | string | **Yes** | | TODO docs |
| `externalUrl` | string | **Yes** | | TODO docs |
| `external` | boolean | **Yes** | | TODO docs |
| `id` | uint32 | **Yes** | | TODO docs |
| `key` | string | **Yes** | | TODO docs |
| `name` | string | **Yes** | | TODO docs |
| `orgId` | uint32 | **Yes** | | TODO docs |
| `updated` | string | **Yes** | | TODO docs |
| `userId` | uint32 | **Yes** | | TODO docs |
| `url` | string | No | | TODO docs |
| Property | Type | Required | Default | Description |
|---------------|---------|----------|---------|--------------------------------------------------------------------------------|
| `created` | string | **Yes** | | Time when the snapshot was created |
| `expires` | string | **Yes** | | Time when the snapshot expires, default is never to expire |
| `externalUrl` | string | **Yes** | | external url, if snapshot was shared in external grafana instance |
| `external` | boolean | **Yes** | | Is the snapshot saved in an external grafana instance |
| `id` | uint32 | **Yes** | | Unique identifier of the snapshot |
| `key` | string | **Yes** | | Optional, defined the unique key of the snapshot, required if external is true |
| `name` | string | **Yes** | | Optional, name of the snapshot |
| `orgId` | uint32 | **Yes** | | org id of the snapshot |
| `updated` | string | **Yes** | | last time when the snapshot was updated |
| `userId` | uint32 | **Yes** | | user id of the snapshot creator |
| `url` | string | No | | url of the snapshot, if snapshot was shared internally |
### Panels
@ -243,25 +246,26 @@ TODO docs
### ThresholdsConfig
| Property | Type | Required | Default | Description |
|----------|---------------------------|----------|---------|------------------------------------------------------------|
| `mode` | string | **Yes** | | Possible values are: `absolute`, `percentage`. |
| `steps` | [Threshold](#threshold)[] | **Yes** | | Must be sorted by 'value', first value is always -Infinity |
| Property | Type | Required | Default | Description |
|----------|---------------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------|
| `mode` | string | **Yes** | | Thresholds can either be absolute (specific number) or percentage (relative to min or max).<br/>Possible values are: `absolute`, `percentage`. |
| `steps` | [Threshold](#threshold)[] | **Yes** | | Must be sorted by 'value', first value is always -Infinity |
### Threshold
TODO docs
User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------|
| `color` | string | **Yes** | | TODO docs |
| `index` | integer | No | | Threshold index, an old property that is not needed an should only appear in older dashboards |
| `state` | string | No | | TODO docs<br/>TODO are the values here enumerable into a disjunction?<br/>Some seem to be listed in typescript comment |
| `value` | number | No | | TODO docs<br/>FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON |
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `color` | string | **Yes** | | Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded. |
| `index` | integer | No | | Threshold index, an old property that is not needed an should only appear in older dashboards |
| `state` | string | No | | TODO docs<br/>TODO are the values here enumerable into a disjunction?<br/>Some seem to be listed in typescript comment |
| `value` | number | No | | Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.<br/>FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON |
### ValueMapping
TODO docs
Allow to transform the visual representation of specific data values in a visualization, irrespective of their original units
| Property | Type | Required | Default | Description |
|----------|-------------------------------------------------------------------------------------------------------------------------------|----------|---------|-------------|
@ -269,7 +273,7 @@ TODO docs
### RangeMap
TODO docs
Maps numeric ranges to a color or different display text
| Property | Type | Required | Default | Description |
|-----------|--------------------|----------|---------|-------------|
@ -281,12 +285,12 @@ TODO docs
| Property | Type | Required | Default | Description |
|----------|-------------------------------------------|----------|---------|--------------------------------------------------------------------------------|
| `from` | number | **Yes** | | to and from are `number &#124; null` in current ts, really not sure what to do |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | TODO docs |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
| `to` | number | **Yes** | | |
### ValueMappingResult
TODO docs
Result used as replacement text and color for RegexMap and SpecialValueMap
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|-------------|
@ -297,7 +301,7 @@ TODO docs
### RegexMap
TODO docs
Maps regular expressions to replacement text and a color
| Property | Type | Required | Default | Description |
|-----------|--------------------|----------|---------|-------------|
@ -306,14 +310,15 @@ TODO docs
### Options
| Property | Type | Required | Default | Description |
|-----------|-------------------------------------------|----------|---------|-------------|
| `pattern` | string | **Yes** | | |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | TODO docs |
| Property | Type | Required | Default | Description |
|-----------|-------------------------------------------|----------|---------|----------------------------------------------------------------------------|
| `pattern` | string | **Yes** | | |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
### SpecialValueMap
TODO docs
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
and color
| Property | Type | Required | Default | Description |
|-----------|--------------------|----------|---------|-------------|
@ -322,15 +327,15 @@ TODO docs
### Options
| Property | Type | Required | Default | Description |
|-----------|-------------------------------------------|----------|---------|---------------------------------------|
| `match` | string | **Yes** | | Possible values are: `true`, `false`. |
| `pattern` | string | **Yes** | | |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | TODO docs |
| Property | Type | Required | Default | Description |
|-----------|-------------------------------------------|----------|---------|----------------------------------------------------------------------------|
| `match` | string | **Yes** | | Possible values are: `true`, `false`. |
| `pattern` | string | **Yes** | | |
| `result` | [ValueMappingResult](#valuemappingresult) | **Yes** | | Result used as replacement text and color for RegexMap and SpecialValueMap |
### ValueMap
TODO docs
Maps text values to a color or different display text
| Property | Type | Required | Default | Description |
|-----------|------------------------------------------------------|----------|---------|-------------|
@ -380,13 +385,13 @@ Support for legacy graph and heatmap panels.
### GridPos
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|--------------------------------------|
| `h` | uint32 | **Yes** | `9` | Panel |
| `w` | integer | **Yes** | `12` | Panel<br/>Constraint: `>0 & <=24`. |
| `x` | integer | **Yes** | `0` | Panel x<br/>Constraint: `>=0 & <24`. |
| `y` | uint32 | **Yes** | `0` | Panel y |
| `static` | boolean | No | | true if fixed |
| Property | Type | Required | Default | Description |
|----------|---------|----------|---------|--------------------------------------------|
| `h` | uint32 | **Yes** | `9` | Panel |
| `w` | integer | **Yes** | `12` | Panel<br/>Constraint: `>0 & <=24`. |
| `x` | integer | **Yes** | `0` | Panel x<br/>Constraint: `>=0 & <24`. |
| `y` | uint32 | **Yes** | `0` | Panel y |
| `static` | boolean | No | | Whether the panel is fixed within the grid |
### HeatmapPanel
@ -407,32 +412,32 @@ Dashboard panels. Panels are canonically defined inline
because they share a version timeline with the dashboard
schema; they do not evolve independently.
| Property | Type | Required | Default | Description |
|-------------------|---------------------------------------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
| `options` | [object](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
| `datasource` | [object](#datasource) | No | | The datasource used in all targets. |
| `description` | string | No | | Description. |
| `gridPos` | [GridPos](#gridpos) | No | | |
| `id` | uint32 | No | | TODO docs |
| `interval` | string | No | | TODO docs<br/>TODO tighter constraint |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
| `maxDataPoints` | number | No | | TODO docs |
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | TODO docs |
| `targets` | [Target](#target)[] | No | | TODO docs |
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
| `timeFrom` | string | No | | TODO docs<br/>TODO tighter constraint |
| `timeRegions` | | No | | TODO docs |
| `timeShift` | string | No | | TODO docs<br/>TODO tighter constraint |
| `title` | string | No | | Panel title. |
| Property | Type | Required | Default | Description |
|-------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
| `options` | [object](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
| `datasource` | [object](#datasource) | No | | The datasource used in all targets. |
| `description` | string | No | | Description. |
| `gridPos` | [GridPos](#gridpos) | No | | |
| `id` | uint32 | No | | TODO docs |
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | TODO docs |
| `targets` | [Target](#target)[] | No | | TODO docs |
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeRegions` | | No | | TODO docs |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `title` | string | No | | Panel title. |
### FieldConfigSource
@ -464,7 +469,7 @@ schema; they do not evolve independently.
### RangeMap
TODO docs
Maps numeric ranges to a color or different display text
| Property | Type | Required | Default | Description |
|-----------|---------------------|----------|---------|-------------|
@ -473,7 +478,7 @@ TODO docs
### RegexMap
TODO docs
Maps regular expressions to replacement text and a color
| Property | Type | Required | Default | Description |
|-----------|---------------------|----------|---------|-------------|
@ -482,7 +487,8 @@ TODO docs
### SpecialValueMap
TODO docs
Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
and color
| Property | Type | Required | Default | Description |
|-----------|---------------------|----------|---------|-------------|
@ -564,36 +570,36 @@ Dashboard panels. Panels are canonically defined inline
because they share a version timeline with the dashboard
schema; they do not evolve independently.
| Property | Type | Required | Default | Description |
|-------------------|---------------------------------------------------|----------|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
| `options` | [options](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
| `datasource` | [datasource](#datasource) | No | | The datasource used in all targets. |
| `description` | string | No | | Description. |
| `gridPos` | [GridPos](#gridpos) | No | | |
| `id` | uint32 | No | | TODO docs |
| `interval` | string | No | | TODO docs<br/>TODO tighter constraint |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
| `maxDataPoints` | number | No | | TODO docs |
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | TODO docs |
| `targets` | [Target](#target)[] | No | | TODO docs |
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
| `timeFrom` | string | No | | TODO docs<br/>TODO tighter constraint |
| `timeRegions` | | No | | TODO docs |
| `timeShift` | string | No | | TODO docs<br/>TODO tighter constraint |
| `title` | string | No | | Panel title. |
| Property | Type | Required | Default | Description |
|-------------------|---------------------------------------------------|----------|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fieldConfig` | [FieldConfigSource](#fieldconfigsource) | **Yes** | | |
| `options` | [options](#options) | **Yes** | | options is specified by the Options field in panel<br/>plugin schemas. |
| `repeatDirection` | string | **Yes** | `h` | Direction to repeat in if 'repeat' is set.<br/>"h" for horizontal, "v" for vertical.<br/>TODO this is probably optional<br/>Possible values are: `h`, `v`. |
| `transformations` | [DataTransformerConfig](#datatransformerconfig)[] | **Yes** | | |
| `transparent` | boolean | **Yes** | `false` | Whether to display the panel without a background. |
| `type` | string | **Yes** | | The panel plugin type id. May not be empty.<br/>Constraint: `length >=1`. |
| `datasource` | [datasource](#datasource) | No | | The datasource used in all targets. |
| `description` | string | No | | Description. |
| `gridPos` | [GridPos](#gridpos) | No | | |
| `id` | uint32 | No | | TODO docs |
| `interval` | string | No | | The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.<br/>This value must be formatted as a number followed by a valid time<br/>identifier like: "40s", "3d", etc.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `libraryPanel` | [LibraryPanelRef](#librarypanelref) | No | | |
| `links` | [DashboardLink](#dashboardlink)[] | No | | Panel links.<br/>TODO fill this out - seems there are a couple variants? |
| `maxDataPoints` | number | No | | The maximum number of data points that the panel queries are retrieving. |
| `pluginVersion` | string | No | | FIXME this almost certainly has to be changed in favor of scuemata versions |
| `repeatPanelId` | integer | No | | Id of the repeating panel. |
| `repeat` | string | No | | Name of template variable to repeat for. |
| `tags` | string[] | No | | TODO docs |
| `targets` | [Target](#target)[] | No | | TODO docs |
| `thresholds` | | No | | TODO docs - seems to be an old field from old dashboard alerts? |
| `timeFrom` | string | No | | Overrides the relative time range for individual panels,<br/>which causes them to be different than what is selected in<br/>the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different<br/>time periods or days on the same dashboard.<br/>The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),<br/>`now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `timeRegions` | | No | | TODO docs |
| `timeShift` | string | No | | Overrides the time range for individual panels by shifting its start and end relative to the time picker.<br/>For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.<br/>Note: Panel time overrides have no effect when the dashboards time range is absolute.<br/>See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options |
| `title` | string | No | | Panel title. |
### Templating
TODO docs
Contains the list of configured template variables with their saved values along with some other metadata
| Property | Type | Required | Default | Description |
|----------|-----------------------------------|----------|---------|-------------|
@ -623,15 +629,6 @@ TODO there appear to be a lot of different kinds of [template] vars here? if so
| `query` | | No | | TODO: Move this into a separated QueryVariableModel type |
| `rootStateKey` | string | No | | |
### DataSourceRef
Ref to a DataSource instance
| Property | Type | Required | Default | Description |
|----------|--------|----------|---------|------------------------------|
| `type` | string | No | | The plugin type-id |
| `uid` | string | No | | Specific datasource instance |
### Error
| Property | Type | Required | Default | Description |
@ -639,7 +636,8 @@ Ref to a DataSource instance
### Time
Time range for dashboard, e.g. last 6 hours, last 7 days, etc
Time range for dashboard.
Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}.
| Property | Type | Required | Default | Description |
|----------|--------|----------|----------|-------------|
@ -648,16 +646,15 @@ Time range for dashboard, e.g. last 6 hours, last 7 days, etc
### Timepicker
TODO docs
TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
Configuration of the time picker shown at the top of a dashboard.
| Property | Type | Required | Default | Description |
|---------------------|----------|----------|---------------------------------------|-----------------------------------------|
| `collapse` | boolean | **Yes** | `false` | Whether timepicker is collapsed or not. |
| `enable` | boolean | **Yes** | `true` | Whether timepicker is enabled or not. |
| `hidden` | boolean | **Yes** | `false` | Whether timepicker is visible or not. |
| `refresh_intervals` | string[] | **Yes** | `[5s 10s 30s 1m 5m 15m 30m 1h 2h 1d]` | Selectable intervals for auto-refresh. |
| `time_options` | string[] | **Yes** | `[5m 15m 1h 6h 12h 24h 2d 7d 30d]` | TODO docs |
| Property | Type | Required | Default | Description |
|---------------------|----------|----------|---------------------------------------|---------------------------------------------------------------------------------------------------|
| `collapse` | boolean | **Yes** | `false` | Whether timepicker is collapsed or not. Has no effect on provisioned dashboard. |
| `enable` | boolean | **Yes** | `true` | Whether timepicker is enabled or not. Has no effect on provisioned dashboard. |
| `hidden` | boolean | **Yes** | `false` | Whether timepicker is visible or not. |
| `refresh_intervals` | string[] | **Yes** | `[5s 10s 30s 1m 5m 15m 30m 1h 2h 1d]` | Interval options available in the refresh picker dropdown. |
| `time_options` | string[] | **Yes** | `[5m 15m 1h 6h 12h 24h 2d 7d 30d]` | Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard. |
### Status

View File

@ -28,36 +28,37 @@ lineage: schemas: [{
// to see if the version has changed since the last time. Unclear why using the version property
// is insufficient.
revision?: int64 @grafanamaturity(NeedsExpertReview)
// For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
// ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal
gnetId?: string @grafanamaturity(NeedsExpertReview)
// Tags associated with dashboard.
tags?: [...string] @grafanamaturity(NeedsExpertReview)
// Theme of dashboard.
style: "light" | *"dark" @grafanamaturity(NeedsExpertReview)
// Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
// Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc".
timezone?: string | *"browser"
// Whether a dashboard is editable or not.
editable: bool | *true
// Configuration of dashboard cursor sync behavior.
// Accepted values are 0 (sync turned off), 1 (shared crosshair), 2 (shared crosshair and tooltip).
graphTooltip: #DashboardCursorSync
// Time range for dashboard, e.g. last 6 hours, last 7 days, etc
// Time range for dashboard.
// Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}.
time?: {
from: string | *"now-6h"
to: string | *"now"
} @grafanamaturity(NeedsExpertReview)
// TODO docs
// TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
// Configuration of the time picker shown at the top of a dashboard.
timepicker?: {
// Whether timepicker is collapsed or not.
collapse: bool | *false
// Whether timepicker is enabled or not.
enable: bool | *true
// Whether timepicker is visible or not.
hidden: bool | *false
// Selectable intervals for auto-refresh.
// Interval options available in the refresh picker dropdown.
refresh_intervals: [...string] | *["5s", "10s", "30s", "1m", "5m", "15m", "30m", "1h", "2h", "1d"]
// TODO docs
// Whether timepicker is collapsed or not. Has no effect on provisioned dashboard.
collapse: bool | *false
// Whether timepicker is enabled or not. Has no effect on provisioned dashboard.
enable: bool | *true
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
time_options: [...string] | *["5m", "15m", "1h", "6h", "12h", "24h", "2d", "7d", "30d"]
} @grafanamaturity(NeedsExpertReview)
// The month that the fiscal year starts on. 0 = January, 11 = December
@ -66,8 +67,8 @@ lineage: schemas: [{
// This will keep data "moving left" regardless of the query refresh rate. This setting helps
// avoid dashboards presenting stale live data
liveNow?: bool @grafanamaturity(NeedsExpertReview)
// TODO docs
weekStart?: string @grafanamaturity(NeedsExpertReview)
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
weekStart?: string
// Refresh rate of dashboard. Represented via interval string, e.g. "5s", "1m", "1h", "1d".
refresh?: string | false
@ -78,7 +79,7 @@ lineage: schemas: [{
// Version of the dashboard, incremented each time the dashboard is updated.
version?: uint32 @grafanamaturity(NeedsExpertReview)
panels?: [...(#Panel | #RowPanel | #GraphPanel | #HeatmapPanel)] @grafanamaturity(NeedsExpertReview)
// TODO docs
// Contains the list of configured template variables with their saved values along with some other metadata
templating?: {
list?: [...#VariableModel] @grafanamaturity(NeedsExpertReview)
}
@ -86,7 +87,7 @@ lineage: schemas: [{
// TODO docs
annotations?: #AnnotationContainer
// TODO docs
// Links with references to other dashboards or external websites.
links?: [...#DashboardLink] @grafanamaturity(NeedsExpertReview)
snapshot?: #Snapshot @grafanamaturity(NeedsExpertReview)
@ -137,11 +138,8 @@ lineage: schemas: [{
// Name of annotation.
name: string
// TODO: Should be DataSourceRef
datasource: {
type?: string
uid?: string
} @grafanamaturity(NeedsExpertReview)
// Datasource where the annotations data is
datasource: #DataSourceRef
// When enabled the annotation query is issued with every dashboard refresh
enable: bool | *true
@ -153,7 +151,7 @@ lineage: schemas: [{
// Color to use for the annotation event markers
iconColor: string
// Optionally
// Filters to apply when fetching annotations
filter?: #AnnotationPanelFilter
// TODO.. this should just be a normal query target
@ -203,22 +201,31 @@ lineage: schemas: [{
uid?: string @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface") @grafana(TSVeneer="type") @grafanamaturity(NeedsExpertReview)
// FROM public/app/features/dashboard/state/DashboardModels.ts - ish
// TODO docs
// Links with references to other dashboards or external resources
#DashboardLink: {
title: string @grafanamaturity(NeedsExpertReview)
type: #DashboardLinkType @grafanamaturity(NeedsExpertReview)
icon: string @grafanamaturity(NeedsExpertReview)
tooltip: string @grafanamaturity(NeedsExpertReview)
url: string @grafanamaturity(NeedsExpertReview)
// Title to display with the link
title: string @grafanamaturity(NeedsExpertReview)
// Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
type: #DashboardLinkType @grafanamaturity(NeedsExpertReview)
// Icon name to be displayed with the link
icon: string @grafanamaturity(NeedsExpertReview)
// Tooltip to display when the user hovers their mouse over it
tooltip: string @grafanamaturity(NeedsExpertReview)
// Link URL. Only required/valid if the type is link
url: string @grafanamaturity(NeedsExpertReview)
// List of tags to limit the linked dashboards. If empty, all dashboards will be displayed. Only valid if the type is dashboards
tags: [...string] @grafanamaturity(NeedsExpertReview)
asDropdown: bool | *false @grafanamaturity(NeedsExpertReview)
// If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards
asDropdown: bool | *false @grafanamaturity(NeedsExpertReview)
// If true, the link will be opened in a new tab
targetBlank: bool | *false @grafanamaturity(NeedsExpertReview)
// If true, includes current template variables values in the link as query params
includeVars: bool | *false @grafanamaturity(NeedsExpertReview)
keepTime: bool | *false @grafanamaturity(NeedsExpertReview)
// If true, includes current time range in the link as query params
keepTime: bool | *false @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface")
// TODO docs
// Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
#DashboardLinkType: "link" | "dashboards" @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
// FROM: packages/grafana-data/src/types/templateVars.ts
@ -251,16 +258,17 @@ lineage: schemas: [{
x: uint32 & >=0 & <24 | *0 @grafanamaturity(NeedsExpertReview)
// Panel y
y: uint32 & >=0 | *0 @grafanamaturity(NeedsExpertReview)
// true if fixed
// Whether the panel is fixed within the grid
static?: bool @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface")
// TODO docs
// User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
// They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
#Threshold: {
// TODO docs
// Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
// FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
value?: number @grafanamaturity(NeedsExpertReview)
// TODO docs
// Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
color: string @grafanamaturity(NeedsExpertReview)
// Threshold index, an old property that is not needed an should only appear in older dashboards
index?: int32 @grafanamaturity(NeedsExpertReview)
@ -270,6 +278,7 @@ lineage: schemas: [{
state?: string @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
#ThresholdsMode: "absolute" | "percentage" @cuetsy(kind="enum") @grafanamaturity(NeedsExpertReview)
#ThresholdsConfig: {
@ -279,19 +288,19 @@ lineage: schemas: [{
steps: [...#Threshold] @grafanamaturity(NeedsExpertReview)
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Allow to transform the visual representation of specific data values in a visualization, irrespective of their original units
#ValueMapping: #ValueMap | #RangeMap | #RegexMap | #SpecialValueMap @cuetsy(kind="type") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Supported value mapping types
#MappingType: "value" | "range" | "regex" | "special" @cuetsy(kind="enum",memberNames="ValueToText|RangeToText|RegexToText|SpecialValue") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Maps text values to a color or different display text
#ValueMap: {
type: #MappingType & "value"
options: [string]: #ValueMappingResult
} @cuetsy(kind="interface")
// TODO docs
// Maps numeric ranges to a color or different display text
#RangeMap: {
type: #MappingType & "range"
options: {
@ -302,7 +311,7 @@ lineage: schemas: [{
}
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Maps regular expressions to replacement text and a color
#RegexMap: {
type: #MappingType & "regex"
options: {
@ -311,7 +320,8 @@ lineage: schemas: [{
}
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
// and color
#SpecialValueMap: {
type: #MappingType & "special"
options: {
@ -321,10 +331,10 @@ lineage: schemas: [{
}
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
// TODO docs
// Special value types supported by the SpecialValueMap
#SpecialValueMatch: "true" | "false" | "null" | "nan" | "null+nan" | "empty" @cuetsy(kind="enum",memberNames="True|False|Null|NaN|NullAndNan|Empty")
// TODO docs
// Result used as replacement text and color for RegexMap and SpecialValueMap
#ValueMappingResult: {
text?: string
color?: string
@ -361,29 +371,33 @@ lineage: schemas: [{
// type directly to achieve the same effect.
#Target: {...} @grafanamaturity(NeedsExpertReview)
// TODO docs
// A dashboard snapshot shares an interactive dashboard publicly.
// It is a read-only version of a dashboard, and is not editable.
// It is possible to create a snapshot of a snapshot.
// Grafana strips away all sensitive information from the dashboard.
// Sensitive information stripped: queries (metric, template,annotation) and panel links.
#Snapshot: {
// TODO docs
// Time when the snapshot was created
created: string & t.Time
// TODO docs
// Time when the snapshot expires, default is never to expire
expires: string @grafanamaturity(NeedsExpertReview)
// TODO docs
// Is the snapshot saved in an external grafana instance
external: bool @grafanamaturity(NeedsExpertReview)
// TODO docs
// external url, if snapshot was shared in external grafana instance
externalUrl: string @grafanamaturity(NeedsExpertReview)
// TODO docs
// Unique identifier of the snapshot
id: uint32 @grafanamaturity(NeedsExpertReview)
// TODO docs
// Optional, defined the unique key of the snapshot, required if external is true
key: string @grafanamaturity(NeedsExpertReview)
// TODO docs
// Optional, name of the snapshot
name: string @grafanamaturity(NeedsExpertReview)
// TODO docs
// org id of the snapshot
orgId: uint32 @grafanamaturity(NeedsExpertReview)
// TODO docs
// last time when the snapshot was updated
updated: string & t.Time
// TODO docs
// url of the snapshot, if snapshot was shared internally
url?: string @grafanamaturity(NeedsExpertReview)
// TODO docs
// user id of the snapshot creator
userId: uint32 @grafanamaturity(NeedsExpertReview)
} @grafanamaturity(NeedsExpertReview)
@ -432,8 +446,8 @@ lineage: schemas: [{
// Id of the repeating panel.
repeatPanelId?: int64 @grafanamaturity(NeedsExpertReview)
// TODO docs
maxDataPoints?: number @grafanamaturity(NeedsExpertReview)
// The maximum number of data points that the panel queries are retrieving.
maxDataPoints?: number
// TODO docs - seems to be an old field from old dashboard alerts?
thresholds?: [...] @grafanamaturity(NeedsExpertReview)
@ -443,17 +457,27 @@ lineage: schemas: [{
transformations: [...#DataTransformerConfig] @grafanamaturity(NeedsExpertReview)
// TODO docs
// TODO tighter constraint
interval?: string @grafanamaturity(NeedsExpertReview)
// The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.
// This value must be formatted as a number followed by a valid time
// identifier like: "40s", "3d", etc.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
interval?: string
// TODO docs
// TODO tighter constraint
timeFrom?: string @grafanamaturity(NeedsExpertReview)
// Overrides the relative time range for individual panels,
// which causes them to be different than what is selected in
// the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
// time periods or days on the same dashboard.
// The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),
// `now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).
// Note: Panel time overrides have no effect when the dashboards time range is absolute.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
timeFrom?: string
// TODO docs
// TODO tighter constraint
timeShift?: string @grafanamaturity(NeedsExpertReview)
// Overrides the time range for individual panels by shifting its start and end relative to the time picker.
// For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
// Note: Panel time overrides have no effect when the dashboards time range is absolute.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
timeShift?: string
// Dynamically load the panel
libraryPanel?: #LibraryPanelRef
@ -580,6 +604,5 @@ lineage: schemas: [{
...
} @cuetsy(kind="interface") @grafanamaturity(NeedsExpertReview)
}
},
]

View File

@ -72,18 +72,15 @@ export const defaultAnnotationContainer: Partial<AnnotationContainer> = {
*/
export interface AnnotationQuery {
/**
* TODO: Should be DataSourceRef
* Datasource where the annotations data is
*/
datasource: {
type?: string;
uid?: string;
};
datasource: DataSourceRef;
/**
* When enabled the annotation query is issued with every dashboard refresh
*/
enable: boolean;
/**
* Optionally
* Filters to apply when fetching annotations
*/
filter?: AnnotationPanelFilter;
/**
@ -176,19 +173,48 @@ export interface DataSourceRef {
}
/**
* FROM public/app/features/dashboard/state/DashboardModels.ts - ish
* TODO docs
* Links with references to other dashboards or external resources
*/
export interface DashboardLink {
/**
* If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards
*/
asDropdown: boolean;
/**
* Icon name to be displayed with the link
*/
icon: string;
/**
* If true, includes current template variables values in the link as query params
*/
includeVars: boolean;
/**
* If true, includes current time range in the link as query params
*/
keepTime: boolean;
/**
* List of tags to limit the linked dashboards. If empty, all dashboards will be displayed. Only valid if the type is dashboards
*/
tags: Array<string>;
/**
* If true, the link will be opened in a new tab
*/
targetBlank: boolean;
/**
* Title to display with the link
*/
title: string;
/**
* Tooltip to display when the user hovers their mouse over it
*/
tooltip: string;
/**
* Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
*/
type: DashboardLinkType;
/**
* Link URL. Only required/valid if the type is link
*/
url: string;
}
@ -201,7 +227,7 @@ export const defaultDashboardLink: Partial<DashboardLink> = {
};
/**
* TODO docs
* Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
*/
export type DashboardLinkType = ('link' | 'dashboards');
@ -252,7 +278,7 @@ export interface GridPos {
*/
h: number;
/**
* true if fixed
* Whether the panel is fixed within the grid
*/
static?: boolean;
/**
@ -277,11 +303,12 @@ export const defaultGridPos: Partial<GridPos> = {
};
/**
* TODO docs
* User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
* They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
*/
export interface Threshold {
/**
* TODO docs
* Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
*/
color: string;
/**
@ -295,12 +322,15 @@ export interface Threshold {
*/
state?: string;
/**
* TODO docs
* Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
* FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
*/
value?: number;
}
/**
* Thresholds can either be absolute (specific number) or percentage (relative to min or max).
*/
export enum ThresholdsMode {
Absolute = 'absolute',
Percentage = 'percentage',
@ -319,12 +349,12 @@ export const defaultThresholdsConfig: Partial<ThresholdsConfig> = {
};
/**
* TODO docs
* Allow to transform the visual representation of specific data values in a visualization, irrespective of their original units
*/
export type ValueMapping = (ValueMap | RangeMap | RegexMap | SpecialValueMap);
/**
* TODO docs
* Supported value mapping types
*/
export enum MappingType {
RangeToText = 'range',
@ -334,7 +364,7 @@ export enum MappingType {
}
/**
* TODO docs
* Maps text values to a color or different display text
*/
export interface ValueMap {
options: Record<string, ValueMappingResult>;
@ -342,7 +372,7 @@ export interface ValueMap {
}
/**
* TODO docs
* Maps numeric ranges to a color or different display text
*/
export interface RangeMap {
options: {
@ -357,7 +387,7 @@ export interface RangeMap {
}
/**
* TODO docs
* Maps regular expressions to replacement text and a color
*/
export interface RegexMap {
options: {
@ -368,7 +398,8 @@ export interface RegexMap {
}
/**
* TODO docs
* Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
* and color
*/
export interface SpecialValueMap {
options: {
@ -380,7 +411,7 @@ export interface SpecialValueMap {
}
/**
* TODO docs
* Special value types supported by the SpecialValueMap
*/
export enum SpecialValueMatch {
Empty = 'empty',
@ -392,7 +423,7 @@ export enum SpecialValueMatch {
}
/**
* TODO docs
* Result used as replacement text and color for RegexMap and SpecialValueMap
*/
export interface ValueMappingResult {
color?: string;
@ -464,8 +495,10 @@ export interface Panel {
*/
id?: number;
/**
* TODO docs
* TODO tighter constraint
* The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.
* This value must be formatted as a number followed by a valid time
* identifier like: "40s", "3d", etc.
* See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
*/
interval?: string;
/**
@ -478,7 +511,7 @@ export interface Panel {
*/
links?: Array<DashboardLink>;
/**
* TODO docs
* The maximum number of data points that the panel queries are retrieving.
*/
maxDataPoints?: number;
/**
@ -517,8 +550,14 @@ export interface Panel {
*/
thresholds?: Array<unknown>;
/**
* TODO docs
* TODO tighter constraint
* Overrides the relative time range for individual panels,
* which causes them to be different than what is selected in
* the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
* time periods or days on the same dashboard.
* The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),
* `now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).
* Note: Panel time overrides have no effect when the dashboards time range is absolute.
* See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
*/
timeFrom?: string;
/**
@ -526,8 +565,10 @@ export interface Panel {
*/
timeRegions?: Array<unknown>;
/**
* TODO docs
* TODO tighter constraint
* Overrides the time range for individual panels by shifting its start and end relative to the time picker.
* For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
* Note: Panel time overrides have no effect when the dashboards time range is absolute.
* See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
*/
timeShift?: string;
/**
@ -722,11 +763,12 @@ export interface Dashboard {
*/
fiscalYearStartMonth?: number;
/**
* For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
* ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal
*/
gnetId?: string;
/**
* Configuration of dashboard cursor sync behavior.
* Accepted values are 0 (sync turned off), 1 (shared crosshair), 2 (shared crosshair and tooltip).
*/
graphTooltip: DashboardCursorSync;
/**
@ -735,7 +777,7 @@ export interface Dashboard {
*/
id?: number;
/**
* TODO docs
* Links with references to other dashboards or external websites.
*/
links?: Array<DashboardLink>;
/**
@ -763,47 +805,47 @@ export interface Dashboard {
schemaVersion: number;
snapshot?: {
/**
* TODO docs
* Time when the snapshot was created
*/
created: string;
/**
* TODO docs
* Time when the snapshot expires, default is never to expire
*/
expires: string;
/**
* TODO docs
* Is the snapshot saved in an external grafana instance
*/
external: boolean;
/**
* TODO docs
* external url, if snapshot was shared in external grafana instance
*/
externalUrl: string;
/**
* TODO docs
* Unique identifier of the snapshot
*/
id: number;
/**
* TODO docs
* Optional, defined the unique key of the snapshot, required if external is true
*/
key: string;
/**
* TODO docs
* Optional, name of the snapshot
*/
name: string;
/**
* TODO docs
* org id of the snapshot
*/
orgId: number;
/**
* TODO docs
* last time when the snapshot was updated
*/
updated: string;
/**
* TODO docs
* url of the snapshot, if snapshot was shared internally
*/
url?: string;
/**
* TODO docs
* user id of the snapshot creator
*/
userId: number;
};
@ -816,46 +858,46 @@ export interface Dashboard {
*/
tags?: Array<string>;
/**
* TODO docs
* Contains the list of configured template variables with their saved values along with some other metadata
*/
templating?: {
list?: Array<VariableModel>;
};
/**
* Time range for dashboard, e.g. last 6 hours, last 7 days, etc
* Time range for dashboard.
* Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}.
*/
time?: {
from: string;
to: string;
};
/**
* TODO docs
* TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
* Configuration of the time picker shown at the top of a dashboard.
*/
timepicker?: {
/**
* Whether timepicker is collapsed or not.
*/
collapse: boolean;
/**
* Whether timepicker is enabled or not.
*/
enable: boolean;
/**
* Whether timepicker is visible or not.
*/
hidden: boolean;
/**
* Selectable intervals for auto-refresh.
* Interval options available in the refresh picker dropdown.
*/
refresh_intervals: Array<string>;
/**
* TODO docs
* Whether timepicker is collapsed or not. Has no effect on provisioned dashboard.
*/
collapse: boolean;
/**
* Whether timepicker is enabled or not. Has no effect on provisioned dashboard.
*/
enable: boolean;
/**
* Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
*/
time_options: Array<string>;
};
/**
* Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
* Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc".
*/
timezone?: string;
/**
@ -871,7 +913,7 @@ export interface Dashboard {
*/
version?: number;
/**
* TODO docs
* Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
*/
weekStart?: string;
}

View File

@ -157,11 +157,8 @@ type AnnotationPanelFilter struct {
// TODO docs
// FROM: AnnotationQuery in grafana-data/src/types/annotations.ts
type AnnotationQuery struct {
// TODO: Should be DataSourceRef
Datasource struct {
Type *string `json:"type,omitempty"`
Uid *string `json:"uid,omitempty"`
} `json:"datasource"`
// Ref to a DataSource instance
Datasource DataSourceRef `json:"datasource"`
// When enabled the annotation query is issued with every dashboard refresh
Enable bool `json:"enable"`
@ -210,24 +207,40 @@ type AnnotationTarget struct {
// 2 for shared crosshair AND shared tooltip.
type CursorSync int
// FROM public/app/features/dashboard/state/Models.ts - ish
// TODO docs
// Links with references to other dashboards or external resources
type Link struct {
AsDropdown bool `json:"asDropdown"`
Icon string `json:"icon"`
IncludeVars bool `json:"includeVars"`
KeepTime bool `json:"keepTime"`
Tags []string `json:"tags"`
TargetBlank bool `json:"targetBlank"`
Title string `json:"title"`
Tooltip string `json:"tooltip"`
// If true, all dashboards links will be displayed in a dropdown. If false, all dashboards links will be displayed side by side. Only valid if the type is dashboards
AsDropdown bool `json:"asDropdown"`
// TODO docs
// Icon name to be displayed with the link
Icon string `json:"icon"`
// If true, includes current template variables values in the link as query params
IncludeVars bool `json:"includeVars"`
// If true, includes current time range in the link as query params
KeepTime bool `json:"keepTime"`
// List of tags to limit the linked dashboards. If empty, all dashboards will be displayed. Only valid if the type is dashboards
Tags []string `json:"tags"`
// If true, the link will be opened in a new tab
TargetBlank bool `json:"targetBlank"`
// Title to display with the link
Title string `json:"title"`
// Tooltip to display when the user hovers their mouse over it
Tooltip string `json:"tooltip"`
// Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
Type LinkType `json:"type"`
Url string `json:"url"`
// Link URL. Only required/valid if the type is link
Url string `json:"url"`
}
// TODO docs
// Dashboard Link type. Accepted values are dashboards (to refer to another dashboard) and link (to refer to an external resource)
type LinkType string
// Ref to a DataSource instance
@ -353,7 +366,7 @@ type GridPos struct {
// H Panel
H int `json:"h"`
// Static true if fixed
// Whether the panel is fixed within the grid
Static *bool `json:"static,omitempty"`
// W Panel
@ -383,7 +396,7 @@ type LibraryPanelRef struct {
// LoadingState defines model for LoadingState.
type LoadingState string
// TODO docs
// Supported value mapping types
type MappingType string
// MatcherConfig defines model for MatcherConfig.
@ -410,8 +423,10 @@ type Panel struct {
// TODO docs
Id *int `json:"id,omitempty"`
// TODO docs
// TODO tighter constraint
// The min time interval setting defines a lower limit for the $__interval and $__interval_ms variables.
// This value must be formatted as a number followed by a valid time
// identifier like: "40s", "3d", etc.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
Interval *string `json:"interval,omitempty"`
LibraryPanel *LibraryPanelRef `json:"libraryPanel,omitempty"`
@ -419,7 +434,7 @@ type Panel struct {
// TODO fill this out - seems there are a couple variants?
Links []Link `json:"links,omitempty"`
// TODO docs
// The maximum number of data points that the panel queries are retrieving.
MaxDataPoints *float32 `json:"maxDataPoints,omitempty"`
// options is specified by the Options field in panel
@ -449,15 +464,23 @@ type Panel struct {
// TODO docs - seems to be an old field from old dashboard alerts?
Thresholds []interface{} `json:"thresholds,omitempty"`
// TODO docs
// TODO tighter constraint
// Overrides the relative time range for individual panels,
// which causes them to be different than what is selected in
// the dashboard time picker in the top-right corner of the dashboard. You can use this to show metrics from different
// time periods or days on the same dashboard.
// The value is formatted as time operation like: `now-5m` (Last 5 minutes), `now/d` (the day so far),
// `now-5d/d`(Last 5 days), `now/w` (This week so far), `now-2y/y` (Last 2 years).
// Note: Panel time overrides have no effect when the dashboards time range is absolute.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
TimeFrom *string `json:"timeFrom,omitempty"`
// TODO docs
TimeRegions []interface{} `json:"timeRegions,omitempty"`
// TODO docs
// TODO tighter constraint
// Overrides the time range for individual panels by shifting its start and end relative to the time picker.
// For example, you can shift the time range for the panel to be two hours earlier than the dashboard time picker setting `2h`.
// Note: Panel time overrides have no effect when the dashboards time range is absolute.
// See: https://grafana.com/docs/grafana/latest/panels-visualizations/query-transform-data/#query-options
TimeShift *string `json:"timeShift,omitempty"`
// Panel title.
@ -476,13 +499,13 @@ type Panel struct {
// TODO this is probably optional
type PanelRepeatDirection string
// TODO docs
// Maps numeric ranges to a color or different display text
type RangeMap struct {
Options struct {
// From to and from are `number | null` in current ts, really not sure what to do
From float64 `json:"from"`
// TODO docs
// Result used as replacement text and color for RegexMap and SpecialValueMap
Result ValueMappingResult `json:"result"`
To float64 `json:"to"`
} `json:"options"`
@ -492,12 +515,12 @@ type RangeMap struct {
// RangeMapType defines model for RangeMap.Type.
type RangeMapType string
// TODO docs
// Maps regular expressions to replacement text and a color
type RegexMap struct {
Options struct {
Pattern string `json:"pattern"`
// TODO docs
// Result used as replacement text and color for RegexMap and SpecialValueMap
Result ValueMappingResult `json:"result"`
} `json:"options"`
Type RegexMapType `json:"type"`
@ -528,39 +551,43 @@ type RowPanel struct {
// RowPanelType defines model for RowPanel.Type.
type RowPanelType string
// TODO docs
// A dashboard snapshot shares an interactive dashboard publicly.
// It is a read-only version of a dashboard, and is not editable.
// It is possible to create a snapshot of a snapshot.
// Grafana strips away all sensitive information from the dashboard.
// Sensitive information stripped: queries (metric, template,annotation) and panel links.
type Snapshot struct {
// TODO docs
// Time when the snapshot was created
Created time.Time `json:"created"`
// TODO docs
// Time when the snapshot expires, default is never to expire
Expires string `json:"expires"`
// TODO docs
// Is the snapshot saved in an external grafana instance
External bool `json:"external"`
// TODO docs
// ExternalUrl external url, if snapshot was shared in external grafana instance
ExternalUrl string `json:"externalUrl"`
// TODO docs
// Unique identifier of the snapshot
Id int `json:"id"`
// TODO docs
// Optional, defined the unique key of the snapshot, required if external is true
Key string `json:"key"`
// TODO docs
// Optional, name of the snapshot
Name string `json:"name"`
// TODO docs
// OrgId org id of the snapshot
OrgId int `json:"orgId"`
// TODO docs
// Updated last time when the snapshot was updated
Updated time.Time `json:"updated"`
// TODO docs
// url of the snapshot, if snapshot was shared internally
Url *string `json:"url,omitempty"`
// TODO docs
// UserId user id of the snapshot creator
UserId int `json:"userId"`
}
@ -578,7 +605,7 @@ type Spec struct {
// The month that the fiscal year starts on. 0 = January, 11 = December
FiscalYearStartMonth *int `json:"fiscalYearStartMonth,omitempty"`
// For dashboards imported from the https://grafana.com/grafana/dashboards/ portal
// ID of a dashboard imported from the https://grafana.com/grafana/dashboards/ portal
GnetId *string `json:"gnetId,omitempty"`
// 0 for no shared crosshair or tooltip (default).
@ -590,7 +617,7 @@ type Spec struct {
// TODO must isolate or remove identifiers local to a Grafana instance...?
Id *int64 `json:"id,omitempty"`
// TODO docs
// Links with references to other dashboards or external websites.
Links []Link `json:"links,omitempty"`
// When set to true, the dashboard will redraw panels at an interval matching the pixel width.
@ -612,7 +639,11 @@ type Spec struct {
// TODO this is the existing schema numbering system. It will be replaced by Thema's themaVersion
SchemaVersion int `json:"schemaVersion"`
// TODO docs
// A dashboard snapshot shares an interactive dashboard publicly.
// It is a read-only version of a dashboard, and is not editable.
// It is possible to create a snapshot of a snapshot.
// Grafana strips away all sensitive information from the dashboard.
// Sensitive information stripped: queries (metric, template,annotation) and panel links.
Snapshot *Snapshot `json:"snapshot,omitempty"`
// Theme of dashboard.
@ -621,37 +652,37 @@ type Spec struct {
// Tags associated with dashboard.
Tags []string `json:"tags,omitempty"`
// TODO docs
// Contains the list of configured template variables with their saved values along with some other metadata
Templating *struct {
List []VariableModel `json:"list,omitempty"`
} `json:"templating,omitempty"`
// Time range for dashboard, e.g. last 6 hours, last 7 days, etc
// Time range for dashboard.
// Accepted values are relative time strings like {from: 'now-6h', to: 'now'} or absolute time strings like {from: '2020-07-10T08:00:00.000Z', to: '2020-07-10T14:00:00.000Z'}.
Time *struct {
From string `json:"from"`
To string `json:"to"`
} `json:"time,omitempty"`
// TODO docs
// TODO this appears to be spread all over in the frontend. Concepts will likely need tidying in tandem with schema changes
// Configuration of the time picker shown at the top of a dashboard.
Timepicker *struct {
// Whether timepicker is collapsed or not.
// Whether timepicker is collapsed or not. Has no effect on provisioned dashboard.
Collapse bool `json:"collapse"`
// Whether timepicker is enabled or not.
// Whether timepicker is enabled or not. Has no effect on provisioned dashboard.
Enable bool `json:"enable"`
// Whether timepicker is visible or not.
Hidden bool `json:"hidden"`
// Selectable intervals for auto-refresh.
// Interval options available in the refresh picker dropdown.
RefreshIntervals []string `json:"refresh_intervals"`
// TODO docs
// Selectable options available in the time picker dropdown. Has no effect on provisioned dashboard.
TimeOptions []string `json:"time_options"`
} `json:"timepicker,omitempty"`
// Timezone of dashboard. Accepts IANA TZDB zone ID or "browser" or "utc".
// Timezone of dashboard. Accepted values are IANA TZDB zone ID or "browser" or "utc".
Timezone *string `json:"timezone,omitempty"`
// Title of dashboard.
@ -663,20 +694,21 @@ type Spec struct {
// Version of the dashboard, incremented each time the dashboard is updated.
Version *int `json:"version,omitempty"`
// TODO docs
// Day when the week starts. Expressed by the name of the day in lowercase, e.g. "monday".
WeekStart *string `json:"weekStart,omitempty"`
}
// Theme of dashboard.
type SpecStyle string
// TODO docs
// Maps special values like Null, NaN (not a number), and boolean values like true and false to a display text
// and color
type SpecialValueMap struct {
Options struct {
Match SpecialValueMapOptionsMatch `json:"match"`
Pattern string `json:"pattern"`
// TODO docs
// Result used as replacement text and color for RegexMap and SpecialValueMap
Result ValueMappingResult `json:"result"`
} `json:"options"`
Type SpecialValueMapType `json:"type"`
@ -697,9 +729,10 @@ type SpecialValueMapType string
// type directly to achieve the same effect.
type Target = map[string]interface{}
// TODO docs
// User-defined value for a metric that triggers visual changes in a panel when this value is met or exceeded
// They are used to conditionally style and color visualizations based on query results , and can be applied to most visualizations.
type Threshold struct {
// TODO docs
// Color represents the color of the visual change that will occur in the dashboard when the threshold value is met or exceeded.
Color string `json:"color"`
// Threshold index, an old property that is not needed an should only appear in older dashboards
@ -710,23 +743,24 @@ type Threshold struct {
// Some seem to be listed in typescript comment
State *string `json:"state,omitempty"`
// TODO docs
// Value represents a specified metric for the threshold, which triggers a visual change in the dashboard when this value is met or exceeded.
// FIXME the corresponding typescript field is required/non-optional, but nulls currently appear here when serializing -Infinity to JSON
Value *float32 `json:"value,omitempty"`
}
// ThresholdsConfig defines model for ThresholdsConfig.
type ThresholdsConfig struct {
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
Mode ThresholdsMode `json:"mode"`
// Must be sorted by 'value', first value is always -Infinity
Steps []Threshold `json:"steps"`
}
// ThresholdsMode defines model for ThresholdsMode.
// Thresholds can either be absolute (specific number) or percentage (relative to min or max).
type ThresholdsMode string
// TODO docs
// Maps text values to a color or different display text
type ValueMap struct {
Options map[string]ValueMappingResult `json:"options"`
Type ValueMapType `json:"type"`
@ -735,7 +769,7 @@ type ValueMap struct {
// ValueMapType defines model for ValueMap.Type.
type ValueMapType string
// TODO docs
// Result used as replacement text and color for RegexMap and SpecialValueMap
type ValueMappingResult struct {
Color *string `json:"color,omitempty"`
Icon *string `json:"icon,omitempty"`

View File

@ -250,7 +250,7 @@ describe('when rendering table', () => {
expect(html).toBe('<td>1.23 kb/s</td>');
});
it('number column should be formated', () => {
it('number column should be formatted', () => {
const html = renderer.renderCell(1, 0, 1230);
expect(html).toBe('<td>1.230 s</td>');
});