@grafana/data#FieldOverrideEditorProps TypeScript Examples

The following examples show how to use @grafana/data#FieldOverrideEditorProps. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: links.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
DataLinksOverrideEditor: React.FC<FieldOverrideEditorProps<DataLink[], DataLinksFieldConfigSettings>> = ({
  value,
  onChange,
  context,
}) => {
  return (
    <DataLinksInlineEditor
      links={value}
      onChange={onChange}
      data={context.data}
      suggestions={context.getSuggestions ? context.getSuggestions() : []}
    />
  );
}
Example #2
Source File: mappings.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
export class ValueMappingsOverrideEditor extends React.PureComponent<
  FieldOverrideEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>
> {
  constructor(props: FieldOverrideEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>) {
    super(props);
  }

  render() {
    return <div>VALUE MAPPINGS OVERRIDE EDITOR {this.props.item.name}</div>;
  }
}
Example #3
Source File: number.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
NumberOverrideEditor: React.FC<FieldOverrideEditorProps<number, NumberFieldConfigSettings>> = ({
  value,
  onChange,
  item,
}) => {
  const { settings } = item;
  return (
    <Forms.Input
      value={isNaN(value) ? '' : value}
      min={settings.min}
      max={settings.max}
      type="number"
      step={settings.step}
      placeholder={settings.placeholder}
      onChange={e => {
        onChange(
          settings.integer ? toIntegerOrUndefined(e.currentTarget.value) : toFloatOrUndefined(e.currentTarget.value)
        );
      }}
    />
  );
}
Example #4
Source File: thresholds.tsx    From grafana-chinese with Apache License 2.0 6 votes vote down vote up
export class ThresholdsOverrideEditor extends React.PureComponent<
  FieldOverrideEditorProps<ThresholdsConfig, ThresholdsFieldConfigSettings>
> {
  constructor(props: FieldOverrideEditorProps<ThresholdsConfig, ThresholdsFieldConfigSettings>) {
    super(props);
  }

  render() {
    return <div>THRESHOLDS OVERRIDE EDITOR {this.props.item.name}</div>;
  }
}
Example #5
Source File: mappings.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
constructor(props: FieldOverrideEditorProps<ValueMapping[], ValueMappingFieldConfigSettings>) {
    super(props);
  }
Example #6
Source File: select.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
SelectOverrideEditor: FC<FieldOverrideEditorProps<string, SelectFieldConfigSettings<any>>> = ({
  item,
  value,
  onChange,
}) => {
  return <Forms.Select value={value || ''} onChange={e => onChange(e.value)} options={item.settings.options} />;
}
Example #7
Source File: string.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
StringOverrideEditor: React.FC<FieldOverrideEditorProps<string, StringFieldConfigSettings>> = ({
  value,
  onChange,
}) => {
  return <Forms.Input value={value || ''} onChange={e => onChange(e.currentTarget.value)} />;
}
Example #8
Source File: thresholds.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
constructor(props: FieldOverrideEditorProps<ThresholdsConfig, ThresholdsFieldConfigSettings>) {
    super(props);
  }
Example #9
Source File: units.tsx    From grafana-chinese with Apache License 2.0 5 votes vote down vote up
UnitOverrideEditor: React.FC<FieldOverrideEditorProps<string, UnitFieldConfigSettings>> = ({
  value,
  onChange,
}) => {
  return <UnitPicker value={value} onChange={onChange} useNewForms />;
}