Просмотр исходного кода

Small change in SeriesColorPickerPopoverProps

Hugo Häggmark 7 лет назад
Родитель
Сommit
37dae043d7

+ 1 - 1
packages/grafana-ui/src/components/ColorPicker/SeriesColorPicker.tsx

@@ -8,7 +8,7 @@ export interface SeriesColorPickerProps {
   yaxis?: number;
   yaxis?: number;
   optionalClass?: string;
   optionalClass?: string;
   onColorChange: (newColor: string) => void;
   onColorChange: (newColor: string) => void;
-  onToggleAxis: () => void;
+  onToggleAxis?: () => void;
 }
 }
 
 
 export class SeriesColorPicker extends React.Component<SeriesColorPickerProps> {
 export class SeriesColorPicker extends React.Component<SeriesColorPickerProps> {

+ 6 - 3
packages/grafana-ui/src/components/ColorPicker/SeriesColorPickerPopover.tsx

@@ -5,7 +5,7 @@ export interface SeriesColorPickerPopoverProps {
   color: string;
   color: string;
   yaxis?: number;
   yaxis?: number;
   onColorChange: (color: string) => void;
   onColorChange: (color: string) => void;
-  onToggleAxis: () => void;
+  onToggleAxis?: () => void;
 }
 }
 
 
 export class SeriesColorPickerPopover extends React.PureComponent<SeriesColorPickerPopoverProps, any> {
 export class SeriesColorPickerPopover extends React.PureComponent<SeriesColorPickerPopoverProps, any> {
@@ -21,7 +21,7 @@ export class SeriesColorPickerPopover extends React.PureComponent<SeriesColorPic
 
 
 interface AxisSelectorProps {
 interface AxisSelectorProps {
   yaxis: number;
   yaxis: number;
-  onToggleAxis: () => void;
+  onToggleAxis?: () => void;
 }
 }
 
 
 interface AxisSelectorState {
 interface AxisSelectorState {
@@ -41,7 +41,10 @@ export class AxisSelector extends React.PureComponent<AxisSelectorProps, AxisSel
     this.setState({
     this.setState({
       yaxis: this.state.yaxis === 2 ? 1 : 2,
       yaxis: this.state.yaxis === 2 ? 1 : 2,
     });
     });
-    this.props.onToggleAxis();
+
+    if (this.props.onToggleAxis) {
+      this.props.onToggleAxis();
+    }
   }
   }
 
 
   render() {
   render() {