|
@@ -6,8 +6,7 @@ import UnitPicker from 'app/core/components/Select/UnitPicker';
|
|
|
import { FormField, FormLabel, PanelOptionsGroup, Select } from '@grafana/ui';
|
|
import { FormField, FormLabel, PanelOptionsGroup, Select } from '@grafana/ui';
|
|
|
|
|
|
|
|
// Types
|
|
// Types
|
|
|
-import { GaugeOptions } from './types';
|
|
|
|
|
-import { PanelEditorProps } from '@grafana/ui';
|
|
|
|
|
|
|
+import { SingleStatValueOptions } from './types';
|
|
|
|
|
|
|
|
const statOptions = [
|
|
const statOptions = [
|
|
|
{ value: 'min', label: 'Min' },
|
|
{ value: 'min', label: 'Min' },
|
|
@@ -25,9 +24,13 @@ const statOptions = [
|
|
|
|
|
|
|
|
const labelWidth = 6;
|
|
const labelWidth = 6;
|
|
|
|
|
|
|
|
-export class ValueOptions extends PureComponent<PanelEditorProps<GaugeOptions>> {
|
|
|
|
|
- onUnitChange = unit => this.props.onChange({ ...this.props.options, unit: unit.value });
|
|
|
|
|
|
|
+export interface Props {
|
|
|
|
|
+ options: SingleStatValueOptions;
|
|
|
|
|
+ onChange: (valueOptions: SingleStatValueOptions) => void;
|
|
|
|
|
+}
|
|
|
|
|
|
|
|
|
|
+export class SingleStatValueEditor extends PureComponent<Props> {
|
|
|
|
|
+ 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 });
|
|
|
|
|
|
|
|
onDecimalChange = event => {
|
|
onDecimalChange = event => {
|
|
@@ -37,7 +40,6 @@ export class ValueOptions extends PureComponent<PanelEditorProps<GaugeOptions>>
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
onPrefixChange = event => this.props.onChange({ ...this.props.options, prefix: event.target.value });
|
|
onPrefixChange = event => this.props.onChange({ ...this.props.options, prefix: event.target.value });
|
|
|
-
|
|
|
|
|
onSuffixChange = event => this.props.onChange({ ...this.props.options, suffix: event.target.value });
|
|
onSuffixChange = event => this.props.onChange({ ...this.props.options, suffix: event.target.value });
|
|
|
|
|
|
|
|
render() {
|
|
render() {
|