Commit b1b5e8d7 by ryan

use singlestat base where appropriate

parent 77b78e36
import { getDisplayProcessor, getColorFromThreshold, DisplayProcessor, DisplayValue } from './displayValue'; import { getDisplayProcessor, getColorFromThreshold, DisplayProcessor, DisplayValue } from './displayValue';
import { MappingType, ValueMapping } from '../types/panel'; import { MappingType, ValueMapping } from '../types/panel';
function assertSame(input: any, processorss: DisplayProcessor[], match: DisplayValue) { function assertSame(input: any, processors: DisplayProcessor[], match: DisplayValue) {
processorss.forEach(processor => { processors.forEach(processor => {
const value = processor(input); const value = processor(input);
expect(value.text).toEqual(match.text); expect(value.text).toEqual(match.text);
if (match.hasOwnProperty('numeric')) { if (match.hasOwnProperty('numeric')) {
......
...@@ -3,10 +3,10 @@ import { ReactPanelPlugin } from '@grafana/ui'; ...@@ -3,10 +3,10 @@ import { ReactPanelPlugin } from '@grafana/ui';
import { BarGaugePanel } from './BarGaugePanel'; import { BarGaugePanel } from './BarGaugePanel';
import { BarGaugePanelEditor } from './BarGaugePanelEditor'; import { BarGaugePanelEditor } from './BarGaugePanelEditor';
import { BarGaugeOptions, defaults } from './types'; import { BarGaugeOptions, defaults } from './types';
import { singleStatOptionsCheck } from '../singlestat2/module'; import { singleStatBaseOptionsCheck } from '../singlestat2/module';
export const reactPanel = new ReactPanelPlugin<BarGaugeOptions>(BarGaugePanel); export const reactPanel = new ReactPanelPlugin<BarGaugeOptions>(BarGaugePanel);
reactPanel.setEditor(BarGaugePanelEditor); reactPanel.setEditor(BarGaugePanelEditor);
reactPanel.setDefaults(defaults); reactPanel.setDefaults(defaults);
reactPanel.setPanelTypeChangedHook(singleStatOptionsCheck); reactPanel.setPanelTypeChangedHook(singleStatBaseOptionsCheck);
...@@ -3,10 +3,10 @@ import { ReactPanelPlugin } from '@grafana/ui'; ...@@ -3,10 +3,10 @@ import { ReactPanelPlugin } from '@grafana/ui';
import { GaugePanelEditor } from './GaugePanelEditor'; import { GaugePanelEditor } from './GaugePanelEditor';
import { GaugePanel } from './GaugePanel'; import { GaugePanel } from './GaugePanel';
import { GaugeOptions, defaults } from './types'; import { GaugeOptions, defaults } from './types';
import { singleStatOptionsCheck } from '../singlestat2/module'; import { singleStatBaseOptionsCheck } from '../singlestat2/module';
export const reactPanel = new ReactPanelPlugin<GaugeOptions>(GaugePanel); export const reactPanel = new ReactPanelPlugin<GaugeOptions>(GaugePanel);
reactPanel.setEditor(GaugePanelEditor); reactPanel.setEditor(GaugePanelEditor);
reactPanel.setDefaults(defaults); reactPanel.setDefaults(defaults);
reactPanel.setPanelTypeChangedHook(singleStatOptionsCheck); reactPanel.setPanelTypeChangedHook(singleStatBaseOptionsCheck);
import { ReactPanelPlugin } from '@grafana/ui'; import { ReactPanelPlugin } from '@grafana/ui';
import { SingleStatOptions, defaults } from './types'; import { SingleStatOptions, defaults, SingleStatBaseOptions } from './types';
import { SingleStatPanel } from './SingleStatPanel'; import { SingleStatPanel } from './SingleStatPanel';
import cloneDeep from 'lodash/cloneDeep'; import cloneDeep from 'lodash/cloneDeep';
import { SingleStatEditor } from './SingleStatEditor'; import { SingleStatEditor } from './SingleStatEditor';
...@@ -8,8 +8,8 @@ export const reactPanel = new ReactPanelPlugin<SingleStatOptions>(SingleStatPane ...@@ -8,8 +8,8 @@ export const reactPanel = new ReactPanelPlugin<SingleStatOptions>(SingleStatPane
const optionsToKeep = ['valueOptions', 'stat', 'maxValue', 'maxValue', 'thresholds', 'valueMappings']; const optionsToKeep = ['valueOptions', 'stat', 'maxValue', 'maxValue', 'thresholds', 'valueMappings'];
export const singleStatOptionsCheck = ( export const singleStatBaseOptionsCheck = (
options: Partial<SingleStatOptions>, options: Partial<SingleStatBaseOptions>,
prevPluginId?: string, prevPluginId?: string,
prevOptions?: any prevOptions?: any
) => { ) => {
...@@ -26,4 +26,4 @@ export const singleStatOptionsCheck = ( ...@@ -26,4 +26,4 @@ export const singleStatOptionsCheck = (
reactPanel.setEditor(SingleStatEditor); reactPanel.setEditor(SingleStatEditor);
reactPanel.setDefaults(defaults); reactPanel.setDefaults(defaults);
reactPanel.setPanelTypeChangedHook(singleStatOptionsCheck); reactPanel.setPanelTypeChangedHook(singleStatBaseOptionsCheck);
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment