Commit 770e8e4a by Ryan McKinley Committed by GitHub

DataFrame: add path and description metadata (#29695)

parent 3de091ed
...@@ -54,6 +54,16 @@ export interface QueryResultMeta { ...@@ -54,6 +54,16 @@ export interface QueryResultMeta {
executedQueryString?: string; executedQueryString?: string;
/** /**
* A browsable path on the datasource
*/
path?: string;
/**
* defaults to '/'
*/
pathSeparator?: string;
/**
* Legacy data source specific, should be moved to custom * Legacy data source specific, should be moved to custom
* */ * */
gmdMeta?: any[]; // used by cloudwatch gmdMeta?: any[]; // used by cloudwatch
......
...@@ -35,6 +35,20 @@ export interface FieldConfig<TOptions extends object = any> { ...@@ -35,6 +35,20 @@ export interface FieldConfig<TOptions extends object = any> {
displayNameFromDS?: string; displayNameFromDS?: string;
/** /**
* Human readable field metadata
*/
description?: string;
/**
* An explict path to the field in the datasource. When the frame meta includes a path,
* This will default to `${frame.meta.path}/${field.name}
*
* When defined, this value can be used as an identifier within the datasource scope, and
* may be used to update the results
*/
path?: string;
/**
* True if data source field supports ad-hoc filters * True if data source field supports ad-hoc filters
*/ */
filterable?: boolean; filterable?: boolean;
......
...@@ -28,6 +28,9 @@ export enum LineInterpolation { ...@@ -28,6 +28,9 @@ export enum LineInterpolation {
StepAfter = 'stepAfter', StepAfter = 'stepAfter',
} }
/**
* @alpha
*/
export interface LineConfig { export interface LineConfig {
lineColor?: string; lineColor?: string;
lineWidth?: number; lineWidth?: number;
...@@ -35,11 +38,17 @@ export interface LineConfig { ...@@ -35,11 +38,17 @@ export interface LineConfig {
spanNulls?: boolean; spanNulls?: boolean;
} }
/**
* @alpha
*/
export interface AreaConfig { export interface AreaConfig {
fillColor?: string; fillColor?: string;
fillOpacity?: number; fillOpacity?: number;
} }
/**
* @alpha
*/
export interface PointsConfig { export interface PointsConfig {
showPoints?: PointVisibility; showPoints?: PointVisibility;
pointSize?: number; pointSize?: number;
...@@ -54,6 +63,9 @@ export interface AxisConfig { ...@@ -54,6 +63,9 @@ export interface AxisConfig {
axisWidth?: number; // pixels ideally auto? axisWidth?: number; // pixels ideally auto?
} }
/**
* @alpha
*/
export interface GraphFieldConfig extends LineConfig, AreaConfig, PointsConfig, AxisConfig { export interface GraphFieldConfig extends LineConfig, AreaConfig, PointsConfig, AxisConfig {
drawStyle?: DrawStyle; drawStyle?: DrawStyle;
} }
......
...@@ -8,6 +8,9 @@ interface AnnotationsEditorPluginProps { ...@@ -8,6 +8,9 @@ interface AnnotationsEditorPluginProps {
onAnnotationCreate: () => void; onAnnotationCreate: () => void;
} }
/**
* @alpha
*/
export const AnnotationsEditorPlugin: React.FC<AnnotationsEditorPluginProps> = ({ onAnnotationCreate }) => { export const AnnotationsEditorPlugin: React.FC<AnnotationsEditorPluginProps> = ({ onAnnotationCreate }) => {
const pluginId = 'AnnotationsEditorPlugin'; const pluginId = 'AnnotationsEditorPlugin';
......
...@@ -18,6 +18,9 @@ interface ClickPluginAPI { ...@@ -18,6 +18,9 @@ interface ClickPluginAPI {
clearSelection: () => void; clearSelection: () => void;
} }
/**
* @alpha
*/
interface ClickPluginProps extends PlotPluginProps { interface ClickPluginProps extends PlotPluginProps {
onClick: (e: { seriesIdx: number | null; dataIdx: number | null }) => void; onClick: (e: { seriesIdx: number | null; dataIdx: number | null }) => void;
children: (api: ClickPluginAPI) => React.ReactElement | null; children: (api: ClickPluginAPI) => React.ReactElement | null;
......
...@@ -9,6 +9,9 @@ interface ContextMenuPluginProps { ...@@ -9,6 +9,9 @@ interface ContextMenuPluginProps {
onClose?: () => void; onClose?: () => void;
} }
/**
* @alpha
*/
export const ContextMenuPlugin: React.FC<ContextMenuPluginProps> = ({ onClose }) => { export const ContextMenuPlugin: React.FC<ContextMenuPluginProps> = ({ onClose }) => {
const [isOpen, setIsOpen] = useState(false); const [isOpen, setIsOpen] = useState(false);
......
...@@ -30,7 +30,11 @@ interface Coords { ...@@ -30,7 +30,11 @@ interface Coords {
y: number; y: number;
} }
// Exposes API for Graph cursor position /**
* Exposes API for Graph cursor position
*
* @alpha
*/
export const CursorPlugin: React.FC<CursorPluginProps> = ({ id, children, capture = 'mousemove', lock = false }) => { export const CursorPlugin: React.FC<CursorPluginProps> = ({ id, children, capture = 'mousemove', lock = false }) => {
const pluginId = `CursorPlugin:${id}`; const pluginId = `CursorPlugin:${id}`;
const plotCanvas = useRef<HTMLDivElement>(null); const plotCanvas = useRef<HTMLDivElement>(null);
......
...@@ -30,6 +30,9 @@ interface SelectionPluginProps extends PlotPluginProps { ...@@ -30,6 +30,9 @@ interface SelectionPluginProps extends PlotPluginProps {
children?: (api: SelectionPluginAPI) => JSX.Element; children?: (api: SelectionPluginAPI) => JSX.Element;
} }
/**
* @alpha
*/
export const SelectionPlugin: React.FC<SelectionPluginProps> = ({ onSelect, onDismiss, lazy, id, children }) => { export const SelectionPlugin: React.FC<SelectionPluginProps> = ({ onSelect, onDismiss, lazy, id, children }) => {
const pluginId = `SelectionPlugin:${id}`; const pluginId = `SelectionPlugin:${id}`;
const plotCtx = usePlotContext(); const plotCtx = usePlotContext();
......
...@@ -12,6 +12,9 @@ interface TooltipPluginProps { ...@@ -12,6 +12,9 @@ interface TooltipPluginProps {
timeZone: TimeZone; timeZone: TimeZone;
} }
/**
* @alpha
*/
export const TooltipPlugin: React.FC<TooltipPluginProps> = ({ mode = 'single', timeZone }) => { export const TooltipPlugin: React.FC<TooltipPluginProps> = ({ mode = 'single', timeZone }) => {
const pluginId = 'PlotTooltip'; const pluginId = 'PlotTooltip';
const plotContext = usePlotContext(); const plotContext = usePlotContext();
......
...@@ -8,6 +8,9 @@ interface ZoomPluginProps { ...@@ -8,6 +8,9 @@ interface ZoomPluginProps {
// min px width that triggers zoom // min px width that triggers zoom
const MIN_ZOOM_DIST = 5; const MIN_ZOOM_DIST = 5;
/**
* @alpha
*/
export const ZoomPlugin: React.FC<ZoomPluginProps> = ({ onZoom }) => { export const ZoomPlugin: React.FC<ZoomPluginProps> = ({ onZoom }) => {
return ( return (
<SelectionPlugin <SelectionPlugin
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment