From 4b00594758428c42aabf56886b101185c16e7116 Mon Sep 17 00:00:00 2001 From: Dominik Prokop Date: Sun, 26 Apr 2020 11:14:21 +0200 Subject: [PATCH] Docs: Add doc comments for PanelPlugin (#23896) --- packages/grafana-data/src/types/panel.ts | 71 ++++++++++--------- .../PanelEditor/PanelOptionsTab.tsx | 8 +-- 2 files changed, 39 insertions(+), 40 deletions(-) diff --git a/packages/grafana-data/src/types/panel.ts b/packages/grafana-data/src/types/panel.ts index 87c3c8a364c..e2a73d42fd7 100644 --- a/packages/grafana-data/src/types/panel.ts +++ b/packages/grafana-data/src/types/panel.ts @@ -12,87 +12,86 @@ import { OptionsEditorItem } from './OptionsUIRegistryBuilder'; export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string; export interface PanelPluginMeta extends PluginMeta { + /** Indicates that panel does not issue queries */ skipDataQuery?: boolean; + /** Indicates that panel should not be available in visualisation picker */ hideFromList?: boolean; + /** Sort order */ sort: number; } export interface PanelData { - /** - * State of the data (loading, done, error, streaming) - */ + /** State of the data (loading, done, error, streaming) */ state: LoadingState; - /** - * Contains data frames with field overrides applied - */ + /** Contains data frames with field overrides applied */ series: DataFrame[]; - /** - * Request contains the queries and properties sent to the datasource - */ + /** Request contains the queries and properties sent to the datasource */ request?: DataQueryRequest; - /** - * Timing measurements - */ + /** Timing measurements */ timings?: DataQueryTimings; - /** - * Any query errors - */ + /** Any query errors */ error?: DataQueryError; - /** - * Contains the range from the request or a shifted time range if a request uses relative time - */ + /** Contains the range from the request or a shifted time range if a request uses relative time */ timeRange: TimeRange; } export interface PanelProps { - id: number; // ID within the current dashboard + /** ID of the panel within the current dashboard */ + id: number; + /** Result set of panel queries */ data: PanelData; + /** Time range of the current dashboard */ timeRange: TimeRange; + /** Time zone of the current dashboard */ timeZone: TimeZone; + /** Panel options */ options: T; + /** Panel options change handler */ onOptionsChange: (options: T) => void; - /** Panel fields configuration */ + /** Field options configuration */ fieldConfig: FieldConfigSource; - /** Enables panel field config manipulation */ + /** Field config change handler */ onFieldConfigChange: (config: FieldConfigSource) => void; - renderCounter: number; + /** Indicathes whether or not panel should be rendered transparent */ transparent: boolean; + /** Current width of the panel */ width: number; + /** Current height of the panel */ height: number; + /** Template variables interpolation function */ replaceVariables: InterpolateFunction; + /** Time range change handler */ onChangeTimeRange: (timeRange: AbsoluteTimeRange) => void; + /** @internal */ + renderCounter: number; } export interface PanelEditorProps { + /** Panel options */ options: T; + /** Panel options change handler */ onOptionsChange: ( options: T, // callback can be used to run something right after update. callback?: () => void ) => void; + /** Result set of panel queries */ data: PanelData; - - /** - * Panel fields configuration - temporart solution - * TODO[FieldConfig]: Remove when we switch old editor to new - */ - fieldConfig: FieldConfigSource; - /** - * Enables panel field config manipulation - * TODO[FieldConfig]: Remove when we switch old editor to new - */ - onFieldConfigChange: (config: FieldConfigSource) => void; } export interface PanelModel { + /** ID of the panel within the current dashboard */ id: number; + /** Panel options */ options: TOptions; + /** Field options configuration */ fieldConfig: FieldConfigSource; + /** Version of the panel plugin */ pluginVersion?: string; scopedVars?: ScopedVars; } @@ -160,6 +159,9 @@ export interface PanelOptionsEditorConfig boolean; } +/** + * @internal + */ export interface PanelMenuItem { type?: 'submenu' | 'divider'; text?: string; @@ -170,6 +172,9 @@ export interface PanelMenuItem { subMenu?: PanelMenuItem[]; } +/** + * @internal + */ export interface AngularPanelMenuItem { click: Function; icon: string; diff --git a/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx b/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx index c69be6f0f2c..89997064941 100644 --- a/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx +++ b/public/app/features/dashboard/components/PanelEditor/PanelOptionsTab.tsx @@ -74,13 +74,7 @@ export const PanelOptionsTab: FC = ({ if (plugin.editor && panel && !plugin.optionEditors) { elements.push( - + ); }