mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Explore: Expand template variables when redirecting from dashboard panel (#19582)
* Fix redirect but adding getExploreState method to graphite * Explore: Create interpolateVariablesInQueries function for datasources * Explore: Add interpolateVariablesInQueries method to elasticsearch datasource * Add interpolateVariablesInQueries function to influx and postgres * Explore: Add interpolateVariablesInQueries to Mssql and Mysql datasources * Explore: Add datasources to queries * Explore: Code formatting * Prettier formating fix * Explore: Add rawQuery expanding of variables for influxdb * Remove console.logs * Explore: Add rawQuery expanding of multiple variables for influxdb * Explore: If no queries in Influxdb, return early [] * Explore: Refactor influxDb to follow the code structure
This commit is contained in:
@@ -77,12 +77,18 @@ export async function getExploreUrl(
|
||||
if (exploreDatasource) {
|
||||
const range = timeSrv.timeRangeForUrl();
|
||||
let state: Partial<ExploreUrlState> = { range };
|
||||
if (exploreDatasource.getExploreState) {
|
||||
state = { ...state, ...exploreDatasource.getExploreState(exploreTargets) };
|
||||
if (exploreDatasource.interpolateVariablesInQueries) {
|
||||
state = {
|
||||
...state,
|
||||
datasource: exploreDatasource.name,
|
||||
context: 'explore',
|
||||
queries: exploreDatasource.interpolateVariablesInQueries(exploreTargets),
|
||||
};
|
||||
} else {
|
||||
state = {
|
||||
...state,
|
||||
datasource: exploreDatasource.name,
|
||||
context: 'explore',
|
||||
queries: exploreTargets.map(t => ({ ...t, datasource: exploreDatasource.name })),
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user