diff --git a/e2e/suite1/specs/explore.spec.ts b/e2e/suite1/specs/explore.spec.ts index 3f59095462a..8524e96991c 100644 --- a/e2e/suite1/specs/explore.spec.ts +++ b/e2e/suite1/specs/explore.spec.ts @@ -11,9 +11,20 @@ e2e.scenario({ e2e.pages.Explore.General.container().should('have.length', 1); e2e.pages.Explore.General.runButton().should('have.length', 1); + e2e.components.DataSource.TestData.QueryTab.scenarioSelectContainer() + .should('be.visible') + .within(() => { + e2e.components.Select.input() + .should('be.visible') + .click(); + + cy.contains('CSV Metric Values') + .scrollIntoView() + .should('be.visible') + .click(); + }); + const canvases = e2e().get('canvas'); canvases.should('have.length', 2); - - e2e.components.DataSource.TestData.QueryTab.noise().should('have.length', 1); }, }); diff --git a/public/app/plugins/datasource/testdata/QueryEditor.tsx b/public/app/plugins/datasource/testdata/QueryEditor.tsx index 66577c52e33..9e8697dce94 100644 --- a/public/app/plugins/datasource/testdata/QueryEditor.tsx +++ b/public/app/plugins/datasource/testdata/QueryEditor.tsx @@ -1,5 +1,5 @@ // Libraries -import React, { ChangeEvent, FormEvent, useMemo, useEffect } from 'react'; +import React, { ChangeEvent, FormEvent, useMemo } from 'react'; import { useAsync } from 'react-use'; // Components @@ -46,10 +46,6 @@ export const QueryEditor = ({ query, datasource, onChange, onRunQuery }: Props) onRunQuery(); }; - useEffect(() => { - onUpdate(query); - }, []); - const currentScenario = useMemo(() => scenarioList?.find(scenario => scenario.id === query.scenarioId), [ scenarioList, query, diff --git a/public/app/plugins/datasource/testdata/datasource.ts b/public/app/plugins/datasource/testdata/datasource.ts index 7f21d261a36..44cb91d6bea 100644 --- a/public/app/plugins/datasource/testdata/datasource.ts +++ b/public/app/plugins/datasource/testdata/datasource.ts @@ -29,6 +29,8 @@ import { getSearchFilterScopedVar } from 'app/features/variables/utils'; type TestData = TimeSeries | TableData; export class TestDataDataSource extends DataSourceApi { + scenariosCache?: Promise; + constructor( instanceSettings: DataSourceInstanceSettings, private readonly templateSrv: TemplateSrv = getTemplateSrv() @@ -169,7 +171,11 @@ export class TestDataDataSource extends DataSourceApi { } getScenarios(): Promise { - return getBackendSrv().get('/api/tsdb/testdata/scenarios'); + if (!this.scenariosCache) { + this.scenariosCache = getBackendSrv().get('/api/tsdb/testdata/scenarios'); + } + + return this.scenariosCache; } metricFindQuery(query: string, options: any) { diff --git a/public/app/plugins/panel/graph2/getGraphSeriesModel.ts b/public/app/plugins/panel/graph2/getGraphSeriesModel.ts index 3f68162274c..7ed4a194b6f 100644 --- a/public/app/plugins/panel/graph2/getGraphSeriesModel.ts +++ b/public/app/plugins/panel/graph2/getGraphSeriesModel.ts @@ -19,6 +19,7 @@ import { getFieldDisplayName, } from '@grafana/data'; +import { config } from 'app/core/config'; import { SeriesOptions, GraphOptions, GraphLegendEditorLegendOptions } from './types'; export const getGraphSeriesModel = ( @@ -38,6 +39,7 @@ export const getGraphSeriesModel = ( decimals: legendOptions.decimals, }, }, + theme: config.theme, timeZone, }); @@ -104,7 +106,7 @@ export const getGraphSeriesModel = ( } : { ...field.config, color }; - field.display = getDisplayProcessor({ field, timeZone }); + field.display = getDisplayProcessor({ field, timeZone, theme: config.theme }); // Time step is used to determine bars width when graph is rendered as bar chart const timeStep = getSeriesTimeStep(timeField); @@ -119,6 +121,7 @@ export const getGraphSeriesModel = ( unit: systemDateFormats.getTimeFieldUnit(useMsDateFormat), }, }, + theme: config.theme, }); graphs.push({