Merge pull request #11770 from grafana/davkal/explore-panel-link

Explore: Add entry to panel menu to jump to Explore
This commit is contained in:
David
2018-05-07 16:31:19 +02:00
committed by GitHub
11 changed files with 102 additions and 14 deletions

View File

@@ -19,6 +19,7 @@ export class PrometheusDatasource {
type: string;
editorSrc: string;
name: string;
supportsExplore: boolean;
supportMetrics: boolean;
url: string;
directUrl: string;
@@ -34,6 +35,7 @@ export class PrometheusDatasource {
this.type = 'prometheus';
this.editorSrc = 'app/features/prometheus/partials/query.editor.html';
this.name = instanceSettings.name;
this.supportsExplore = true;
this.supportMetrics = true;
this.url = instanceSettings.url;
this.directUrl = instanceSettings.directUrl;
@@ -324,6 +326,21 @@ export class PrometheusDatasource {
});
}
getExploreState(panel) {
let state = {};
if (panel.targets) {
const queries = panel.targets.map(t => ({
query: this.templateSrv.replace(t.expr, {}, this.interpolateQueryExpr),
format: t.format,
}));
state = {
...state,
queries,
};
}
return state;
}
getPrometheusTime(date, roundUp) {
if (_.isString(date)) {
date = dateMath.parse(date, roundUp);