diff --git a/public/app/features/scenes/scenes/grid.tsx b/public/app/features/scenes/scenes/grid.tsx index cefa6b61b9e..4cf629fade4 100644 --- a/public/app/features/scenes/scenes/grid.tsx +++ b/public/app/features/scenes/scenes/grid.tsx @@ -7,7 +7,8 @@ import { SceneFlexLayout } from '../components/layout/SceneFlexLayout'; import { SceneGridLayout } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getGridLayoutTest(): Scene { const scene = new Scene({ @@ -57,18 +58,7 @@ export function getGridLayoutTest(): Scene { }), $editor: new SceneEditManager({}), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx index f58854a99ce..cb730ce1dbb 100644 --- a/public/app/features/scenes/scenes/gridMultiTimeRange.tsx +++ b/public/app/features/scenes/scenes/gridMultiTimeRange.tsx @@ -6,7 +6,8 @@ import { VizPanel } from '../components/VizPanel'; import { SceneGridLayout, SceneGridRow } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getGridWithMultipleTimeRanges(): Scene { const globalTimeRange = new SceneTimeRange(getDefaultTimeRange()); @@ -24,18 +25,7 @@ export function getGridWithMultipleTimeRanges(): Scene { children: [ new SceneGridRow({ $timeRange: row1TimeRange, - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk_table', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery({ scenarioId: 'random_walk_table' }), title: 'Row A - has its own query, last year time range', key: 'Row A', isCollapsed: true, @@ -61,19 +51,7 @@ export function getGridWithMultipleTimeRanges(): Scene { }), new VizPanel({ - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - seriesCount: 10, - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), isResizable: true, isDraggable: true, pluginId: 'timeseries', @@ -90,18 +68,7 @@ export function getGridWithMultipleTimeRanges(): Scene { }), $editor: new SceneEditManager({}), $timeRange: globalTimeRange, - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/gridMultiple.tsx b/public/app/features/scenes/scenes/gridMultiple.tsx index bb4044c9e76..087081e576b 100644 --- a/public/app/features/scenes/scenes/gridMultiple.tsx +++ b/public/app/features/scenes/scenes/gridMultiple.tsx @@ -7,7 +7,8 @@ import { SceneFlexLayout } from '../components/layout/SceneFlexLayout'; import { SceneGridLayout } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getMultipleGridLayoutTest(): Scene { const scene = new Scene({ @@ -101,18 +102,7 @@ export function getMultipleGridLayoutTest(): Scene { $editor: new SceneEditManager({}), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/gridWithMultipleData.tsx b/public/app/features/scenes/scenes/gridWithMultipleData.tsx index d492f81b057..f4752793079 100644 --- a/public/app/features/scenes/scenes/gridWithMultipleData.tsx +++ b/public/app/features/scenes/scenes/gridWithMultipleData.tsx @@ -6,7 +6,8 @@ import { VizPanel } from '../components/VizPanel'; import { SceneGridLayout, SceneGridRow } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getGridWithMultipleData(): Scene { const scene = new Scene({ @@ -15,18 +16,7 @@ export function getGridWithMultipleData(): Scene { children: [ new SceneGridRow({ $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk_table', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery({ scenarioId: 'random_walk_table' }), title: 'Row A - has its own query', key: 'Row A', isCollapsed: true, @@ -65,19 +55,7 @@ export function getGridWithMultipleData(): Scene { size: { x: 0, y: 2, width: 12, height: 5 }, }), new VizPanel({ - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - seriesCount: 10, - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery({ seriesCount: 10 }), pluginId: 'timeseries', title: 'Row B Child2 with data', key: 'Row B Child2', @@ -88,19 +66,7 @@ export function getGridWithMultipleData(): Scene { ], }), new VizPanel({ - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - seriesCount: 10, - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery({ seriesCount: 10 }), isResizable: true, isDraggable: true, pluginId: 'timeseries', @@ -130,18 +96,7 @@ export function getGridWithMultipleData(): Scene { }), $editor: new SceneEditManager({}), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/gridWithRow.tsx b/public/app/features/scenes/scenes/gridWithRow.tsx index cbda038b18c..38dadce9cf1 100644 --- a/public/app/features/scenes/scenes/gridWithRow.tsx +++ b/public/app/features/scenes/scenes/gridWithRow.tsx @@ -6,7 +6,8 @@ import { VizPanel } from '../components/VizPanel'; import { SceneGridLayout, SceneGridRow } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getGridWithRowLayoutTest(): Scene { const scene = new Scene({ @@ -78,18 +79,7 @@ export function getGridWithRowLayoutTest(): Scene { }), $editor: new SceneEditManager({}), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/gridWithRows.tsx b/public/app/features/scenes/scenes/gridWithRows.tsx index 609373dd256..1f47a22e708 100644 --- a/public/app/features/scenes/scenes/gridWithRows.tsx +++ b/public/app/features/scenes/scenes/gridWithRows.tsx @@ -7,7 +7,8 @@ import { SceneFlexLayout } from '../components/layout/SceneFlexLayout'; import { SceneGridLayout, SceneGridRow } from '../components/layout/SceneGridLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; import { SceneEditManager } from '../editor/SceneEditManager'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getGridWithRowsTest(): Scene { const panel = new VizPanel({ @@ -83,18 +84,7 @@ export function getGridWithRowsTest(): Scene { }), $editor: new SceneEditManager({}), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); diff --git a/public/app/features/scenes/scenes/nested.tsx b/public/app/features/scenes/scenes/nested.tsx index 4b99f9bb497..cd4e60889fa 100644 --- a/public/app/features/scenes/scenes/nested.tsx +++ b/public/app/features/scenes/scenes/nested.tsx @@ -6,7 +6,8 @@ import { SceneTimePicker } from '../components/SceneTimePicker'; import { VizPanel } from '../components/VizPanel'; import { SceneFlexLayout } from '../components/layout/SceneFlexLayout'; import { SceneTimeRange } from '../core/SceneTimeRange'; -import { SceneQueryRunner } from '../querying/SceneQueryRunner'; + +import { getQueryRunnerWithRandomWalkQuery } from './queries'; export function getNestedScene(): Scene { const scene = new Scene({ @@ -23,18 +24,7 @@ export function getNestedScene(): Scene { ], }), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], }); @@ -57,18 +47,7 @@ export function getInnerScene(title: string) { ], }), $timeRange: new SceneTimeRange(getDefaultTimeRange()), - $data: new SceneQueryRunner({ - queries: [ - { - refId: 'A', - datasource: { - uid: 'gdev-testdata', - type: 'testdata', - }, - scenarioId: 'random_walk', - }, - ], - }), + $data: getQueryRunnerWithRandomWalkQuery(), actions: [new SceneTimePicker({})], });