mirror of https://github.com/grafana/grafana
Refactor state timeline/status history to cue model and refactor `TimelineChart` component (#61631)
* Adapt state timeline to scuemata * Refactor status history to cue model * Refactor * Refactor TimelineChart as a core component * wip * Change as per CR Co-authored-by: sam boyer <sdboyer@grafana.com>pull/62102/head
parent
6c9174a766
commit
6a93c77082
@ -0,0 +1,41 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: StateTimelinePanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# StateTimelinePanelCfg 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 | Default: `70`. | |
||||
| `lineWidth` | integer | No | Default: `0`. | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|---------------|---------|----------|-------------------------------------------------------------------------------------------------------------| |
||||
| `alignValue` | string | No | Controls the value alignment in the TimelineChart component Possible values are: `center`, `left`, `right`. | |
||||
| `mergeValues` | boolean | No | Merge equal consecutive values Default: `true`. | |
||||
| `rowHeight` | number | No | Controls the row height Default: `0.9`. | |
||||
| `showValue` | string | No | TODO docs Possible values are: `auto`, `never`, `always`. | |
||||
|
||||
|
@ -0,0 +1,39 @@ |
||||
--- |
||||
keywords: |
||||
- grafana |
||||
- schema |
||||
title: StatusHistoryPanelCfg kind |
||||
--- |
||||
> Both documentation generation and kinds schemas are in active development and subject to change without prior notice. |
||||
|
||||
# StatusHistoryPanelCfg 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 | Default: `70`. | |
||||
| `lineWidth` | integer | No | Default: `1`. | |
||||
|
||||
## PanelOptions |
||||
|
||||
### Properties |
||||
|
||||
| Property | Type | Required | Description | |
||||
|-------------|--------|----------|-----------------------------------------------------------| |
||||
| `colWidth` | number | No | Controls the column width Default: `0.9`. | |
||||
| `showValue` | string | No | TODO docs Possible values are: `auto`, `never`, `always`. | |
||||
|
||||
|
@ -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.
|
||||
|
||||
import * as ui from '@grafana/schema'; |
||||
|
||||
export const PanelCfgModelVersion = Object.freeze([0, 0]); |
||||
|
||||
export interface PanelOptions extends ui.OptionsWithLegend, ui.OptionsWithTooltip, ui.OptionsWithTimezones { |
||||
/** |
||||
* Controls value alignment on the timelines |
||||
*/ |
||||
alignValue?: ui.TimelineValueAlignment; |
||||
/** |
||||
* Merge equal consecutive values |
||||
*/ |
||||
mergeValues?: boolean; |
||||
/** |
||||
* Controls the row height |
||||
*/ |
||||
rowHeight: number; |
||||
/** |
||||
* Show timeline values on chart |
||||
*/ |
||||
showValue: ui.VisibilityMode; |
||||
} |
||||
|
||||
export const defaultPanelOptions: Partial<PanelOptions> = { |
||||
alignValue: 'left', |
||||
mergeValues: true, |
||||
rowHeight: 0.9, |
||||
showValue: ui.VisibilityMode.Auto, |
||||
}; |
||||
|
||||
export interface PanelFieldConfig extends ui.HideableFieldConfig { |
||||
fillOpacity?: number; |
||||
lineWidth?: number; |
||||
} |
||||
|
||||
export const defaultPanelFieldConfig: Partial<PanelFieldConfig> = { |
||||
fillOpacity: 70, |
||||
lineWidth: 0, |
||||
}; |
@ -1,66 +0,0 @@ |
||||
import { DashboardCursorSync } from '@grafana/data'; |
||||
import { |
||||
HideableFieldConfig, |
||||
OptionsWithLegend, |
||||
OptionsWithTimezones, |
||||
OptionsWithTooltip, |
||||
VisibilityMode, |
||||
} from '@grafana/schema'; |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export interface TimelineOptions extends OptionsWithLegend, OptionsWithTooltip, OptionsWithTimezones { |
||||
mode: TimelineMode; // not in the saved model!
|
||||
|
||||
showValue: VisibilityMode; |
||||
rowHeight: number; |
||||
|
||||
// only used for "samples" mode (status-history)
|
||||
colWidth?: number; |
||||
// only used in "changes" mode (state-timeline)
|
||||
mergeValues?: boolean; |
||||
// only used in "changes" mode (state-timeline)
|
||||
alignValue?: TimelineValueAlignment; |
||||
|
||||
sync?: () => DashboardCursorSync; |
||||
getValueColor?: (frameIdx: number, fieldIdx: number, value: any) => string; |
||||
} |
||||
|
||||
export type TimelineValueAlignment = 'center' | 'left' | 'right'; |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export interface TimelineFieldConfig extends HideableFieldConfig { |
||||
lineWidth?: number; // 0
|
||||
fillOpacity?: number; // 100
|
||||
} |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export const defaultPanelOptions: Partial<TimelineOptions> = { |
||||
showValue: VisibilityMode.Auto, |
||||
alignValue: 'left', |
||||
mergeValues: true, |
||||
rowHeight: 0.9, |
||||
}; |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export const defaultTimelineFieldConfig: TimelineFieldConfig = { |
||||
lineWidth: 0, |
||||
fillOpacity: 70, |
||||
}; |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export enum TimelineMode { |
||||
// state-timeline
|
||||
Changes = 'changes', |
||||
// status-history
|
||||
Samples = 'samples', |
||||
} |
@ -0,0 +1,39 @@ |
||||
// 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.
|
||||
|
||||
import * as ui from '@grafana/schema'; |
||||
|
||||
export const PanelCfgModelVersion = Object.freeze([0, 0]); |
||||
|
||||
export interface PanelOptions extends ui.OptionsWithLegend, ui.OptionsWithTooltip, ui.OptionsWithTimezones { |
||||
/** |
||||
* Controls the column width |
||||
*/ |
||||
colWidth?: number; |
||||
/** |
||||
* Show values on the columns |
||||
*/ |
||||
showValue: ui.VisibilityMode; |
||||
} |
||||
|
||||
export const defaultPanelOptions: Partial<PanelOptions> = { |
||||
colWidth: 0.9, |
||||
showValue: ui.VisibilityMode.Auto, |
||||
}; |
||||
|
||||
export interface PanelFieldConfig extends ui.HideableFieldConfig { |
||||
fillOpacity?: number; |
||||
lineWidth?: number; |
||||
} |
||||
|
||||
export const defaultPanelFieldConfig: Partial<PanelFieldConfig> = { |
||||
fillOpacity: 70, |
||||
lineWidth: 1, |
||||
}; |
@ -1,32 +0,0 @@ |
||||
import { |
||||
HideableFieldConfig, |
||||
VisibilityMode, |
||||
OptionsWithTooltip, |
||||
OptionsWithLegend, |
||||
OptionsWithTimezones, |
||||
} from '@grafana/schema'; |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export interface StatusPanelOptions extends OptionsWithTooltip, OptionsWithLegend, OptionsWithTimezones { |
||||
showValue: VisibilityMode; |
||||
rowHeight: number; |
||||
colWidth?: number; |
||||
} |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export interface StatusFieldConfig extends HideableFieldConfig { |
||||
lineWidth?: number; // 0
|
||||
fillOpacity?: number; // 100
|
||||
} |
||||
|
||||
/** |
||||
* @alpha |
||||
*/ |
||||
export const defaultStatusFieldConfig: StatusFieldConfig = { |
||||
lineWidth: 1, |
||||
fillOpacity: 70, |
||||
}; |
Loading…
Reference in new issue