DataFrame: add path and description metadata (#29695)

pull/29704/head
Ryan McKinley 5 years ago committed by GitHub
parent 3de091edf1
commit 770e8e4a0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 10
      packages/grafana-data/src/types/data.ts
  2. 14
      packages/grafana-data/src/types/dataFrame.ts
  3. 12
      packages/grafana-ui/src/components/uPlot/config.ts
  4. 3
      packages/grafana-ui/src/components/uPlot/plugins/AnnotationsEditorPlugin.tsx
  5. 3
      packages/grafana-ui/src/components/uPlot/plugins/ClickPlugin.tsx
  6. 3
      packages/grafana-ui/src/components/uPlot/plugins/ContextMenuPlugin.tsx
  7. 6
      packages/grafana-ui/src/components/uPlot/plugins/CursorPlugin.tsx
  8. 3
      packages/grafana-ui/src/components/uPlot/plugins/SelectionPlugin.tsx
  9. 3
      packages/grafana-ui/src/components/uPlot/plugins/TooltipPlugin.tsx
  10. 3
      packages/grafana-ui/src/components/uPlot/plugins/ZoomPlugin.tsx

@ -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

Loading…
Cancel
Save