Scenes: Add refresh picker to demos and dashboard loader (#64292)

Co-authored-by: Torkel Ödegaard <torkel@grafana.com>
This commit is contained in:
Dominik Prokop 2023-04-04 12:02:29 +02:00 committed by GitHub
parent 958ce289b2
commit ed45991e1b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 23 additions and 9 deletions

View File

@ -19,6 +19,7 @@ import {
DataSourceVariable,
QueryVariable,
ConstantVariable,
SceneRefreshPicker,
SceneDataTransformer,
SceneGridItem,
} from '@grafana/scenes';
@ -178,7 +179,13 @@ export function createDashboardSceneFromDashboardModel(oldModel: DashboardModel)
children: createSceneObjectsForPanels(oldModel.panels),
}),
$timeRange: new SceneTimeRange(oldModel.time),
actions: [new SceneTimePicker({})],
actions: [
new SceneTimePicker({}),
new SceneRefreshPicker({
refresh: oldModel.refresh,
intervals: oldModel.timepicker.refresh_intervals,
}),
],
$variables: variables,
...(variables && {
controls: [new VariableValueSelectors({})],

View File

@ -4,6 +4,7 @@ import {
SceneTimePicker,
SceneGridLayout,
SceneTimeRange,
SceneRefreshPicker,
SceneGridItem,
} from '@grafana/scenes';
import { TestDataQueryType } from 'app/plugins/datasource/testdata/dataquery.gen';
@ -77,6 +78,6 @@ export function getGridWithMultipleTimeRanges(): DashboardScene {
}),
$timeRange: globalTimeRange,
$data: getQueryRunnerWithRandomWalkQuery(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
});
}

View File

@ -4,6 +4,7 @@ import {
SceneFlexLayout,
SceneGridLayout,
SceneTimeRange,
SceneRefreshPicker,
SceneGridItem,
SceneFlexItem,
} from '@grafana/scenes';
@ -135,6 +136,6 @@ export function getMultipleGridLayoutTest(): DashboardScene {
}),
$timeRange: new SceneTimeRange(),
$data: getQueryRunnerWithRandomWalkQuery(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
});
}

View File

@ -4,6 +4,7 @@ import {
SceneTimePicker,
SceneGridLayout,
SceneTimeRange,
SceneRefreshPicker,
SceneGridItem,
} from '@grafana/scenes';
import { TestDataQueryType } from 'app/plugins/datasource/testdata/dataquery.gen';
@ -119,6 +120,6 @@ export function getGridWithMultipleData(): DashboardScene {
}),
$timeRange: new SceneTimeRange(),
$data: getQueryRunnerWithRandomWalkQuery(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
});
}

View File

@ -9,6 +9,7 @@ import {
CustomVariable,
DataSourceVariable,
QueryVariable,
SceneRefreshPicker,
SceneFlexItem,
} from '@grafana/scenes';
@ -61,7 +62,7 @@ export function getQueryVariableDemo(): DashboardScene {
],
}),
$timeRange: new SceneTimeRange(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
controls: [new VariableValueSelectors({})],
});
}

View File

@ -4,6 +4,7 @@ import {
SceneTimePicker,
SceneFlexLayout,
SceneTimeRange,
SceneRefreshPicker,
SceneFlexItem,
} from '@grafana/scenes';
@ -64,6 +65,6 @@ export function getSceneWithRows(): DashboardScene {
}),
$timeRange: new SceneTimeRange(),
$data: getQueryRunnerWithRandomWalkQuery(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
});
}

View File

@ -4,6 +4,7 @@ import {
VizPanel,
SceneDataTransformer,
SceneTimeRange,
SceneRefreshPicker,
SceneFlexItem,
} from '@grafana/scenes';
@ -75,6 +76,6 @@ export function getTransformationsDemo(): DashboardScene {
}),
$timeRange: new SceneTimeRange(),
$data: getQueryRunnerWithRandomWalkQuery(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
});
}

View File

@ -10,6 +10,7 @@ import {
DataSourceVariable,
TestVariable,
NestedScene,
SceneRefreshPicker,
TextBoxVariable,
SceneFlexItem,
} from '@grafana/scenes';
@ -126,7 +127,7 @@ export function getVariablesDemo(): DashboardScene {
],
}),
$timeRange: new SceneTimeRange(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
controls: [new VariableValueSelectors({})],
});
}
@ -193,7 +194,7 @@ export function getVariablesDemoWithAll(): DashboardScene {
],
}),
$timeRange: new SceneTimeRange(),
actions: [new SceneTimePicker({})],
actions: [new SceneTimePicker({}), new SceneRefreshPicker({})],
controls: [new VariableValueSelectors({})],
});
}