import React, { useState } from 'react'; import { Button, HorizontalGroup, VerticalGroup } from '@grafana/ui'; interface Props { config: Config; onConfigChange: (config: Config) => void; onPlus: () => void; onMinus: () => void; scale: number; disableZoomOut?: boolean; disableZoomIn?: boolean; } /** * Control buttons for zoom but also some layout config inputs mainly for debugging. */ export function ViewControls>(props: Props) { const { config, onConfigChange, onPlus, onMinus, disableZoomOut, disableZoomIn } = props; const [showConfig, setShowConfig] = useState(false); // For debugging the layout, should be removed here and maybe moved to panel config later on const allowConfiguration = false; return (
)} {allowConfiguration && showConfig && Object.keys(config) .filter((k) => k !== 'show') .map((k) => (
{k} { onConfigChange({ ...config, [k]: parseFloat(e.target.value) }); }} />
))}
); }