mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
DataFrame: convert from row based to a columnar value format (#18391)
This commit is contained in:
@@ -5,7 +5,8 @@ import React, { PureComponent } from 'react';
|
||||
import { InputOptions } from './types';
|
||||
|
||||
import { DataSourcePluginOptionsEditorProps, DataSourceSettings, TableInputCSV } from '@grafana/ui';
|
||||
import { DataFrame, toCSV } from '@grafana/data';
|
||||
import { DataFrame, DataFrameHelper } from '@grafana/data';
|
||||
import { dataFrameToCSV } from './utils';
|
||||
|
||||
type InputSettings = DataSourceSettings<InputOptions>;
|
||||
|
||||
@@ -23,7 +24,7 @@ export class InputConfigEditor extends PureComponent<Props, State> {
|
||||
componentDidMount() {
|
||||
const { options } = this.props;
|
||||
if (options.jsonData.data) {
|
||||
const text = toCSV(options.jsonData.data);
|
||||
const text = dataFrameToCSV(options.jsonData.data);
|
||||
this.setState({ text });
|
||||
}
|
||||
}
|
||||
@@ -31,12 +32,7 @@ export class InputConfigEditor extends PureComponent<Props, State> {
|
||||
onSeriesParsed = (data: DataFrame[], text: string) => {
|
||||
const { options, onOptionsChange } = this.props;
|
||||
if (!data) {
|
||||
data = [
|
||||
{
|
||||
fields: [],
|
||||
rows: [],
|
||||
},
|
||||
];
|
||||
data = [new DataFrameHelper()];
|
||||
}
|
||||
// data is a property on 'jsonData'
|
||||
const jsonData = {
|
||||
|
||||
Reference in New Issue
Block a user