Commit fd8fe35e by Peter Holmberg

redid props for gauge options

parent de9137a7
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import { Switch } from 'app/core/components/Switch/Switch'; import { Switch } from 'app/core/components/Switch/Switch';
import { PanelOptionsProps } from 'app/types'; import { OptionModuleProps } from './module';
import { OptionsProps } from './module';
export default class GaugeOptions extends PureComponent<PanelOptionsProps<OptionsProps>> { export default class GaugeOptions extends PureComponent<OptionModuleProps> {
toggleThresholdLabels = () => toggleThresholdLabels = () =>
this.props.onChange({ ...this.props.options, showThresholdLabels: !this.props.options.showThresholdLabels }); this.props.onChange({ ...this.props.options, showThresholdLabels: !this.props.options.showThresholdLabels });
......
import React, { PureComponent } from 'react'; import React, { PureComponent } from 'react';
import classNames from 'classnames/bind'; import classNames from 'classnames/bind';
import { ColorPicker } from 'app/core/components/colorpicker/ColorPicker'; import { ColorPicker } from 'app/core/components/colorpicker/ColorPicker';
import { PanelOptionsProps, Threshold } from 'app/types'; import { OptionModuleProps } from './module';
import { OptionsProps } from './module'; import { Threshold } from 'app/types';
interface State { interface State {
thresholds: Threshold[]; thresholds: Threshold[];
...@@ -14,7 +14,7 @@ enum BasicGaugeColor { ...@@ -14,7 +14,7 @@ enum BasicGaugeColor {
Red = 'rgb(212, 74, 58)', Red = 'rgb(212, 74, 58)',
} }
export default class Thresholds extends PureComponent<PanelOptionsProps<OptionsProps>, State> { export default class Thresholds extends PureComponent<OptionModuleProps, State> {
constructor(props) { constructor(props) {
super(props); super(props);
......
...@@ -2,8 +2,7 @@ import React, { PureComponent } from 'react'; ...@@ -2,8 +2,7 @@ import React, { PureComponent } from 'react';
import { Label } from 'app/core/components/Label/Label'; import { Label } from 'app/core/components/Label/Label';
import SimplePicker from 'app/core/components/Picker/SimplePicker'; import SimplePicker from 'app/core/components/Picker/SimplePicker';
import UnitPicker from 'app/core/components/Picker/Unit/UnitPicker'; import UnitPicker from 'app/core/components/Picker/Unit/UnitPicker';
import { PanelOptionsProps } from 'app/types'; import { OptionModuleProps } from './module';
import { OptionsProps } from './module';
const statOptions = [ const statOptions = [
{ value: 'min', text: 'Min' }, { value: 'min', text: 'Min' },
...@@ -21,7 +20,7 @@ const statOptions = [ ...@@ -21,7 +20,7 @@ const statOptions = [
const labelWidth = 6; const labelWidth = 6;
export default class ValueOptions extends PureComponent<PanelOptionsProps<OptionsProps>> { export default class ValueOptions extends PureComponent<OptionModuleProps> {
onUnitChange = unit => this.props.onChange({ ...this.props.options, unit: unit.value }); onUnitChange = unit => this.props.onChange({ ...this.props.options, unit: unit.value });
onStatChange = stat => this.props.onChange({ ...this.props.options, stat: stat.value }); onStatChange = stat => this.props.onChange({ ...this.props.options, stat: stat.value });
......
...@@ -17,6 +17,11 @@ export interface OptionsProps { ...@@ -17,6 +17,11 @@ export interface OptionsProps {
thresholds: Threshold[]; thresholds: Threshold[];
} }
export interface OptionModuleProps {
onChange: (item: any) => void;
options: OptionsProps;
}
export const defaultProps = { export const defaultProps = {
options: { options: {
minValue: 0, minValue: 0,
......
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