diff --git a/jest.config.js b/jest.config.js index e4d669edd8f..c5c6bcb9f5f 100644 --- a/jest.config.js +++ b/jest.config.js @@ -8,7 +8,7 @@ module.exports = { "roots": [ "/public/app", "/public/test", - "packages" + "/packages" ], "testRegex": "(\\.|/)(test)\\.(jsx?|tsx?)$", "moduleFileExtensions": [ diff --git a/packages/grafana-ui/package.json b/packages/grafana-ui/package.json index 39950d31d71..0c023817b9f 100644 --- a/packages/grafana-ui/package.json +++ b/packages/grafana-ui/package.json @@ -16,6 +16,7 @@ "react-highlight-words": "0.11.0", "@torkelo/react-select": "2.1.1", "react-transition-group": "^2.2.1", + "moment": "^2.22.2", "react-virtualized": "^9.21.0" }, "devDependencies": { diff --git a/packages/grafana-ui/src/index.ts b/packages/grafana-ui/src/index.ts index 07635cbbc8e..195d95f598d 100644 --- a/packages/grafana-ui/src/index.ts +++ b/packages/grafana-ui/src/index.ts @@ -1 +1,2 @@ export * from './components'; +export * from './types'; diff --git a/packages/grafana-ui/src/types/index.ts b/packages/grafana-ui/src/types/index.ts new file mode 100644 index 00000000000..0ca60a90923 --- /dev/null +++ b/packages/grafana-ui/src/types/index.ts @@ -0,0 +1 @@ +export * from './series'; diff --git a/packages/grafana-ui/src/types/series.ts b/packages/grafana-ui/src/types/series.ts new file mode 100644 index 00000000000..9c79ebdc99f --- /dev/null +++ b/packages/grafana-ui/src/types/series.ts @@ -0,0 +1,13 @@ +import { Moment } from 'moment'; + +export enum LoadingState { + NotStarted = 'NotStarted', + Loading = 'Loading', + Done = 'Done', + Error = 'Error', +} + +export interface RawTimeRange { + from: Moment | string; + to: Moment | string; +} diff --git a/public/app/features/dashboard/dashgrid/DataPanel.tsx b/public/app/features/dashboard/dashgrid/DataPanel.tsx index 9926410f40d..2a72b16d60f 100644 --- a/public/app/features/dashboard/dashgrid/DataPanel.tsx +++ b/public/app/features/dashboard/dashgrid/DataPanel.tsx @@ -8,7 +8,8 @@ import { getDatasourceSrv, DatasourceSrv } from 'app/features/plugins/datasource import kbn from 'app/core/utils/kbn'; // Types -import { TimeRange, LoadingState, DataQueryOptions, DataQueryResponse, TimeSeries } from 'app/types'; +import { TimeRange, DataQueryOptions, DataQueryResponse, TimeSeries } from 'app/types'; +import { LoadingState } from '@grafana/ui'; interface RenderProps { loading: LoadingState; diff --git a/public/app/types/index.ts b/public/app/types/index.ts index f2a5f807645..dd84f4acf7d 100644 --- a/public/app/types/index.ts +++ b/public/app/types/index.ts @@ -10,7 +10,6 @@ import { Invitee, OrgUser, User, UsersState, UserState } from './user'; import { DataSource, DataSourceSelectItem, DataSourcesState } from './datasources'; import { TimeRange, - LoadingState, TimeSeries, TimeSeriesVM, TimeSeriesVMs, @@ -69,7 +68,6 @@ export { User, UsersState, TimeRange, - LoadingState, PanelPlugin, PanelProps, PanelOptionsProps, diff --git a/public/app/types/panel.ts b/public/app/types/panel.ts index af371e16573..d5db8256670 100644 --- a/public/app/types/panel.ts +++ b/public/app/types/panel.ts @@ -1,4 +1,5 @@ -import { LoadingState, TimeSeries, TimeRange } from './series'; +import { TimeSeries, TimeRange } from './series'; +import { LoadingState } from '@grafana/ui'; export interface PanelProps { timeSeries: TimeSeries[]; diff --git a/public/app/types/series.ts b/public/app/types/series.ts index a9585a2c842..f7e196a03f5 100644 --- a/public/app/types/series.ts +++ b/public/app/types/series.ts @@ -1,13 +1,6 @@ import { Moment } from 'moment'; import { PluginMeta } from './plugins'; -export enum LoadingState { - NotStarted = 'NotStarted', - Loading = 'Loading', - Done = 'Done', - Error = 'Error', -} - export interface RawTimeRange { from: Moment | string; to: Moment | string;