mirror of
https://github.com/grafana/grafana.git
synced 2025-08-01 18:26:52 +08:00
Moved data source and data query types
This commit is contained in:
@ -1,4 +1,6 @@
|
|||||||
import { TimeSeries, TimeRange, RawTimeRange, PluginExports, PluginMeta } from '@grafana/ui/src/types';
|
import { TimeRange, RawTimeRange } from './time';
|
||||||
|
import { TimeSeries } from './series';
|
||||||
|
import { PluginExports, PluginMeta } from './plugin';
|
||||||
|
|
||||||
export interface DataQueryResponse {
|
export interface DataQueryResponse {
|
||||||
data: TimeSeries[];
|
data: TimeSeries[];
|
@ -2,3 +2,4 @@ export * from './series';
|
|||||||
export * from './time';
|
export * from './time';
|
||||||
export * from './panel';
|
export * from './panel';
|
||||||
export * from './plugin';
|
export * from './plugin';
|
||||||
|
export * from './datasource';
|
||||||
|
@ -1,14 +1,18 @@
|
|||||||
|
// Libraries
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { colors, RawTimeRange, IntervalValues } from '@grafana/ui';
|
|
||||||
|
|
||||||
|
// Services & Utils
|
||||||
import * as dateMath from 'app/core/utils/datemath';
|
import * as dateMath from 'app/core/utils/datemath';
|
||||||
import { renderUrl } from 'app/core/utils/url';
|
import { renderUrl } from 'app/core/utils/url';
|
||||||
import kbn from 'app/core/utils/kbn';
|
import kbn from 'app/core/utils/kbn';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import { parse as parseDate } from 'app/core/utils/datemath';
|
import { parse as parseDate } from 'app/core/utils/datemath';
|
||||||
|
import { colors } from '@grafana/ui';
|
||||||
import TimeSeries from 'app/core/time_series2';
|
|
||||||
import TableModel, { mergeTablesIntoModel } from 'app/core/table_model';
|
import TableModel, { mergeTablesIntoModel } from 'app/core/table_model';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { RawTimeRange, IntervalValues, DataQuery } from '@grafana/ui/src/types';
|
||||||
|
import TimeSeries from 'app/core/time_series2';
|
||||||
import {
|
import {
|
||||||
ExploreUrlState,
|
ExploreUrlState,
|
||||||
HistoryItem,
|
HistoryItem,
|
||||||
@ -17,7 +21,6 @@ import {
|
|||||||
QueryIntervals,
|
QueryIntervals,
|
||||||
QueryOptions,
|
QueryOptions,
|
||||||
} from 'app/types/explore';
|
} from 'app/types/explore';
|
||||||
import { DataQuery } from 'app/types/series';
|
|
||||||
|
|
||||||
export const DEFAULT_RANGE = {
|
export const DEFAULT_RANGE = {
|
||||||
from: 'now-6h',
|
from: 'now-6h',
|
||||||
|
@ -12,8 +12,7 @@ import { getDatasourceSrv, DatasourceSrv } from 'app/features/plugins/datasource
|
|||||||
import kbn from 'app/core/utils/kbn';
|
import kbn from 'app/core/utils/kbn';
|
||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { DataQueryOptions, DataQueryResponse } from 'app/types';
|
import { TimeRange, TimeSeries, LoadingState, DataQueryResponse, DataQueryOptions } from '@grafana/ui/src/types';
|
||||||
import { TimeRange, TimeSeries, LoadingState } from '@grafana/ui';
|
|
||||||
|
|
||||||
const DEFAULT_PLUGIN_ERROR = 'Error in plugin';
|
const DEFAULT_PLUGIN_ERROR = 'Error in plugin';
|
||||||
|
|
||||||
|
@ -18,7 +18,8 @@ import config from 'app/core/config';
|
|||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../panel_model';
|
||||||
import { DashboardModel } from '../dashboard_model';
|
import { DashboardModel } from '../dashboard_model';
|
||||||
import { DataQuery, DataSourceSelectItem } from 'app/types';
|
import { DataQuery } from '@grafana/ui';
|
||||||
|
import { DataSourceSelectItem } from 'app/types';
|
||||||
import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
import { PluginHelp } from 'app/core/components/PluginHelp/PluginHelp';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
|
@ -10,7 +10,7 @@ import { Emitter } from 'app/core/utils/emitter';
|
|||||||
|
|
||||||
// Types
|
// Types
|
||||||
import { PanelModel } from '../panel_model';
|
import { PanelModel } from '../panel_model';
|
||||||
import { DataQuery, DataSourceApi } from 'app/types/series';
|
import { DataQuery, DataSourceApi } from '@grafana/ui';
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
panel: PanelModel;
|
panel: PanelModel;
|
||||||
|
@ -1,7 +1,10 @@
|
|||||||
import { Emitter } from 'app/core/utils/emitter';
|
// Libraries
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
import { PANEL_OPTIONS_KEY_PREFIX } from 'app/core/constants';
|
import { PANEL_OPTIONS_KEY_PREFIX } from 'app/core/constants';
|
||||||
import { DataQuery } from 'app/types';
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
|
|
||||||
export interface GridPos {
|
export interface GridPos {
|
||||||
x: number;
|
x: number;
|
||||||
|
@ -1,19 +1,25 @@
|
|||||||
|
// Libraries
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { hot } from 'react-hot-loader';
|
import { hot } from 'react-hot-loader';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
import { AutoSizer } from 'react-virtualized';
|
import { AutoSizer } from 'react-virtualized';
|
||||||
import { RawTimeRange, TimeRange } from '@grafana/ui';
|
|
||||||
|
|
||||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
// Services & Utils
|
||||||
import { ExploreItemState, ExploreUrlState, RangeScanner, ExploreId } from 'app/types/explore';
|
|
||||||
import { DataQuery } from 'app/types/series';
|
|
||||||
import { StoreState } from 'app/types';
|
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import { LAST_USED_DATASOURCE_KEY, ensureQueries, DEFAULT_RANGE } from 'app/core/utils/explore';
|
|
||||||
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
|
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
|
||||||
|
|
||||||
|
// Components
|
||||||
|
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||||
|
import { DataSourcePicker } from 'app/core/components/Select/DataSourcePicker';
|
||||||
|
import { Alert } from './Error';
|
||||||
|
import ErrorBoundary from './ErrorBoundary';
|
||||||
|
import GraphContainer from './GraphContainer';
|
||||||
|
import LogsContainer from './LogsContainer';
|
||||||
|
import QueryRows from './QueryRows';
|
||||||
|
import TableContainer from './TableContainer';
|
||||||
|
import TimePicker, { parseTime } from './TimePicker';
|
||||||
|
|
||||||
|
// Actions
|
||||||
import {
|
import {
|
||||||
changeDatasource,
|
changeDatasource,
|
||||||
changeSize,
|
changeSize,
|
||||||
@ -29,13 +35,12 @@ import {
|
|||||||
splitOpen,
|
splitOpen,
|
||||||
} from './state/actions';
|
} from './state/actions';
|
||||||
|
|
||||||
import { Alert } from './Error';
|
// Types
|
||||||
import ErrorBoundary from './ErrorBoundary';
|
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui';
|
||||||
import GraphContainer from './GraphContainer';
|
import { ExploreItemState, ExploreUrlState, RangeScanner, ExploreId } from 'app/types/explore';
|
||||||
import LogsContainer from './LogsContainer';
|
import { StoreState } from 'app/types';
|
||||||
import QueryRows from './QueryRows';
|
import { LAST_USED_DATASOURCE_KEY, ensureQueries, DEFAULT_RANGE } from 'app/core/utils/explore';
|
||||||
import TableContainer from './TableContainer';
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
import TimePicker, { parseTime } from './TimePicker';
|
|
||||||
|
|
||||||
interface ExploreProps {
|
interface ExploreProps {
|
||||||
StartPage?: any;
|
StartPage?: any;
|
||||||
|
@ -1,10 +1,14 @@
|
|||||||
|
// Libraries
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
|
||||||
|
// Services
|
||||||
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
import { getAngularLoader, AngularComponent } from 'app/core/services/AngularLoader';
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
|
||||||
import { getIntervals } from 'app/core/utils/explore';
|
import { getIntervals } from 'app/core/utils/explore';
|
||||||
import { DataQuery } from 'app/types';
|
|
||||||
import { RawTimeRange } from '@grafana/ui';
|
|
||||||
import { getTimeSrv } from 'app/features/dashboard/time_srv';
|
import { getTimeSrv } from 'app/features/dashboard/time_srv';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
|
import { RawTimeRange, DataQuery } from '@grafana/ui';
|
||||||
import 'app/features/plugins/plugin_loader';
|
import 'app/features/plugins/plugin_loader';
|
||||||
|
|
||||||
interface QueryEditorProps {
|
interface QueryEditorProps {
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
|
// Libraries
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
import _ from 'lodash';
|
||||||
import { hot } from 'react-hot-loader';
|
import { hot } from 'react-hot-loader';
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
import { RawTimeRange } from '@grafana/ui';
|
|
||||||
import _ from 'lodash';
|
|
||||||
|
|
||||||
import { QueryTransaction, HistoryItem, QueryHint, ExploreItemState, ExploreId } from 'app/types/explore';
|
// Components
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
|
||||||
import { DataQuery, StoreState } from 'app/types';
|
|
||||||
|
|
||||||
// import DefaultQueryField from './QueryField';
|
|
||||||
import QueryEditor from './QueryEditor';
|
import QueryEditor from './QueryEditor';
|
||||||
import QueryTransactionStatus from './QueryTransactionStatus';
|
import QueryTransactionStatus from './QueryTransactionStatus';
|
||||||
|
|
||||||
|
// Actions
|
||||||
import {
|
import {
|
||||||
addQueryRow,
|
addQueryRow,
|
||||||
changeQuery,
|
changeQuery,
|
||||||
@ -20,6 +18,12 @@ import {
|
|||||||
runQueries,
|
runQueries,
|
||||||
} from './state/actions';
|
} from './state/actions';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { RawTimeRange, DataQuery } from '@grafana/ui';
|
||||||
|
import { StoreState } from 'app/types';
|
||||||
|
import { QueryTransaction, HistoryItem, QueryHint, ExploreItemState, ExploreId } from 'app/types/explore';
|
||||||
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
|
|
||||||
function getFirstHintFromTransactions(transactions: QueryTransaction[]): QueryHint {
|
function getFirstHintFromTransactions(transactions: QueryTransaction[]): QueryHint {
|
||||||
const transaction = transactions.find(qt => qt.hints && qt.hints.length > 0);
|
const transaction = transactions.find(qt => qt.hints && qt.hints.length > 0);
|
||||||
if (transaction) {
|
if (transaction) {
|
||||||
|
@ -1,17 +1,21 @@
|
|||||||
|
// Libraries
|
||||||
import React, { PureComponent } from 'react';
|
import React, { PureComponent } from 'react';
|
||||||
|
|
||||||
import { Emitter } from 'app/core/utils/emitter';
|
// Components
|
||||||
import { DataQuery } from 'app/types';
|
|
||||||
import { ExploreId } from 'app/types/explore';
|
|
||||||
|
|
||||||
import QueryRow from './QueryRow';
|
import QueryRow from './QueryRow';
|
||||||
|
|
||||||
|
// Types
|
||||||
|
import { Emitter } from 'app/core/utils/emitter';
|
||||||
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
|
import { ExploreId } from 'app/types/explore';
|
||||||
|
|
||||||
interface QueryRowsProps {
|
interface QueryRowsProps {
|
||||||
className?: string;
|
className?: string;
|
||||||
exploreEvents: Emitter;
|
exploreEvents: Emitter;
|
||||||
exploreId: ExploreId;
|
exploreId: ExploreId;
|
||||||
initialQueries: DataQuery[];
|
initialQueries: DataQuery[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export default class QueryRows extends PureComponent<QueryRowsProps> {
|
export default class QueryRows extends PureComponent<QueryRowsProps> {
|
||||||
render() {
|
render() {
|
||||||
const { className = '', exploreEvents, exploreId, initialQueries } = this.props;
|
const { className = '', exploreEvents, exploreId, initialQueries } = this.props;
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
import { RawTimeRange, TimeRange } from '@grafana/ui';
|
// Types
|
||||||
|
|
||||||
import { Emitter } from 'app/core/core';
|
import { Emitter } from 'app/core/core';
|
||||||
|
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui';
|
||||||
import {
|
import {
|
||||||
ExploreId,
|
ExploreId,
|
||||||
ExploreItemState,
|
ExploreItemState,
|
||||||
@ -10,7 +10,6 @@ import {
|
|||||||
QueryTransaction,
|
QueryTransaction,
|
||||||
} from 'app/types/explore';
|
} from 'app/types/explore';
|
||||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||||
import { DataQuery } from 'app/types';
|
|
||||||
|
|
||||||
export enum ActionTypes {
|
export enum ActionTypes {
|
||||||
AddQueryRow = 'explore/ADD_QUERY_ROW',
|
AddQueryRow = 'explore/ADD_QUERY_ROW',
|
||||||
|
@ -17,7 +17,8 @@ import {
|
|||||||
import { updateLocation } from 'app/core/actions';
|
import { updateLocation } from 'app/core/actions';
|
||||||
import store from 'app/core/store';
|
import store from 'app/core/store';
|
||||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||||
import { DataQuery, StoreState } from 'app/types';
|
import { StoreState } from 'app/types';
|
||||||
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
import { getDatasourceSrv } from 'app/features/plugins/datasource_srv';
|
||||||
import {
|
import {
|
||||||
ExploreId,
|
ExploreId,
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
ensureQueries,
|
ensureQueries,
|
||||||
} from 'app/core/utils/explore';
|
} from 'app/core/utils/explore';
|
||||||
import { ExploreItemState, ExploreState, QueryTransaction } from 'app/types/explore';
|
import { ExploreItemState, ExploreState, QueryTransaction } from 'app/types/explore';
|
||||||
import { DataQuery } from 'app/types/series';
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
|
|
||||||
import { Action, ActionTypes } from './actionTypes';
|
import { Action, ActionTypes } from './actionTypes';
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import coreModule from 'app/core/core_module';
|
|||||||
import config from 'app/core/config';
|
import config from 'app/core/config';
|
||||||
import { importPluginModule } from './plugin_loader';
|
import { importPluginModule } from './plugin_loader';
|
||||||
|
|
||||||
import { DataSourceApi } from 'app/types/series';
|
import { DataSourceApi } from '@grafana/ui/src/types';
|
||||||
import { DataSource, DataSourceSelectItem } from 'app/types';
|
import { DataSource, DataSourceSelectItem } from 'app/types';
|
||||||
|
|
||||||
export class DatasourceSrv {
|
export class DatasourceSrv {
|
||||||
|
@ -3,6 +3,7 @@ import Cascader from 'rc-cascader';
|
|||||||
import PluginPrism from 'slate-prism';
|
import PluginPrism from 'slate-prism';
|
||||||
import Prism from 'prismjs';
|
import Prism from 'prismjs';
|
||||||
|
|
||||||
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
import { TypeaheadOutput } from 'app/types/explore';
|
import { TypeaheadOutput } from 'app/types/explore';
|
||||||
|
|
||||||
// dom also includes Element polyfills
|
// dom also includes Element polyfills
|
||||||
@ -10,7 +11,6 @@ import { getNextCharacter, getPreviousCousin } from 'app/features/explore/utils/
|
|||||||
import BracesPlugin from 'app/features/explore/slate-plugins/braces';
|
import BracesPlugin from 'app/features/explore/slate-plugins/braces';
|
||||||
import RunnerPlugin from 'app/features/explore/slate-plugins/runner';
|
import RunnerPlugin from 'app/features/explore/slate-plugins/runner';
|
||||||
import QueryField, { TypeaheadInput, QueryFieldState } from 'app/features/explore/QueryField';
|
import QueryField, { TypeaheadInput, QueryFieldState } from 'app/features/explore/QueryField';
|
||||||
import { DataQuery } from 'app/types';
|
|
||||||
|
|
||||||
const PRISM_SYNTAX = 'promql';
|
const PRISM_SYNTAX = 'promql';
|
||||||
|
|
||||||
|
@ -2,8 +2,7 @@ import _ from 'lodash';
|
|||||||
|
|
||||||
import * as dateMath from 'app/core/utils/datemath';
|
import * as dateMath from 'app/core/utils/datemath';
|
||||||
import { LogsStream, LogsModel, makeSeriesForLogs } from 'app/core/logs_model';
|
import { LogsStream, LogsModel, makeSeriesForLogs } from 'app/core/logs_model';
|
||||||
import { DataQuery } from 'app/types';
|
import { PluginMeta, DataQuery } from '@grafana/ui/src/types';
|
||||||
import { PluginMeta } from '@grafana/ui/src/types';
|
|
||||||
import { addLabelToSelector } from 'app/plugins/datasource/prometheus/add_label_to_query';
|
import { addLabelToSelector } from 'app/plugins/datasource/prometheus/add_label_to_query';
|
||||||
|
|
||||||
import LanguageProvider from './language_provider';
|
import LanguageProvider from './language_provider';
|
||||||
|
@ -11,7 +11,7 @@ import {
|
|||||||
} from 'app/types/explore';
|
} from 'app/types/explore';
|
||||||
import { parseSelector, labelRegexp, selectorRegexp } from 'app/plugins/datasource/prometheus/language_utils';
|
import { parseSelector, labelRegexp, selectorRegexp } from 'app/plugins/datasource/prometheus/language_utils';
|
||||||
import syntax from './syntax';
|
import syntax from './syntax';
|
||||||
import { DataQuery } from 'app/types';
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
|
|
||||||
const DEFAULT_KEYS = ['job', 'namespace'];
|
const DEFAULT_KEYS = ['job', 'namespace'];
|
||||||
const EMPTY_SELECTOR = '{}';
|
const EMPTY_SELECTOR = '{}';
|
||||||
|
@ -11,7 +11,7 @@ import { getNextCharacter, getPreviousCousin } from 'app/features/explore/utils/
|
|||||||
import BracesPlugin from 'app/features/explore/slate-plugins/braces';
|
import BracesPlugin from 'app/features/explore/slate-plugins/braces';
|
||||||
import RunnerPlugin from 'app/features/explore/slate-plugins/runner';
|
import RunnerPlugin from 'app/features/explore/slate-plugins/runner';
|
||||||
import QueryField, { TypeaheadInput, QueryFieldState } from 'app/features/explore/QueryField';
|
import QueryField, { TypeaheadInput, QueryFieldState } from 'app/features/explore/QueryField';
|
||||||
import { DataQuery } from 'app/types';
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
|
|
||||||
const HISTOGRAM_GROUP = '__histograms__';
|
const HISTOGRAM_GROUP = '__histograms__';
|
||||||
const METRIC_MARK = 'metric';
|
const METRIC_MARK = 'metric';
|
||||||
|
@ -11,7 +11,7 @@ import { BackendSrv } from 'app/core/services/backend_srv';
|
|||||||
import addLabelToQuery from './add_label_to_query';
|
import addLabelToQuery from './add_label_to_query';
|
||||||
import { getQueryHints } from './query_hints';
|
import { getQueryHints } from './query_hints';
|
||||||
import { expandRecordingRules } from './language_utils';
|
import { expandRecordingRules } from './language_utils';
|
||||||
import { DataQuery } from 'app/types';
|
import { DataQuery } from '@grafana/ui/src/types';
|
||||||
import { ExploreUrlState } from 'app/types/explore';
|
import { ExploreUrlState } from 'app/types/explore';
|
||||||
|
|
||||||
export function alignRange(start, end, step) {
|
export function alignRange(start, end, step) {
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import { Value } from 'slate';
|
import { Value } from 'slate';
|
||||||
import { RawTimeRange, TimeRange } from '@grafana/ui';
|
import { RawTimeRange, TimeRange, DataQuery } from '@grafana/ui';
|
||||||
|
|
||||||
import { Emitter } from 'app/core/core';
|
import { Emitter } from 'app/core/core';
|
||||||
import { LogsModel } from 'app/core/logs_model';
|
import { LogsModel } from 'app/core/logs_model';
|
||||||
import TableModel from 'app/core/table_model';
|
import TableModel from 'app/core/table_model';
|
||||||
import { DataSourceSelectItem } from 'app/types/datasources';
|
import { DataSourceSelectItem } from 'app/types/datasources';
|
||||||
|
|
||||||
import { DataQuery } from './series';
|
|
||||||
|
|
||||||
export interface CompletionItem {
|
export interface CompletionItem {
|
||||||
/**
|
/**
|
||||||
* The label of this completion item. By default
|
* The label of this completion item. By default
|
||||||
|
@ -8,7 +8,6 @@ export * from './acl';
|
|||||||
export * from './apiKeys';
|
export * from './apiKeys';
|
||||||
export * from './user';
|
export * from './user';
|
||||||
export * from './datasources';
|
export * from './datasources';
|
||||||
export * from './series';
|
|
||||||
export * from './plugins';
|
export * from './plugins';
|
||||||
export * from './organization';
|
export * from './organization';
|
||||||
export * from './appNotifications';
|
export * from './appNotifications';
|
||||||
|
Reference in New Issue
Block a user