Commit b05afd7e by Hugo Häggmark Committed by GitHub

Explore: Moves GraphSeriesXY and DisplayValue to grafana/data (#18400)

* Chore: Move DisplayValue to grafana/data

* Chore: Move GraphSeriesXY to grafana/data
parent ead2d6e8
......@@ -7,3 +7,5 @@ export * from './time';
export * from './threshold';
export * from './utils';
export * from './valueMapping';
export * from './displayValue';
export * from './graph';
import React from 'react';
import { shallow } from 'enzyme';
import { DisplayValue } from '@grafana/data';
import {
BarGauge,
Props,
......@@ -9,7 +10,7 @@ import {
getTitleStyles,
getValuePercent,
} from './BarGauge';
import { VizOrientation, DisplayValue } from '../../types';
import { VizOrientation } from '../../types';
import { getTheme } from '../../themes';
// jest.mock('jquery', () => ({
......
// Library
import React, { PureComponent, CSSProperties, ReactNode } from 'react';
import tinycolor from 'tinycolor2';
import { Threshold, TimeSeriesValue, getActiveThreshold, DisplayValue } from '@grafana/data';
// Utils
import { getColorFromHexRgbOrName } from '../../utils';
// Types
import { DisplayValue, Themeable, VizOrientation } from '../../types';
import { Threshold, TimeSeriesValue, getActiveThreshold } from '@grafana/data';
import { Themeable, VizOrientation } from '../../types';
const MIN_VALUE_HEIGHT = 18;
const MAX_VALUE_HEIGHT = 50;
......
......@@ -2,12 +2,13 @@
import React, { PureComponent, ReactNode, CSSProperties } from 'react';
import $ from 'jquery';
import { css } from 'emotion';
import { DisplayValue } from '@grafana/data';
// Utils
import { getColorFromHexRgbOrName } from '../../utils';
// Types
import { Themeable, DisplayValue } from '../../types';
import { Themeable } from '../../types';
export interface BigValueSparkline {
data: any[][]; // [[number,number]]
......
import React, { PureComponent } from 'react';
import $ from 'jquery';
import { Threshold, DisplayValue } from '@grafana/data';
import { getColorFromHexRgbOrName } from '../../utils';
import { DisplayValue, Themeable } from '../../types';
import { Themeable } from '../../types';
import { selectThemeVariant } from '../../themes';
import { Threshold } from '@grafana/data';
export interface Props extends Themeable {
height: number;
......
......@@ -4,8 +4,7 @@ import React, { PureComponent } from 'react';
import uniqBy from 'lodash/uniqBy';
// Types
import { GraphSeriesXY } from '../../types';
import { TimeRange } from '@grafana/data';
import { TimeRange, GraphSeriesXY } from '@grafana/data';
export interface GraphProps {
series: GraphSeriesXY[];
......
// Libraries
import _ from 'lodash';
import React from 'react';
import { css } from 'emotion';
import { GraphSeriesValue } from '@grafana/data';
import { Graph, GraphProps } from './Graph';
import { LegendRenderOptions, LegendItem, LegendDisplayMode } from '../Legend/Legend';
import { GraphLegend } from './GraphLegend';
import { CustomScrollbar } from '../CustomScrollbar/CustomScrollbar';
import { GraphSeriesValue } from '../../types/graph';
export type SeriesOptionChangeHandler<TOption> = (label: string, option: TOption) => void;
export type SeriesColorChangeHandler = SeriesOptionChangeHandler<string>;
......
......@@ -2,7 +2,7 @@ import React from 'react';
import { storiesOf } from '@storybook/react';
import { LegendList, LegendPlacement, LegendItem, LegendTable } from './Legend';
import tinycolor from 'tinycolor2';
import { DisplayValue } from '../../types/index';
import { DisplayValue } from '@grafana/data';
import { number, select, text } from '@storybook/addon-knobs';
import { action } from '@storybook/addon-actions';
import { GraphLegendListItem, GraphLegendTableRow, GraphLegendItemProps } from '../Graph/GraphLegendItem';
......
import { DisplayValue } from '../../types/index';
import { DisplayValue } from '@grafana/data';
import { LegendList } from './LegendList';
import { LegendTable } from './LegendTable';
......
import React from 'react';
import { InlineList } from '../List/InlineList';
import { css } from 'emotion';
import { DisplayValue } from '../../types/displayValue';
import { DisplayValue } from '@grafana/data';
import capitalize from 'lodash/capitalize';
const LegendItemStat: React.FunctionComponent<{ stat: DisplayValue }> = ({ stat }) => {
......
import React, { PureComponent } from 'react';
import { select, pie, arc, event } from 'd3';
import sum from 'lodash/sum';
import { DisplayValue } from '@grafana/data';
import { GrafanaThemeType, DisplayValue } from '../../types';
import { GrafanaThemeType } from '../../types';
import { Themeable } from '../../index';
import { colors as grafana_colors } from '../../utils/index';
......
......@@ -3,6 +3,4 @@ export * from './plugin';
export * from './app';
export * from './datasource';
export * from './theme';
export * from './graph';
export * from './input';
export * from './displayValue';
import { MappingType, ValueMapping, DisplayValue } from '@grafana/data';
import { getDisplayProcessor, getColorFromThreshold, DisplayProcessor, getDecimalsForValue } from './displayValue';
import { DisplayValue } from '../types';
import { MappingType, ValueMapping } from '@grafana/data';
function assertSame(input: any, processors: DisplayProcessor[], match: DisplayValue) {
processors.forEach(processor => {
......
// Libraries
import _ from 'lodash';
import {
DateTime,
dateTime,
Threshold,
getMappedValue,
Field,
DecimalInfo,
DisplayValue,
DecimalCount,
} from '@grafana/data';
// Utils
import { getValueFormat } from './valueFormats/valueFormats';
import { getColorFromHexRgbOrName } from './namedColorsPalette';
// Types
import { DecimalInfo, DisplayValue, GrafanaTheme, GrafanaThemeType, DecimalCount } from '../types';
import { DateTime, dateTime, Threshold, getMappedValue, Field } from '@grafana/data';
import { GrafanaTheme, GrafanaThemeType } from '../types';
export type DisplayProcessor = (value: any) => DisplayValue;
......
import {
ReducerID,
reduceField,
FieldType,
NullValueMode,
DataFrame,
Field,
DisplayValue,
GraphSeriesValue,
} from '@grafana/data';
import toNumber from 'lodash/toNumber';
import toString from 'lodash/toString';
import { DisplayValue, GrafanaTheme, InterpolateFunction, ScopedVars, GraphSeriesValue } from '../types/index';
import { GrafanaTheme, InterpolateFunction, ScopedVars } from '../types/index';
import { getDisplayProcessor } from './displayValue';
import { getFlotPairs } from './flotPairs';
import { ReducerID, reduceField, FieldType, NullValueMode, DataFrame, Field } from '@grafana/data';
export interface FieldDisplayOptions {
values?: boolean; // If true show each row value
......
// Types
import { GraphSeriesValue } from '../types/index';
import { NullValueMode, DataFrame } from '@grafana/data';
import { NullValueMode, DataFrame, GraphSeriesValue } from '@grafana/data';
export interface FlotPairsOptions {
series: DataFrame;
......
import { DecimalCount } from '@grafana/data';
import { toFixed } from './valueFormats';
import { DecimalCount } from '../../types';
export function toPercent(size: number, decimals: DecimalCount) {
if (size === null) {
......
import { toUtc, toDuration as duration, dateTime, DecimalCount } from '@grafana/data';
import { toFixed, toFixedScaled } from './valueFormats';
import { DecimalCount } from '../../types';
import { toUtc, toDuration as duration, dateTime } from '@grafana/data';
interface IntervalsInSeconds {
[interval: string]: number;
......
import { DecimalCount } from '@grafana/data';
import { scaledUnits } from './valueFormats';
import { DecimalCount } from '../../types';
export function currency(symbol: string) {
const units = ['', 'K', 'M', 'B', 'T'];
......
import { DecimalCount } from '@grafana/data';
import { getCategories } from './categories';
import { DecimalCount } from '../../types';
export type ValueFormatter = (
value: number,
......
import { getFlotTickDecimals } from 'app/core/utils/ticks';
import _ from 'lodash';
import { getValueFormat, ValueFormatter, DecimalCount } from '@grafana/ui';
import { stringToJsRegex } from '@grafana/data';
import { getValueFormat, ValueFormatter } from '@grafana/ui';
import { stringToJsRegex, DecimalCount } from '@grafana/data';
function matchSeriesOverride(aliasOrRegex: string, seriesAlias: string) {
if (!aliasOrRegex) {
......
......@@ -3,7 +3,7 @@ import $ from 'jquery';
import _ from 'lodash';
//@ts-ignore
import Drop from 'tether-drop';
import { CreatePlotOverlay } from '@grafana/ui';
import { CreatePlotOverlay } from '@grafana/data';
/** @ngInject */
const createAnnotationToolip: CreatePlotOverlay = (element, event, plot) => {
......
import React from 'react';
import { GraphSeriesXY, PanelData } from '@grafana/ui';
import { PanelData } from '@grafana/ui';
import { GraphSeriesXY } from '@grafana/data';
import difference from 'lodash/difference';
import { getGraphSeriesModel } from './getGraphSeriesModel';
import { Options, SeriesOptions } from './types';
import { SeriesColorChangeHandler, SeriesAxisToggleHandler } from '@grafana/ui/src/components/Graph/GraphWithLegend';
......
import {
GraphSeriesXY,
colors,
getFlotPairs,
getColorFromHexRgbOrName,
getDisplayProcessor,
DisplayValue,
PanelData,
} from '@grafana/ui';
import { NullValueMode, reduceField, FieldCache, FieldType } from '@grafana/data';
import { colors, getFlotPairs, getColorFromHexRgbOrName, getDisplayProcessor, PanelData } from '@grafana/ui';
import { NullValueMode, reduceField, FieldCache, FieldType, DisplayValue, GraphSeriesXY } from '@grafana/data';
import { SeriesOptions, GraphOptions } from './types';
import { GraphLegendEditorLegendOptions } from './GraphLegendEditor';
......
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