mirror of
https://github.com/grafana/grafana.git
synced 2026-07-30 08:18:10 -05:00
DataFrame: add path and description metadata (#29695)
This commit is contained in:
@@ -53,6 +53,16 @@ export interface QueryResultMeta {
|
||||
*/
|
||||
executedQueryString?: string;
|
||||
|
||||
/**
|
||||
* A browsable path on the datasource
|
||||
*/
|
||||
path?: string;
|
||||
|
||||
/**
|
||||
* defaults to '/'
|
||||
*/
|
||||
pathSeparator?: string;
|
||||
|
||||
/**
|
||||
* Legacy data source specific, should be moved to custom
|
||||
* */
|
||||
|
||||
@@ -34,6 +34,20 @@ export interface FieldConfig<TOptions extends object = any> {
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
||||
@@ -28,6 +28,9 @@ export enum LineInterpolation {
|
||||
StepAfter = 'stepAfter',
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export interface LineConfig {
|
||||
lineColor?: string;
|
||||
lineWidth?: number;
|
||||
@@ -35,11 +38,17 @@ export interface LineConfig {
|
||||
spanNulls?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export interface AreaConfig {
|
||||
fillColor?: string;
|
||||
fillOpacity?: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export interface PointsConfig {
|
||||
showPoints?: PointVisibility;
|
||||
pointSize?: number;
|
||||
@@ -54,6 +63,9 @@ export interface AxisConfig {
|
||||
axisWidth?: number; // pixels ideally auto?
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export interface GraphFieldConfig extends LineConfig, AreaConfig, PointsConfig, AxisConfig {
|
||||
drawStyle?: DrawStyle;
|
||||
}
|
||||
|
||||
@@ -8,6 +8,9 @@ interface AnnotationsEditorPluginProps {
|
||||
onAnnotationCreate: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const AnnotationsEditorPlugin: React.FC<AnnotationsEditorPluginProps> = ({ onAnnotationCreate }) => {
|
||||
const pluginId = 'AnnotationsEditorPlugin';
|
||||
|
||||
|
||||
@@ -18,6 +18,9 @@ interface ClickPluginAPI {
|
||||
clearSelection: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
interface ClickPluginProps extends PlotPluginProps {
|
||||
onClick: (e: { seriesIdx: number | null; dataIdx: number | null }) => void;
|
||||
children: (api: ClickPluginAPI) => React.ReactElement | null;
|
||||
|
||||
@@ -9,6 +9,9 @@ interface ContextMenuPluginProps {
|
||||
onClose?: () => void;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const ContextMenuPlugin: React.FC<ContextMenuPluginProps> = ({ onClose }) => {
|
||||
const [isOpen, setIsOpen] = useState(false);
|
||||
|
||||
|
||||
@@ -30,7 +30,11 @@ interface Coords {
|
||||
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 }) => {
|
||||
const pluginId = `CursorPlugin:${id}`;
|
||||
const plotCanvas = useRef<HTMLDivElement>(null);
|
||||
|
||||
@@ -30,6 +30,9 @@ interface SelectionPluginProps extends PlotPluginProps {
|
||||
children?: (api: SelectionPluginAPI) => JSX.Element;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const SelectionPlugin: React.FC<SelectionPluginProps> = ({ onSelect, onDismiss, lazy, id, children }) => {
|
||||
const pluginId = `SelectionPlugin:${id}`;
|
||||
const plotCtx = usePlotContext();
|
||||
|
||||
@@ -12,6 +12,9 @@ interface TooltipPluginProps {
|
||||
timeZone: TimeZone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const TooltipPlugin: React.FC<TooltipPluginProps> = ({ mode = 'single', timeZone }) => {
|
||||
const pluginId = 'PlotTooltip';
|
||||
const plotContext = usePlotContext();
|
||||
|
||||
@@ -8,6 +8,9 @@ interface ZoomPluginProps {
|
||||
// min px width that triggers zoom
|
||||
const MIN_ZOOM_DIST = 5;
|
||||
|
||||
/**
|
||||
* @alpha
|
||||
*/
|
||||
export const ZoomPlugin: React.FC<ZoomPluginProps> = ({ onZoom }) => {
|
||||
return (
|
||||
<SelectionPlugin
|
||||
|
||||
Reference in New Issue
Block a user