// Libraries import React, { PureComponent } from 'react'; import { PanelEditorProps, ThresholdsEditor, PanelOptionsGrid, ValueMappingsEditor, FieldDisplayOptions, FieldDisplayEditor, FieldPropertiesEditor, Switch, PanelOptionsGroup, DataLinksEditor, } from '@grafana/ui'; import { Threshold, ValueMapping, FieldConfig, DataLink } from '@grafana/data'; import { GaugeOptions } from './types'; import { getCalculationValueDataLinksVariableSuggestions, getDataLinksVariableSuggestions, } from 'app/features/panel/panellinks/link_srv'; export class GaugePanelEditor extends PureComponent> { labelWidth = 6; onToggleThresholdLabels = () => this.props.onOptionsChange({ ...this.props.options, showThresholdLabels: !this.props.options.showThresholdLabels }); onToggleThresholdMarkers = () => this.props.onOptionsChange({ ...this.props.options, showThresholdMarkers: !this.props.options.showThresholdMarkers, }); onThresholdsChanged = (thresholds: Threshold[]) => { const current = this.props.options.fieldOptions.defaults; this.onDefaultsChange({ ...current, thresholds, }); }; onValueMappingsChanged = (mappings: ValueMapping[]) => { const current = this.props.options.fieldOptions.defaults; this.onDefaultsChange({ ...current, mappings, }); }; onDisplayOptionsChanged = (fieldOptions: FieldDisplayOptions) => this.props.onOptionsChange({ ...this.props.options, fieldOptions, }); onDefaultsChange = (field: FieldConfig) => { this.onDisplayOptionsChanged({ ...this.props.options.fieldOptions, defaults: field, }); }; onDataLinksChanged = (links: DataLink[]) => { this.onDefaultsChange({ ...this.props.options.fieldOptions.defaults, links, }); }; render() { const { options } = this.props; const { fieldOptions, showThresholdLabels, showThresholdMarkers } = options; const { defaults } = fieldOptions; const suggestions = fieldOptions.values ? getDataLinksVariableSuggestions(this.props.data.series) : getCalculationValueDataLinksVariableSuggestions(this.props.data.series); return ( <> ); } }