mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Refactor: move ScopedVars to grafana/data (#18992)
This commit is contained in:
parent
ca96d794e2
commit
7520ebadac
9
packages/grafana-data/src/types/ScopedVars.ts
Normal file
9
packages/grafana-data/src/types/ScopedVars.ts
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
export interface ScopedVar<T = any> {
|
||||||
|
text: any;
|
||||||
|
value: T;
|
||||||
|
[key: string]: any;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScopedVars {
|
||||||
|
[key: string]: ScopedVar;
|
||||||
|
}
|
@ -10,3 +10,4 @@ export * from './utils';
|
|||||||
export * from './valueMapping';
|
export * from './valueMapping';
|
||||||
export * from './displayValue';
|
export * from './displayValue';
|
||||||
export * from './graph';
|
export * from './graph';
|
||||||
|
export * from './ScopedVars';
|
||||||
|
@ -13,11 +13,16 @@ describe('dataFrameHelper', () => {
|
|||||||
});
|
});
|
||||||
const ext = new FieldCache(frame);
|
const ext = new FieldCache(frame);
|
||||||
|
|
||||||
it('Should get the first field with a duplicate name', () => {
|
it('should get the first field with a duplicate name', () => {
|
||||||
const field = ext.getFieldByName('value');
|
const field = ext.getFieldByName('value');
|
||||||
expect(field!.name).toEqual('value');
|
expect(field!.name).toEqual('value');
|
||||||
expect(field!.values.toJSON()).toEqual([1, 2, 3]);
|
expect(field!.values.toJSON()).toEqual([1, 2, 3]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should return index of the field', () => {
|
||||||
|
const field = ext.getFirstFieldOfType(FieldType.number);
|
||||||
|
expect(field!.index).toEqual(2);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('FieldCache', () => {
|
describe('FieldCache', () => {
|
||||||
|
@ -5,16 +5,22 @@ import { ArrayVector, MutableVector, vectorToArray, CircularVector } from './vec
|
|||||||
import isArray from 'lodash/isArray';
|
import isArray from 'lodash/isArray';
|
||||||
import isString from 'lodash/isString';
|
import isString from 'lodash/isString';
|
||||||
|
|
||||||
|
interface FieldWithIndex extends Field {
|
||||||
|
index: number;
|
||||||
|
}
|
||||||
export class FieldCache {
|
export class FieldCache {
|
||||||
fields: Field[] = [];
|
fields: FieldWithIndex[] = [];
|
||||||
|
|
||||||
private fieldByName: { [key: string]: Field } = {};
|
private fieldByName: { [key: string]: FieldWithIndex } = {};
|
||||||
private fieldByType: { [key: string]: Field[] } = {};
|
private fieldByType: { [key: string]: FieldWithIndex[] } = {};
|
||||||
|
|
||||||
constructor(private data: DataFrame) {
|
constructor(data: DataFrame) {
|
||||||
this.fields = data.fields;
|
this.fields = data.fields.map((field, idx) => ({
|
||||||
|
...field,
|
||||||
|
index: idx,
|
||||||
|
}));
|
||||||
|
|
||||||
for (const field of data.fields) {
|
for (const [index, field] of data.fields.entries()) {
|
||||||
// Make sure it has a type
|
// Make sure it has a type
|
||||||
if (field.type === FieldType.other) {
|
if (field.type === FieldType.other) {
|
||||||
const t = guessFieldTypeForField(field);
|
const t = guessFieldTypeForField(field);
|
||||||
@ -25,19 +31,22 @@ export class FieldCache {
|
|||||||
if (!this.fieldByType[field.type]) {
|
if (!this.fieldByType[field.type]) {
|
||||||
this.fieldByType[field.type] = [];
|
this.fieldByType[field.type] = [];
|
||||||
}
|
}
|
||||||
this.fieldByType[field.type].push(field);
|
this.fieldByType[field.type].push({
|
||||||
|
...field,
|
||||||
|
index,
|
||||||
|
});
|
||||||
|
|
||||||
if (this.fieldByName[field.name]) {
|
if (this.fieldByName[field.name]) {
|
||||||
console.warn('Duplicate field names in DataFrame: ', field.name);
|
console.warn('Duplicate field names in DataFrame: ', field.name);
|
||||||
} else {
|
} else {
|
||||||
this.fieldByName[field.name] = field;
|
this.fieldByName[field.name] = { ...field, index };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
getFields(type?: FieldType): Field[] {
|
getFields(type?: FieldType): FieldWithIndex[] {
|
||||||
if (!type) {
|
if (!type) {
|
||||||
return [...this.data.fields]; // All fields
|
return [...this.fields]; // All fields
|
||||||
}
|
}
|
||||||
const fields = this.fieldByType[type];
|
const fields = this.fieldByType[type];
|
||||||
if (fields) {
|
if (fields) {
|
||||||
@ -51,7 +60,7 @@ export class FieldCache {
|
|||||||
return types && types.length > 0;
|
return types && types.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
getFirstFieldOfType(type: FieldType): Field | undefined {
|
getFirstFieldOfType(type: FieldType): FieldWithIndex | undefined {
|
||||||
const arr = this.fieldByType[type];
|
const arr = this.fieldByType[type];
|
||||||
if (arr && arr.length > 0) {
|
if (arr && arr.length > 0) {
|
||||||
return arr[0];
|
return arr[0];
|
||||||
@ -66,7 +75,7 @@ export class FieldCache {
|
|||||||
/**
|
/**
|
||||||
* Returns the first field with the given name.
|
* Returns the first field with the given name.
|
||||||
*/
|
*/
|
||||||
getFieldByName(name: string): Field | undefined {
|
getFieldByName(name: string): FieldWithIndex | undefined {
|
||||||
return this.fieldByName[name];
|
return this.fieldByName[name];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
import { ScopedVars, DataSourceApi } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
import { DataSourceApi } from '@grafana/ui';
|
||||||
|
|
||||||
export interface DataSourceSrv {
|
export interface DataSourceSrv {
|
||||||
get(name?: string, scopedVars?: ScopedVars): Promise<DataSourceApi>;
|
get(name?: string, scopedVars?: ScopedVars): Promise<DataSourceApi>;
|
||||||
|
@ -4,8 +4,8 @@ import { Table } from './Table';
|
|||||||
import { getTheme } from '../../themes';
|
import { getTheme } from '../../themes';
|
||||||
|
|
||||||
import { migratedTestTable, migratedTestStyles, simpleTable } from './examples';
|
import { migratedTestTable, migratedTestStyles, simpleTable } from './examples';
|
||||||
import { ScopedVars, GrafanaThemeType } from '../../types/index';
|
import { GrafanaThemeType } from '../../types/index';
|
||||||
import { DataFrame, FieldType, ArrayVector } from '@grafana/data';
|
import { DataFrame, FieldType, ArrayVector, ScopedVars } from '@grafana/data';
|
||||||
import { withFullSizeStory } from '../../utils/storybook/withFullSizeStory';
|
import { withFullSizeStory } from '../../utils/storybook/withFullSizeStory';
|
||||||
import { number, boolean } from '@storybook/addon-knobs';
|
import { number, boolean } from '@storybook/addon-knobs';
|
||||||
|
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
LoadingState,
|
LoadingState,
|
||||||
DataFrameDTO,
|
DataFrameDTO,
|
||||||
AnnotationEvent,
|
AnnotationEvent,
|
||||||
|
ScopedVars,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
import { PluginMeta, GrafanaPlugin } from './plugin';
|
import { PluginMeta, GrafanaPlugin } from './plugin';
|
||||||
import { PanelData } from './panel';
|
import { PanelData } from './panel';
|
||||||
@ -435,16 +436,6 @@ export interface DataQueryError {
|
|||||||
cancelled?: boolean;
|
cancelled?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ScopedVar {
|
|
||||||
text: any;
|
|
||||||
value: any;
|
|
||||||
[key: string]: any;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ScopedVars {
|
|
||||||
[key: string]: ScopedVar;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
|
export interface DataQueryRequest<TQuery extends DataQuery = DataQuery> {
|
||||||
requestId: string; // Used to identify results and optionally cancel the request in backendSrv
|
requestId: string; // Used to identify results and optionally cancel the request in backendSrv
|
||||||
timezone: string;
|
timezone: string;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { ComponentClass, ComponentType } from 'react';
|
import { ComponentClass, ComponentType } from 'react';
|
||||||
import { LoadingState, DataFrame, TimeRange, TimeZone } from '@grafana/data';
|
import { LoadingState, DataFrame, TimeRange, TimeZone, ScopedVars } from '@grafana/data';
|
||||||
import { ScopedVars, DataQueryRequest, DataQueryError, LegacyResponseData } from './datasource';
|
import { DataQueryRequest, DataQueryError, LegacyResponseData } from './datasource';
|
||||||
import { PluginMeta, GrafanaPlugin } from './plugin';
|
import { PluginMeta, GrafanaPlugin } from './plugin';
|
||||||
|
|
||||||
export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;
|
export type InterpolateFunction = (value: string, scopedVars?: ScopedVars, format?: string | Function) => string;
|
||||||
|
@ -8,12 +8,13 @@ import {
|
|||||||
GraphSeriesValue,
|
GraphSeriesValue,
|
||||||
DataFrameView,
|
DataFrameView,
|
||||||
getTimeField,
|
getTimeField,
|
||||||
|
ScopedVars,
|
||||||
} from '@grafana/data';
|
} from '@grafana/data';
|
||||||
|
|
||||||
import toNumber from 'lodash/toNumber';
|
import toNumber from 'lodash/toNumber';
|
||||||
import toString from 'lodash/toString';
|
import toString from 'lodash/toString';
|
||||||
|
|
||||||
import { GrafanaTheme, InterpolateFunction, ScopedVars } from '../types/index';
|
import { GrafanaTheme, InterpolateFunction } from '../types/index';
|
||||||
import { getDisplayProcessor } from './displayProcessor';
|
import { getDisplayProcessor } from './displayProcessor';
|
||||||
import { getFlotPairs } from './flotPairs';
|
import { getFlotPairs } from './flotPairs';
|
||||||
import { DataLinkBuiltInVars } from '../utils/dataLinks';
|
import { DataLinkBuiltInVars } from '../utils/dataLinks';
|
||||||
|
@ -17,8 +17,8 @@ import config from 'app/core/config';
|
|||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DashboardModel, PanelModel } from '../state';
|
import { DashboardModel, PanelModel } from '../state';
|
||||||
import { ScopedVars, PanelData, PanelPlugin } from '@grafana/ui';
|
import { PanelData, PanelPlugin } from '@grafana/ui';
|
||||||
import { LoadingState } from '@grafana/data';
|
import { LoadingState, ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
const DEFAULT_PLUGIN_ERROR = 'Error in plugin';
|
const DEFAULT_PLUGIN_ERROR = 'Error in plugin';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
import { isEqual } from 'lodash';
|
import { isEqual } from 'lodash';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
import PanelHeaderCorner from './PanelHeaderCorner';
|
import PanelHeaderCorner from './PanelHeaderCorner';
|
||||||
import { PanelHeaderMenu } from './PanelHeaderMenu';
|
import { PanelHeaderMenu } from './PanelHeaderMenu';
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import React, { Component } from 'react';
|
import React, { Component } from 'react';
|
||||||
|
|
||||||
import { renderMarkdown, LinkModelSupplier } from '@grafana/data';
|
import { renderMarkdown, LinkModelSupplier, ScopedVars } from '@grafana/data';
|
||||||
import { Tooltip, ScopedVars, PopoverContent } from '@grafana/ui';
|
import { Tooltip, PopoverContent } from '@grafana/ui';
|
||||||
|
|
||||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import templateSrv from 'app/features/templating/template_srv';
|
import templateSrv from 'app/features/templating/template_srv';
|
||||||
|
@ -6,8 +6,8 @@ import { Emitter } from 'app/core/utils/emitter';
|
|||||||
import { getNextRefIdChar } from 'app/core/utils/query';
|
import { getNextRefIdChar } from 'app/core/utils/query';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DataQuery, ScopedVars, DataQueryResponseData, PanelPlugin } from '@grafana/ui';
|
import { DataQuery, DataQueryResponseData, PanelPlugin } from '@grafana/ui';
|
||||||
import { DataLink, DataTransformerConfig } from '@grafana/data';
|
import { DataLink, DataTransformerConfig, ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { PanelQueryRunner, QueryRunnerOptions } from './PanelQueryRunner';
|
import { PanelQueryRunner, QueryRunnerOptions } from './PanelQueryRunner';
|
||||||
import { PanelData, DataQueryRequest, DataStreamObserver, DataStreamState, ScopedVars } from '@grafana/ui';
|
import { PanelData, DataQueryRequest, DataStreamObserver, DataStreamState } from '@grafana/ui';
|
||||||
|
|
||||||
import { LoadingState, MutableDataFrame } from '@grafana/data';
|
import { LoadingState, MutableDataFrame, ScopedVars } from '@grafana/data';
|
||||||
import { dateTime } from '@grafana/data';
|
import { dateTime } from '@grafana/data';
|
||||||
import { SHARED_DASHBODARD_QUERY } from 'app/plugins/datasource/dashboard/SharedQueryRunner';
|
import { SHARED_DASHBODARD_QUERY } from 'app/plugins/datasource/dashboard/SharedQueryRunner';
|
||||||
import { DashboardQuery } from 'app/plugins/datasource/dashboard/types';
|
import { DashboardQuery } from 'app/plugins/datasource/dashboard/types';
|
||||||
|
@ -11,9 +11,9 @@ import { PanelQueryState } from './PanelQueryState';
|
|||||||
import { isSharedDashboardQuery, SharedQueryRunner } from 'app/plugins/datasource/dashboard/SharedQueryRunner';
|
import { isSharedDashboardQuery, SharedQueryRunner } from 'app/plugins/datasource/dashboard/SharedQueryRunner';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelData, DataQuery, ScopedVars, DataQueryRequest, DataSourceApi, DataSourceJsonData } from '@grafana/ui';
|
import { PanelData, DataQuery, DataQueryRequest, DataSourceApi, DataSourceJsonData } from '@grafana/ui';
|
||||||
|
|
||||||
import { TimeRange, DataTransformerConfig, transformDataFrame, toLegacyResponseData } from '@grafana/data';
|
import { TimeRange, DataTransformerConfig, transformDataFrame, toLegacyResponseData, ScopedVars } from '@grafana/data';
|
||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
|
|
||||||
export interface QueryRunnerOptions<
|
export interface QueryRunnerOptions<
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
import { PanelModel } from 'app/features/dashboard/state/PanelModel';
|
||||||
import { FieldDisplay, ScopedVars, DataLinkBuiltInVars } from '@grafana/ui';
|
import { FieldDisplay, DataLinkBuiltInVars } from '@grafana/ui';
|
||||||
import { LinkModelSupplier, getTimeField } from '@grafana/data';
|
import { LinkModelSupplier, getTimeField, ScopedVars } from '@grafana/data';
|
||||||
import { getLinkSrv } from './link_srv';
|
import { getLinkSrv } from './link_srv';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -3,8 +3,8 @@ import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
|||||||
import templateSrv, { TemplateSrv } from 'app/features/templating/template_srv';
|
import templateSrv, { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import coreModule from 'app/core/core_module';
|
import coreModule from 'app/core/core_module';
|
||||||
import { appendQueryToUrl, toUrlParams } from 'app/core/utils/url';
|
import { appendQueryToUrl, toUrlParams } from 'app/core/utils/url';
|
||||||
import { VariableSuggestion, ScopedVars, VariableOrigin, DataLinkBuiltInVars } from '@grafana/ui';
|
import { VariableSuggestion, VariableOrigin, DataLinkBuiltInVars } from '@grafana/ui';
|
||||||
import { DataLink, KeyValue, deprecationWarning, LinkModel } from '@grafana/data';
|
import { DataLink, KeyValue, deprecationWarning, LinkModel, ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
export const getPanelLinksVariableSuggestions = (): VariableSuggestion[] => [
|
export const getPanelLinksVariableSuggestions = (): VariableSuggestion[] => [
|
||||||
...templateSrv.variables.map(variable => ({
|
...templateSrv.variables.map(variable => ({
|
||||||
|
@ -8,7 +8,8 @@ import { importDataSourcePlugin } from './plugin_loader';
|
|||||||
import { DataSourceSrv as DataSourceService, getDataSourceSrv as getDataSourceService } from '@grafana/runtime';
|
import { DataSourceSrv as DataSourceService, getDataSourceSrv as getDataSourceService } from '@grafana/runtime';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DataSourceApi, DataSourceSelectItem, ScopedVars } from '@grafana/ui';
|
import { DataSourceApi, DataSourceSelectItem } from '@grafana/ui';
|
||||||
|
import { ScopedVars } from '@grafana/data';
|
||||||
import { auto } from 'angular';
|
import { auto } from 'angular';
|
||||||
import { TemplateSrv } from '../templating/template_srv';
|
import { TemplateSrv } from '../templating/template_srv';
|
||||||
|
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
import kbn from 'app/core/utils/kbn';
|
import kbn from 'app/core/utils/kbn';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { variableRegex } from 'app/features/templating/variable';
|
import { variableRegex } from 'app/features/templating/variable';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { TimeRange, ScopedVars } from '@grafana/data';
|
||||||
import { TimeRange } from '@grafana/data';
|
|
||||||
|
|
||||||
function luceneEscape(value: string) {
|
function luceneEscape(value: string) {
|
||||||
return value.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g, '\\$1');
|
return value.replace(/([\!\*\+\-\=<>\s\&\|\(\)\[\]\{\}\^\~\?\:\\/"])/g, '\\$1');
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
import angular, { IQService } from 'angular';
|
import angular, { IQService } from 'angular';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { dateMath } from '@grafana/data';
|
import { dateMath, ScopedVars } from '@grafana/data';
|
||||||
import kbn from 'app/core/utils/kbn';
|
import kbn from 'app/core/utils/kbn';
|
||||||
import { CloudWatchQuery } from './types';
|
import { CloudWatchQuery } from './types';
|
||||||
import { DataSourceApi, DataQueryRequest, DataSourceInstanceSettings, ScopedVars } from '@grafana/ui';
|
import { DataSourceApi, DataQueryRequest, DataSourceInstanceSettings } from '@grafana/ui';
|
||||||
import { BackendSrv } from 'app/core/services/backend_srv';
|
import { BackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
|
@ -1,11 +1,10 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { dateMath } from '@grafana/data';
|
import { dateMath, ScopedVars } from '@grafana/data';
|
||||||
import { isVersionGtOrEq, SemVersion } from 'app/core/utils/version';
|
import { isVersionGtOrEq, SemVersion } from 'app/core/utils/version';
|
||||||
import gfunc from './gfunc';
|
import gfunc from './gfunc';
|
||||||
import { IQService } from 'angular';
|
import { IQService } from 'angular';
|
||||||
import { BackendSrv } from 'app/core/services/backend_srv';
|
import { BackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
|
||||||
|
|
||||||
export class GraphiteDatasource {
|
export class GraphiteDatasource {
|
||||||
basicAuth: string;
|
basicAuth: string;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { Parser } from './parser';
|
import { Parser } from './parser';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
export default class GraphiteQuery {
|
export default class GraphiteQuery {
|
||||||
datasource: any;
|
datasource: any;
|
||||||
|
@ -2,7 +2,7 @@ import _ from 'lodash';
|
|||||||
import queryPart from './query_part';
|
import queryPart from './query_part';
|
||||||
import kbn from 'app/core/utils/kbn';
|
import kbn from 'app/core/utils/kbn';
|
||||||
import { InfluxQuery, InfluxQueryTag } from './types';
|
import { InfluxQuery, InfluxQueryTag } from './types';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
|
|
||||||
export default class InfluxQueryModel {
|
export default class InfluxQueryModel {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
export default class MysqlQuery {
|
export default class MysqlQuery {
|
||||||
target: any;
|
target: any;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { ScopedVars } from '@grafana/ui';
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
export default class PostgresQuery {
|
export default class PostgresQuery {
|
||||||
target: any;
|
target: any;
|
||||||
|
@ -3,7 +3,8 @@ import appEvents from 'app/core/app_events';
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import StackdriverMetricFindQuery from './StackdriverMetricFindQuery';
|
import StackdriverMetricFindQuery from './StackdriverMetricFindQuery';
|
||||||
import { StackdriverQuery, MetricDescriptor, StackdriverOptions } from './types';
|
import { StackdriverQuery, MetricDescriptor, StackdriverOptions } from './types';
|
||||||
import { DataSourceApi, DataQueryRequest, DataSourceInstanceSettings, ScopedVars } from '@grafana/ui';
|
import { DataSourceApi, DataQueryRequest, DataSourceInstanceSettings } from '@grafana/ui';
|
||||||
|
import { ScopedVars } from '@grafana/data';
|
||||||
import { BackendSrv } from 'app/core/services/backend_srv';
|
import { BackendSrv } from 'app/core/services/backend_srv';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
import { TimeSrv } from 'app/features/dashboard/services/TimeSrv';
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { getValueFormat, getColorFromHexRgbOrName, GrafanaThemeType, ScopedVars } from '@grafana/ui';
|
import { getValueFormat, getColorFromHexRgbOrName, GrafanaThemeType } from '@grafana/ui';
|
||||||
import { stringToJsRegex } from '@grafana/data';
|
import { stringToJsRegex, ScopedVars } from '@grafana/data';
|
||||||
import { ColumnStyle } from '@grafana/ui/src/components/Table/TableCellBuilder';
|
import { ColumnStyle } from '@grafana/ui/src/components/Table/TableCellBuilder';
|
||||||
import { dateTime } from '@grafana/data';
|
import { dateTime } from '@grafana/data';
|
||||||
import { TemplateSrv } from 'app/features/templating/template_srv';
|
import { TemplateSrv } from 'app/features/templating/template_srv';
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import TableModel from 'app/core/table_model';
|
import TableModel from 'app/core/table_model';
|
||||||
import { TableRenderer } from '../renderer';
|
import { TableRenderer } from '../renderer';
|
||||||
import { getColorDefinitionByName, ScopedVars } from '@grafana/ui';
|
import { getColorDefinitionByName } from '@grafana/ui';
|
||||||
|
import { ScopedVars } from '@grafana/data';
|
||||||
|
|
||||||
describe('when rendering table', () => {
|
describe('when rendering table', () => {
|
||||||
const SemiDarkOrange = getColorDefinitionByName('semi-dark-orange');
|
const SemiDarkOrange = getColorDefinitionByName('semi-dark-orange');
|
||||||
|
Loading…
Reference in New Issue
Block a user