diff --git a/public/app/plugins/panel/gauge/Threshold.test.tsx b/packages/grafana-ui/src/components/Thresholds/Threshold.test.tsx similarity index 91% rename from public/app/plugins/panel/gauge/Threshold.test.tsx rename to packages/grafana-ui/src/components/Thresholds/Threshold.test.tsx index 852b9f4c104..eac82e1b0f4 100644 --- a/public/app/plugins/panel/gauge/Threshold.test.tsx +++ b/packages/grafana-ui/src/components/Thresholds/Threshold.test.tsx @@ -1,10 +1,10 @@ import React from 'react'; import { shallow } from 'enzyme'; -import Thresholds from './Thresholds'; -import { defaultProps } from './GaugePanelOptions'; -import { BasicGaugeColor } from 'app/types'; import { PanelOptionsProps } from '@grafana/ui'; -import { Options } from './types'; +import { defaultProps } from 'app/plugins/panel/gauge/GaugePanelOptions'; +import { Options } from 'app/plugins/panel/gauge/types'; +import { BasicGaugeColor } from 'app/types'; +import { Thresholds } from './Thresholds'; const setup = (propOverrides?: object) => { const props: PanelOptionsProps = { diff --git a/public/app/plugins/panel/gauge/Thresholds.tsx b/packages/grafana-ui/src/components/Thresholds/Thresholds.tsx similarity index 96% rename from public/app/plugins/panel/gauge/Thresholds.tsx rename to packages/grafana-ui/src/components/Thresholds/Thresholds.tsx index 7699a499146..b5885e4efe8 100644 --- a/public/app/plugins/panel/gauge/Thresholds.tsx +++ b/packages/grafana-ui/src/components/Thresholds/Thresholds.tsx @@ -1,16 +1,16 @@ import React, { PureComponent } from 'react'; import tinycolor from 'tinycolor2'; import { ColorPicker } from '@grafana/ui'; -import { BasicGaugeColor, Threshold } from 'app/types'; -import { PanelOptionsProps } from '@grafana/ui'; -import { Options } from './types'; +import { BasicGaugeColor } from 'app/types'; +import { PanelOptionsProps, Threshold } from '@grafana/ui'; +import { Options } from 'app/plugins/panel/gauge/types'; interface State { thresholds: Threshold[]; baseColor: string; } -export default class Thresholds extends PureComponent, State> { +export class Thresholds extends PureComponent, State> { constructor(props) { super(props); diff --git a/public/sass/components/_thresholds.scss b/packages/grafana-ui/src/components/Thresholds/_Thresholds.scss similarity index 100% rename from public/sass/components/_thresholds.scss rename to packages/grafana-ui/src/components/Thresholds/_Thresholds.scss diff --git a/packages/grafana-ui/src/components/index.scss b/packages/grafana-ui/src/components/index.scss index e1d1474bb16..d0a81675490 100644 --- a/packages/grafana-ui/src/components/index.scss +++ b/packages/grafana-ui/src/components/index.scss @@ -1,3 +1,4 @@ @import 'CustomScrollbar/CustomScrollbar'; @import 'DeleteButton/DeleteButton'; +@import 'Thresholds/Thresholds'; @import 'Tooltip/Tooltip'; diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index b2b607415b8..fef3f6604c9 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -5,3 +5,4 @@ export { CustomScrollbar } from './CustomScrollbar/CustomScrollbar'; export { ColorPicker } from './ColorPicker/ColorPicker'; export { SeriesColorPickerPopover } from './ColorPicker/SeriesColorPickerPopover'; export { SeriesColorPicker } from './ColorPicker/SeriesColorPicker'; +export { Thresholds } from './Thresholds/Thresholds'; diff --git a/packages/grafana-ui/src/types/panel.ts b/packages/grafana-ui/src/types/panel.ts index 44336555a81..46fe84a211c 100644 --- a/packages/grafana-ui/src/types/panel.ts +++ b/packages/grafana-ui/src/types/panel.ts @@ -29,3 +29,9 @@ export interface PanelMenuItem { shortcut?: string; subMenu?: PanelMenuItem[]; } + +export interface Threshold { + index: number; + value: number; + color?: string; +} diff --git a/public/app/plugins/panel/gauge/GaugePanelOptions.tsx b/public/app/plugins/panel/gauge/GaugePanelOptions.tsx index 2b16ef5a1fe..7b627a09592 100644 --- a/public/app/plugins/panel/gauge/GaugePanelOptions.tsx +++ b/public/app/plugins/panel/gauge/GaugePanelOptions.tsx @@ -1,8 +1,7 @@ import React, { PureComponent } from 'react'; import ValueOptions from 'app/plugins/panel/gauge/ValueOptions'; -import Thresholds from 'app/plugins/panel/gauge/Thresholds'; import { BasicGaugeColor } from 'app/types'; -import { PanelOptionsProps } from '@grafana/ui'; +import { PanelOptionsProps, Thresholds } from '@grafana/ui'; import ValueMappings from 'app/plugins/panel/gauge/ValueMappings'; import { Options } from './types'; import GaugeOptions from './GaugeOptions'; diff --git a/public/app/types/index.ts b/public/app/types/index.ts index ab52b03ab17..52b2b996542 100644 --- a/public/app/types/index.ts +++ b/public/app/types/index.ts @@ -9,7 +9,7 @@ import { ApiKey, ApiKeysState, NewApiKey } from './apiKeys'; import { Invitee, OrgUser, User, UsersState, UserState } from './user'; import { DataSource, DataSourceSelectItem, DataSourcesState } from './datasources'; import { DataQuery, DataQueryResponse, DataQueryOptions } from './series'; -import { BasicGaugeColor, MappingType, RangeMap, Threshold, ValueMap } from './panel'; +import { BasicGaugeColor, MappingType, RangeMap, ValueMap } from './panel'; import { PluginDashboard, PluginMeta, Plugin, PanelPlugin, PluginsState } from './plugins'; import { Organization, OrganizationState } from './organization'; import { @@ -20,6 +20,7 @@ import { } from './appNotifications'; import { DashboardSearchHit } from './search'; import { ValidationEvents, ValidationRule } from './form'; +import { Threshold } from '@grafana/ui'; export { Team, TeamsState, diff --git a/public/app/types/panel.ts b/public/app/types/panel.ts index 31674d20304..1f5a2307733 100644 --- a/public/app/types/panel.ts +++ b/public/app/types/panel.ts @@ -1,9 +1,3 @@ -export interface Threshold { - index: number; - value: number; - color?: string; -} - export enum MappingType { ValueToText = 1, RangeToText = 2, diff --git a/public/sass/_grafana.scss b/public/sass/_grafana.scss index 10cc7335bdf..a3dd204eb63 100644 --- a/public/sass/_grafana.scss +++ b/public/sass/_grafana.scss @@ -102,7 +102,6 @@ @import 'components/toolbar'; @import 'components/add_data_source.scss'; @import 'components/page_loader'; -@import 'components/thresholds'; @import 'components/toggle_button_group'; @import 'components/value-mappings'; @import 'components/popover-box';