Browse Source

Hastic datasource doesn't work with Grafana at sub-url #227 (#228)

master
rozetko 6 years ago committed by GitHub
parent
commit
4fd895710d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 8
      src/panel/graph_panel/graph_ctrl.ts

8
src/panel/graph_panel/graph_ctrl.ts

@ -203,12 +203,12 @@ class GraphCtrl extends MetricsPanelCtrl {
const hasticDatasource = _.find(this._hasticDatasources, { id: hasticDatasourceId }); const hasticDatasource = _.find(this._hasticDatasources, { id: hasticDatasourceId });
let url = hasticDatasource.url; let url = hasticDatasource.url;
if(hasticDatasource.access === 'proxy') { if(hasticDatasource.access === 'proxy') {
url = `/api/datasources/proxy/${hasticDatasource.id}` url = `api/datasources/proxy/${hasticDatasource.id}`;
} }
return { return {
url, url,
name: hasticDatasource.name name: hasticDatasource.name
} };
} }
return undefined; return undefined;
} }
@ -699,7 +699,7 @@ class GraphCtrl extends MetricsPanelCtrl {
throw new Error('Trying to get datasource with NULL name'); throw new Error('Trying to get datasource with NULL name');
} }
if(this._datasources[name] === undefined) { if(this._datasources[name] === undefined) {
const datasource = await this.backendSrv.get(`/api/datasources/name/${name}`); const datasource = await this.backendSrv.get(`api/datasources/name/${name}`);
return datasource; return datasource;
} else { } else {
return this._datasources[name]; return this._datasources[name];
@ -707,7 +707,7 @@ class GraphCtrl extends MetricsPanelCtrl {
} }
private async _fetchHasticDatasources() { private async _fetchHasticDatasources() {
this._hasticDatasources = await this.backendSrv.get('/api/datasources'); this._hasticDatasources = await this.backendSrv.get('api/datasources');
this._hasticDatasources = this._hasticDatasources.filter(ds => ds.type === 'corpglory-hastic-datasource'); this._hasticDatasources = this._hasticDatasources.filter(ds => ds.type === 'corpglory-hastic-datasource');
this.$scope.$digest(); this.$scope.$digest();
} }

Loading…
Cancel
Save