Began work on pro modification
This commit is contained in:
@@ -2,7 +2,7 @@
|
|||||||
* Bootstrap require with the needed config, then load the app.js module.
|
* Bootstrap require with the needed config, then load the app.js module.
|
||||||
*/
|
*/
|
||||||
require.config({
|
require.config({
|
||||||
baseUrl: 'app',
|
baseUrl: 'public/app',
|
||||||
|
|
||||||
paths: {
|
paths: {
|
||||||
config: ['../config', '../config.sample'],
|
config: ['../config', '../config.sample'],
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ define([
|
|||||||
'lodash',
|
'lodash',
|
||||||
'config',
|
'config',
|
||||||
'./graphite/graphiteDatasource',
|
'./graphite/graphiteDatasource',
|
||||||
|
'./grafana/grafanaDatasource',
|
||||||
'./influxdb/influxdbDatasource',
|
'./influxdb/influxdbDatasource',
|
||||||
'./opentsdb/opentsdbDatasource',
|
'./opentsdb/opentsdbDatasource',
|
||||||
'./elasticsearch/es-datasource',
|
'./elasticsearch/es-datasource',
|
||||||
@@ -64,8 +65,8 @@ function (angular, _, config) {
|
|||||||
case 'opentsdb':
|
case 'opentsdb':
|
||||||
Datasource = $injector.get('OpenTSDBDatasource');
|
Datasource = $injector.get('OpenTSDBDatasource');
|
||||||
break;
|
break;
|
||||||
case 'elasticsearch':
|
case 'grafana':
|
||||||
Datasource = $injector.get('ElasticDatasource');
|
Datasource = $injector.get('GrafanaDatasource');
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return new Datasource(ds);
|
return new Datasource(ds);
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
define([
|
||||||
|
'angular',
|
||||||
|
'lodash',
|
||||||
|
'jquery',
|
||||||
|
'config',
|
||||||
|
'kbn',
|
||||||
|
'moment'
|
||||||
|
],
|
||||||
|
function (angular, _, $, config, kbn, moment) {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var module = angular.module('grafana.services');
|
||||||
|
|
||||||
|
module.factory('GrafanaDatasource', function($q, $http) {
|
||||||
|
|
||||||
|
function GrafanaDatasource(datasource) {
|
||||||
|
this.type = 'grafana';
|
||||||
|
this.grafanaDB = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
GrafanaDatasource.prototype.getDashboard = function(id, isTemp) {
|
||||||
|
var url = '/dashboard/' + id;
|
||||||
|
|
||||||
|
if (isTemp) {
|
||||||
|
url = '/temp/' + id;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $http.get('/api/dashboards/' + id)
|
||||||
|
.then(function(result) {
|
||||||
|
if (result.data) {
|
||||||
|
return angular.fromJson(result.data);
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}, function(data) {
|
||||||
|
if(data.status === 0) {
|
||||||
|
throw "Could not contact Elasticsearch. Please ensure that Elasticsearch is reachable from your browser.";
|
||||||
|
} else {
|
||||||
|
throw "Could not find dashboard " + id;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
return GrafanaDatasource;
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user