// Libraries import React, { PureComponent } from 'react'; // Types import { InputOptions } from './types'; import { DataSourcePluginOptionsEditorProps, DataSourceSettings, SeriesData, TableInputCSV, toCSV } from '@grafana/ui'; type InputSettings = DataSourceSettings; interface Props extends DataSourcePluginOptionsEditorProps {} interface State { text: string; } export class InputConfigEditor extends PureComponent { state = { text: '', }; componentDidMount() { const { options } = this.props; if (options.jsonData.data) { const text = toCSV(options.jsonData.data); this.setState({ text }); } } onSeriesParsed = (data: SeriesData[], text: string) => { const { options, onOptionsChange } = this.props; if (!data) { data = [ { fields: [], rows: [], }, ]; } // data is a property on 'jsonData' const jsonData = { ...options.jsonData, data, }; onOptionsChange({ ...options, jsonData, }); this.setState({ text }); }; render() { const { text } = this.state; return (

Shared Data:

Enter CSV
This data is stored in the datasource json and is returned to every user in the initial request for any datasource. This is an appropriate place to enter a few values. Large datasets will perform better in other datasources.

NOTE: Changes to this data will only be reflected after a browser refresh.
); } }