Commit eb6099a9 by Torkel Ödegaard

Began work on pro modification

parent 02fb2baf
......@@ -2,7 +2,7 @@
* Bootstrap require with the needed config, then load the app.js module.
*/
require.config({
baseUrl: 'app',
baseUrl: 'public/app',
paths: {
config: ['../config', '../config.sample'],
......
......@@ -3,6 +3,7 @@ define([
'lodash',
'config',
'./graphite/graphiteDatasource',
'./grafana/grafanaDatasource',
'./influxdb/influxdbDatasource',
'./opentsdb/opentsdbDatasource',
'./elasticsearch/es-datasource',
......@@ -64,8 +65,8 @@ function (angular, _, config) {
case 'opentsdb':
Datasource = $injector.get('OpenTSDBDatasource');
break;
case 'elasticsearch':
Datasource = $injector.get('ElasticDatasource');
case 'grafana':
Datasource = $injector.get('GrafanaDatasource');
break;
}
return new Datasource(ds);
......
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;
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment