diff --git a/packages/grafana-ui/src/components/Table/styles.ts b/packages/grafana-ui/src/components/Table/styles.ts index 506e05a5f1e..c7b08c0f3d9 100644 --- a/packages/grafana-ui/src/components/Table/styles.ts +++ b/packages/grafana-ui/src/components/Table/styles.ts @@ -54,6 +54,8 @@ export const getTableStyles = stylesFactory( headerCell: css` padding: ${padding}px 10px; cursor: pointer; + overflow: hidden; + white-space: nowrap; color: ${colors.textBlue}; border-right: 1px solid ${theme.colors.panelBg}; diff --git a/pkg/tsdb/testdatasource/scenarios.go b/pkg/tsdb/testdatasource/scenarios.go index 200dc9125f9..0d9a71c5844 100644 --- a/pkg/tsdb/testdatasource/scenarios.go +++ b/pkg/tsdb/testdatasource/scenarios.go @@ -275,6 +275,15 @@ func init() { }, }) + registerScenario(&Scenario{ + Id: "arrow", + Name: "Load Apache Arrow Data", + Handler: func(query *tsdb.Query, context *tsdb.TsdbQuery) *tsdb.QueryResult { + // Real work is in javascript client + return tsdb.NewQueryResult() + }, + }) + registerScenario(&Scenario{ Id: "table_static", Name: "Table Static", diff --git a/public/app/plugins/datasource/testdata/datasource.ts b/public/app/plugins/datasource/testdata/datasource.ts index f0b3e0dcfc6..7f69be4660c 100644 --- a/public/app/plugins/datasource/testdata/datasource.ts +++ b/public/app/plugins/datasource/testdata/datasource.ts @@ -9,14 +9,18 @@ import { TimeSeries, LoadingState, ArrayDataFrame, + base64StringToArrowTable, + arrowTableToDataFrame, + DataFrame, } from '@grafana/data'; import { Scenario, TestDataQuery } from './types'; import { getBackendSrv } from '@grafana/runtime'; import { queryMetricTree } from './metricTree'; -import { from, merge, Observable } from 'rxjs'; +import { from, merge, Observable, of } from 'rxjs'; import { runStream } from './runStreams'; import templateSrv from 'app/features/templating/template_srv'; -import { getSearchFilterScopedVar } from '../../../features/templating/utils'; +import { getSearchFilterScopedVar } from 'app/features/templating/utils'; +import { processQueryError } from 'app/features/dashboard/state/runRequest'; type TestData = TimeSeries | TableData; @@ -38,6 +42,8 @@ export class TestDataDataSource extends DataSourceApi { streams.push(runStream(target, options)); } else if (target.scenarioId === 'grafana_api') { streams.push(runGrafanaAPI(target, options)); + } else if (target.scenarioId === 'arrow') { + streams.push(runArrowFile(target, options)); } else { queries.push({ ...target, @@ -150,6 +156,22 @@ export class TestDataDataSource extends DataSourceApi { } } +function runArrowFile(target: TestDataQuery, req: DataQueryRequest): Observable { + let data: DataFrame[] = []; + if (target.stringInput && target.stringInput.length > 10) { + try { + const table = base64StringToArrowTable(target.stringInput); + data = [arrowTableToDataFrame(table)]; + } catch (e) { + console.warn('Error reading saved arrow', e); + const error = processQueryError(e); + error.refId = target.refId; + return of({ state: LoadingState.Error, error, data }); + } + } + return of({ state: LoadingState.Done, data }); +} + function runGrafanaAPI(target: TestDataQuery, req: DataQueryRequest): Observable { const url = `/api/${target.stringInput}`; return from( diff --git a/public/app/plugins/datasource/testdata/partials/query.editor.html b/public/app/plugins/datasource/testdata/partials/query.editor.html index 7f5e70386b8..e7014def49f 100644 --- a/public/app/plugins/datasource/testdata/partials/query.editor.html +++ b/public/app/plugins/datasource/testdata/partials/query.editor.html @@ -201,7 +201,6 @@ -
@@ -216,6 +215,19 @@
+ +
+
+