diff --git a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx index a412c0c9d39..eac97548157 100644 --- a/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx +++ b/packages/grafana-ui/src/components/ColorPicker/ColorPicker.tsx @@ -4,6 +4,7 @@ import Popper, { RenderPopperArrowFn } from '../Tooltip/Popper'; import { ColorPickerPopover } from './ColorPickerPopover'; import { Themeable, GrafanaTheme } from '../../types'; import { getColorFromHexRgbOrName } from '../../utils/colorsPalette'; +import { SeriesColorPickerPopover } from './SeriesColorPickerPopover'; export interface ColorPickerProps extends Themeable { color: string; @@ -78,4 +79,5 @@ export const colorPickerFactory = ( }; }; -export default colorPickerFactory(ColorPickerPopover, 'ColorPicker'); +export const ColorPicker = colorPickerFactory(ColorPickerPopover, 'ColorPicker'); +export const SeriesColorPicker = colorPickerFactory(SeriesColorPickerPopover, 'SeriesColorPicker'); diff --git a/packages/grafana-ui/src/components/ColorPicker/SeriesColorPicker.tsx b/packages/grafana-ui/src/components/ColorPicker/SeriesColorPicker.tsx deleted file mode 100644 index c81e9ca8e86..00000000000 --- a/packages/grafana-ui/src/components/ColorPicker/SeriesColorPicker.tsx +++ /dev/null @@ -1,11 +0,0 @@ -import { SeriesColorPickerPopover } from './SeriesColorPickerPopover'; -import { ColorPickerProps, colorPickerFactory } from './ColorPicker'; - -export interface SeriesColorPickerProps extends ColorPickerProps { - yaxis?: number; - optionalClass?: string; - onToggleAxis?: () => void; - children: JSX.Element; -} - -export default colorPickerFactory(SeriesColorPickerPopover ,'SeriesColorPicker') diff --git a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx index a1677e58e91..520866ad7c8 100644 --- a/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx +++ b/packages/grafana-ui/src/components/ThresholdsEditor/ThresholdsEditor.tsx @@ -1,8 +1,6 @@ import React, { PureComponent } from 'react'; -// import tinycolor, { ColorInput } from 'tinycolor2'; - import { Threshold } from '../../types'; -import ColorPicker from '../ColorPicker/ColorPicker'; +import { ColorPicker } from '../ColorPicker/ColorPicker'; import { PanelOptionsGroup } from '../PanelOptionsGroup/PanelOptionsGroup'; import { colors } from '../../utils'; diff --git a/packages/grafana-ui/src/components/index.ts b/packages/grafana-ui/src/components/index.ts index 68f8a2c0467..6e8f55df05b 100644 --- a/packages/grafana-ui/src/components/index.ts +++ b/packages/grafana-ui/src/components/index.ts @@ -14,9 +14,8 @@ export { FormLabel } from './FormLabel/FormLabel'; export { FormField } from './FormField/FormField'; export { LoadingPlaceholder } from './LoadingPlaceholder/LoadingPlaceholder'; -export { default as ColorPicker } from './ColorPicker/ColorPicker'; +export { ColorPicker, SeriesColorPicker } from './ColorPicker/ColorPicker'; export { SeriesColorPickerPopover } from './ColorPicker/SeriesColorPickerPopover'; -export { default as SeriesColorPicker } from './ColorPicker/SeriesColorPicker'; export { ThresholdsEditor } from './ThresholdsEditor/ThresholdsEditor'; export { Graph } from './Graph/Graph'; export { PanelOptionsGroup } from './PanelOptionsGroup/PanelOptionsGroup'; diff --git a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts index 6e2dd148b90..71e059a5750 100644 --- a/public/app/plugins/panel/heatmap/heatmap_ctrl.ts +++ b/public/app/plugins/panel/heatmap/heatmap_ctrl.ts @@ -304,7 +304,6 @@ export class HeatmapCtrl extends MetricsPanelCtrl { } onCardColorChange(newColor) { - console.log(newColor) this.panel.color.cardColor = newColor; this.render(); } diff --git a/public/app/plugins/panel/table/specs/renderer.test.ts b/public/app/plugins/panel/table/specs/renderer.test.ts index f9ccc574c91..017dc6f0538 100644 --- a/public/app/plugins/panel/table/specs/renderer.test.ts +++ b/public/app/plugins/panel/table/specs/renderer.test.ts @@ -1,6 +1,7 @@ import _ from 'lodash'; import TableModel from 'app/core/table_model'; import { TableRenderer } from '../renderer'; +import { SemiDarkOrange } from '@grafana/ui/src/utils/colorsPalette'; describe('when rendering table', () => { describe('given 13 columns', () => { @@ -47,7 +48,7 @@ describe('when rendering table', () => { decimals: 1, colorMode: 'value', thresholds: [50, 80], - colors: ['green', 'orange', 'red'], + colors: ['#00ff00', SemiDarkOrange.name, 'rgb(1,0,0)'], }, { pattern: 'String', @@ -138,7 +139,7 @@ describe('when rendering table', () => { ], colorMode: 'value', thresholds: [1, 2], - colors: ['green', 'orange', 'red'], + colors: ['#00ff00', SemiDarkOrange.name, 'rgb(1,0,0)'], }, { pattern: 'RangeMappingColored', @@ -158,7 +159,7 @@ describe('when rendering table', () => { ], colorMode: 'value', thresholds: [2, 5], - colors: ['green', 'orange', 'red'], + colors: ['#00ff00', SemiDarkOrange.name, 'rgb(1,0,0)'], }, ], }; @@ -226,19 +227,19 @@ describe('when rendering table', () => { expect(html).toBe('asd'); }); - it('colored cell should have style', () => { + it('colored cell should have style (handles HEX color values)', () => { const html = renderer.renderCell(2, 0, 40); - expect(html).toBe('40.0'); + expect(html).toBe('40.0'); }); - it('colored cell should have style', () => { + it('colored cell should have style (handles named color values', () => { const html = renderer.renderCell(2, 0, 55); - expect(html).toBe('55.0'); + expect(html).toBe(`55.0`); }); - it('colored cell should have style', () => { + it('colored cell should have style handles(rgb color values)', () => { const html = renderer.renderCell(2, 0, 85); - expect(html).toBe('85.0'); + expect(html).toBe('85.0'); }); it('unformated undefined should be rendered as string', () => { @@ -333,47 +334,47 @@ describe('when rendering table', () => { it('value should be mapped to text and colored cell should have style', () => { const html = renderer.renderCell(11, 0, 1); - expect(html).toBe('on'); + expect(html).toBe(`on`); }); it('value should be mapped to text and colored cell should have style', () => { const html = renderer.renderCell(11, 0, '1'); - expect(html).toBe('on'); + expect(html).toBe(`on`); }); it('value should be mapped to text and colored cell should have style', () => { const html = renderer.renderCell(11, 0, 0); - expect(html).toBe('off'); + expect(html).toBe('off'); }); it('value should be mapped to text and colored cell should have style', () => { const html = renderer.renderCell(11, 0, '0'); - expect(html).toBe('off'); + expect(html).toBe('off'); }); it('value should be mapped to text and colored cell should have style', () => { const html = renderer.renderCell(11, 0, '2.1'); - expect(html).toBe('2.1'); + expect(html).toBe('2.1'); }); it('value should be mapped to text (range) and colored cell should have style', () => { const html = renderer.renderCell(12, 0, 0); - expect(html).toBe('0'); + expect(html).toBe('0'); }); it('value should be mapped to text (range) and colored cell should have style', () => { const html = renderer.renderCell(12, 0, 1); - expect(html).toBe('on'); + expect(html).toBe('on'); }); it('value should be mapped to text (range) and colored cell should have style', () => { const html = renderer.renderCell(12, 0, 4); - expect(html).toBe('off'); + expect(html).toBe(`off`); }); it('value should be mapped to text (range) and colored cell should have style', () => { const html = renderer.renderCell(12, 0, '7.1'); - expect(html).toBe('7.1'); + expect(html).toBe('7.1'); }); }); });