Commit b263b3ed by corpglory-dev

change valueOptions

parent 7bb99620
import React, { PureComponent } from 'react';
import { FormLabel, PanelOptionsProps, PanelOptionsGroup, Select } from '@grafana/ui';
import { FormLabel, PanelOptionsGroup, Select } from '@grafana/ui';
import UnitPicker from 'app/core/components/Select/UnitPicker';
import { PiechartOptions } from './types';
import { PiechartValueOptions } from './types';
const statOptions = [
{ value: 'min', label: 'Min' },
......@@ -13,10 +13,23 @@ const statOptions = [
const labelWidth = 6;
export default class ValueOptions extends PureComponent<PanelOptionsProps<PiechartOptions>> {
onUnitChange = unit => this.props.onChange({ ...this.props.options, unit: unit.value });
export interface Props {
options: PiechartValueOptions;
onChange: (valueOptions: PiechartValueOptions) => void;
}
export default class ValueOptions 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,
});
render() {
const { stat, unit } = this.props.options;
......
export interface PiechartOptions {
pieType: string;
unit: string;
stat: string;
strokeWidth: number;
valueOptions: PiechartValueOptions;
// TODO: Options for Legend / Combine components
}
export interface PiechartValueOptions {
unit: string;
stat: string;
}
export const defaults: PiechartOptions = {
pieType: 'pie',
unit: 'short',
stat: 'current',
strokeWidth: 1,
valueOptions: {
unit: 'short',
stat: 'current',
},
};
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