NodeGraph: Schema for panel options (#62121)

This commit is contained in:
Andrej Ocenas 2023-01-26 18:02:41 +01:00 committed by GitHub
parent caaf7be2f2
commit 039b30b1ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 212 additions and 28 deletions

View File

@ -0,0 +1,97 @@
---
keywords:
- grafana
- schema
title: NodeGraphPanelCfg kind
---
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice.
# NodeGraphPanelCfg kind
## Maturity: experimental
## Version: 0.0
## Properties
| Property | Type | Required | Description |
|----------------|-------------------------|----------|-------------|
| `ArcOption` | [object](#arcoption) | **Yes** | |
| `EdgeOptions` | [object](#edgeoptions) | **Yes** | |
| `NodeOptions` | [object](#nodeoptions) | **Yes** | |
| `PanelOptions` | [object](#paneloptions) | **Yes** | |
## ArcOption
### Properties
| Property | Type | Required | Description |
|----------|--------|----------|-----------------------------------------------------------------------------------------------------|
| `color` | string | No | The color of the arc. |
| `field` | string | No | Field from which to get the value. Values should be less than 1, representing fraction of a circle. |
## EdgeOptions
### Properties
| Property | Type | Required | Description |
|---------------------|--------|----------|-----------------------------------------------------------------------------|
| `mainStatUnit` | string | No | Unit for the main stat to override what ever is set in the data frame. |
| `secondaryStatUnit` | string | No | Unit for the secondary stat to override what ever is set in the data frame. |
## NodeOptions
### Properties
| Property | Type | Required | Description |
|---------------------|---------------------------|----------|-----------------------------------------------------------------------------------------|
| `arcs` | [ArcOption](#arcoption)[] | No | Define which fields are shown as part of the node arc (colored circle around the node). |
| `mainStatUnit` | string | No | Unit for the main stat to override what ever is set in the data frame. |
| `secondaryStatUnit` | string | No | Unit for the secondary stat to override what ever is set in the data frame. |
### ArcOption
#### Properties
| Property | Type | Required | Description |
|----------|--------|----------|-----------------------------------------------------------------------------------------------------|
| `color` | string | No | The color of the arc. |
| `field` | string | No | Field from which to get the value. Values should be less than 1, representing fraction of a circle. |
## PanelOptions
### Properties
| Property | Type | Required | Description |
|----------|-----------------------------|----------|-------------|
| `edges` | [EdgeOptions](#edgeoptions) | No | |
| `nodes` | [NodeOptions](#nodeoptions) | No | |
### EdgeOptions
#### Properties
| Property | Type | Required | Description |
|---------------------|--------|----------|-----------------------------------------------------------------------------|
| `mainStatUnit` | string | No | Unit for the main stat to override what ever is set in the data frame. |
| `secondaryStatUnit` | string | No | Unit for the secondary stat to override what ever is set in the data frame. |
### NodeOptions
#### Properties
| Property | Type | Required | Description |
|---------------------|---------------------------|----------|-----------------------------------------------------------------------------------------|
| `arcs` | [ArcOption](#arcoption)[] | No | Define which fields are shown as part of the node arc (colored circle around the node). |
| `mainStatUnit` | string | No | Unit for the main stat to override what ever is set in the data frame. |
| `secondaryStatUnit` | string | No | Unit for the secondary stat to override what ever is set in the data frame. |
#### ArcOption
##### Properties
| Property | Type | Required | Description |
|----------|--------|----------|-----------------------------------------------------------------------------------------------------|
| `color` | string | No | The color of the arc. |
| `field` | string | No | Field from which to get the value. Values should be less than 1, representing fraction of a circle. |

View File

@ -1009,7 +1009,9 @@
},
"nodegraphpanelcfg": {
"category": "composable",
"codeowners": [],
"codeowners": [
"grafana/observability-traces-and-profiling"
],
"currentVersion": [
0,
0
@ -1017,13 +1019,13 @@
"grafanaMaturityCount": 0,
"lineageIsGroup": true,
"links": {
"docs": "n/a",
"docs": "https://grafana.com/docs/grafana/next/developers/kinds/composable/nodegraphpanelcfg/schema-reference",
"go": "n/a",
"schema": "n/a",
"ts": "n/a"
"schema": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/nodeGraph/panelcfg.cue",
"ts": "https://github.com/grafana/grafana/tree/main/public/app/plugins/panel/nodeGraph/panelcfg.gen.ts"
},
"machineName": "nodegraphpanelcfg",
"maturity": "planned",
"maturity": "experimental",
"name": "NodeGraphPanelCfg",
"pluralMachineName": "nodegraphpanelcfgs",
"pluralName": "NodeGraphPanelCfgs",
@ -1869,6 +1871,7 @@
"gaugepanelcfg",
"histogrampanelcfg",
"newspanelcfg",
"nodegraphpanelcfg",
"piechartpanelcfg",
"statetimelinepanelcfg",
"statpanelcfg",
@ -1877,7 +1880,7 @@
"textpanelcfg",
"xychartpanelcfg"
],
"count": 15
"count": 16
},
"mature": {
"name": "mature",
@ -1935,7 +1938,6 @@
"microsoftsqlserverdatasourcecfg",
"mysqldataquery",
"mysqldatasourcecfg",
"nodegraphpanelcfg",
"parcadataquery",
"parcadatasourcecfg",
"phlaredataquery",
@ -1957,7 +1959,7 @@
"zipkindataquery",
"zipkindatasourcecfg"
],
"count": 57
"count": 56
},
"stable": {
"name": "stable",

View File

@ -0,0 +1,55 @@
// Copyright 2023 Grafana Labs
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package grafanaplugin
composableKinds: PanelCfg: {
maturity: "experimental"
lineage: {
seqs: [
{
schemas: [
// v0.0
{
ArcOption: {
// Field from which to get the value. Values should be less than 1, representing fraction of a circle.
field?: string
// The color of the arc.
color?: string
} @cuetsy(kind="interface")
NodeOptions: {
// Unit for the main stat to override what ever is set in the data frame.
mainStatUnit?: string
// Unit for the secondary stat to override what ever is set in the data frame.
secondaryStatUnit?: string
// Define which fields are shown as part of the node arc (colored circle around the node).
arcs?: [...ArcOption]
}
EdgeOptions: {
// Unit for the main stat to override what ever is set in the data frame.
mainStatUnit?: string
// Unit for the secondary stat to override what ever is set in the data frame.
secondaryStatUnit?: string
}
PanelOptions: {
nodes?: NodeOptions
edges?: EdgeOptions
} @cuetsy(kind="interface")
},
]
},
]
}
}

View File

@ -0,0 +1,49 @@
// Code generated - EDITING IS FUTILE. DO NOT EDIT.
//
// Generated by:
// public/app/plugins/gen.go
// Using jennies:
// TSTypesJenny
// PluginTSTypesJenny
//
// Run 'make gen-cue' from repository root to regenerate.
export const PanelCfgModelVersion = Object.freeze([0, 0]);
export interface ArcOption {
/**
* The color of the arc.
*/
color?: string;
/**
* Field from which to get the value. Values should be less than 1, representing fraction of a circle.
*/
field?: string;
}
export interface PanelOptions {
edges?: {
/**
* Unit for the main stat to override what ever is set in the data frame.
*/
mainStatUnit?: string;
/**
* Unit for the secondary stat to override what ever is set in the data frame.
*/
secondaryStatUnit?: string;
};
nodes?: {
/**
* Unit for the main stat to override what ever is set in the data frame.
*/
mainStatUnit?: string;
/**
* Unit for the secondary stat to override what ever is set in the data frame.
*/
secondaryStatUnit?: string;
/**
* Define which fields are shown as part of the node arc (colored circle around the node).
*/
arcs?: Array<ArcOption>;
};
}

View File

@ -2,26 +2,7 @@ import { SimulationNodeDatum, SimulationLinkDatum } from 'd3-force';
import { Field } from '@grafana/data';
export interface NodeGraphOptions {
nodes?: NodeOptions;
edges?: EdgeOptions;
}
interface NodeOptions {
mainStatUnit?: string;
secondaryStatUnit?: string;
arcs?: ArcOption[];
}
export interface ArcOption {
field?: string;
color?: string;
}
interface EdgeOptions {
mainStatUnit?: string;
secondaryStatUnit?: string;
}
export { PanelOptions as NodeGraphOptions, ArcOption } from './panelcfg.gen';
export type NodeDatum = SimulationNodeDatum & {
id: string;