mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge pull request #14551 from grafana/explore-ds-fixes
Explore: Datasource fixes
This commit is contained in:
commit
e56b478709
@ -57,12 +57,19 @@ export async function getExploreUrl(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exploreDatasource && exploreDatasource.meta.explore) {
|
if (panelDatasource) {
|
||||||
const range = timeSrv.timeRangeForUrl();
|
const range = timeSrv.timeRangeForUrl();
|
||||||
const state = {
|
let state: Partial<ExploreUrlState> = { range };
|
||||||
...exploreDatasource.getExploreState(exploreTargets),
|
if (exploreDatasource.getExploreState) {
|
||||||
range,
|
state = { ...state, ...exploreDatasource.getExploreState(exploreTargets) };
|
||||||
};
|
} else {
|
||||||
|
state = {
|
||||||
|
...state,
|
||||||
|
datasource: panelDatasource.name,
|
||||||
|
queries: exploreTargets.map(t => ({ ...t, datasource: panelDatasource.name })),
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const exploreState = JSON.stringify(state);
|
const exploreState = JSON.stringify(state);
|
||||||
url = renderUrl('/explore', { state: exploreState });
|
url = renderUrl('/explore', { state: exploreState });
|
||||||
}
|
}
|
||||||
@ -151,7 +158,9 @@ export function calculateResultsFromQueryTransactions(
|
|||||||
);
|
);
|
||||||
const tableResult = mergeTablesIntoModel(
|
const tableResult = mergeTablesIntoModel(
|
||||||
new TableModel(),
|
new TableModel(),
|
||||||
...queryTransactions.filter(qt => qt.resultType === 'Table' && qt.done && qt.result).map(qt => qt.result)
|
...queryTransactions
|
||||||
|
.filter(qt => qt.resultType === 'Table' && qt.done && qt.result && qt.result.columns && qt.result.rows)
|
||||||
|
.map(qt => qt.result)
|
||||||
);
|
);
|
||||||
const logsResult =
|
const logsResult =
|
||||||
datasource && datasource.mergeStreams
|
datasource && datasource.mergeStreams
|
||||||
|
@ -608,9 +608,11 @@ export class Explore extends React.PureComponent<ExploreProps, ExploreState> {
|
|||||||
// Clone range for query request
|
// Clone range for query request
|
||||||
// const queryRange: RawTimeRange = { ...range };
|
// const queryRange: RawTimeRange = { ...range };
|
||||||
// const { from, to, raw } = this.timeSrv.timeRange();
|
// const { from, to, raw } = this.timeSrv.timeRange();
|
||||||
// Datasource is using `panelId + query.refId` for cancellation logic.
|
// Most datasource is using `panelId + query.refId` for cancellation logic.
|
||||||
// Using `format` here because it relates to the view panel that the request is for.
|
// Using `format` here because it relates to the view panel that the request is for.
|
||||||
const panelId = queryOptions.format;
|
// However, some datasources don't use `panelId + query.refId`, but only `panelId`.
|
||||||
|
// Therefore panel id has to be unique.
|
||||||
|
const panelId = `${queryOptions.format}-${query.key}`;
|
||||||
|
|
||||||
return {
|
return {
|
||||||
interval,
|
interval,
|
||||||
|
@ -233,12 +233,7 @@ class MetricsPanelCtrl extends PanelCtrl {
|
|||||||
|
|
||||||
getAdditionalMenuItems() {
|
getAdditionalMenuItems() {
|
||||||
const items = [];
|
const items = [];
|
||||||
if (
|
if (config.exploreEnabled && this.contextSrv.isEditor && this.datasource) {
|
||||||
config.exploreEnabled &&
|
|
||||||
this.contextSrv.isEditor &&
|
|
||||||
this.datasource &&
|
|
||||||
(this.datasource.meta.explore || this.datasource.meta.id === 'mixed')
|
|
||||||
) {
|
|
||||||
items.push({
|
items.push({
|
||||||
text: 'Explore',
|
text: 'Explore',
|
||||||
click: 'ctrl.explore();',
|
click: 'ctrl.explore();',
|
||||||
|
Loading…
Reference in New Issue
Block a user