Merge branch 'master' of github.com:grafana/grafana

This commit is contained in:
Torkel Ödegaard 2016-01-12 10:32:49 +01:00
commit ae6cae0771
6 changed files with 31 additions and 6 deletions

View File

@ -1,6 +1,5 @@
# 3.0.0 (unrelased master branch) # 3.0.0 (unrelased master branch)
### Breaking changes ### Breaking changes
**InfluxDB 0.8.x** The data source for the old version of influxdb (0.8.x) is no longer included in default builds. Can easily be installed via improved plugin system, closes #3523 **InfluxDB 0.8.x** The data source for the old version of influxdb (0.8.x) is no longer included in default builds. Can easily be installed via improved plugin system, closes #3523
**KairosDB** The data source is no longer included in default builds. Can easily be installed via improved plugin system, closes #3524 **KairosDB** The data source is no longer included in default builds. Can easily be installed via improved plugin system, closes #3524
@ -8,6 +7,7 @@
### Enhancements ### ### Enhancements ###
* **Sessions**: Support for memcached as session storage, closes [#3458](https://github.com/grafana/grafana/pull/3458) * **Sessions**: Support for memcached as session storage, closes [#3458](https://github.com/grafana/grafana/pull/3458)
* **mysql**: Grafana now supports ssl for mysql, closes [#3584](https://github.com/grafana/grafana/pull/3584) * **mysql**: Grafana now supports ssl for mysql, closes [#3584](https://github.com/grafana/grafana/pull/3584)
* **snapshot**: Annotations are now included in snapshots, closes [#3635](https://github.com/grafana/grafana/pull/3635)
# 2.6.1 (unrelased, 2.6.x branch) # 2.6.1 (unrelased, 2.6.x branch)

View File

@ -47,6 +47,7 @@
"karma-phantomjs-launcher": "0.2.1", "karma-phantomjs-launcher": "0.2.1",
"load-grunt-tasks": "3.4.0", "load-grunt-tasks": "3.4.0",
"mocha": "2.3.4", "mocha": "2.3.4",
"phantomjs": "^1.9.19",
"reflect-metadata": "0.1.2", "reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0", "rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6", "systemjs": "0.19.6",

View File

@ -38,10 +38,19 @@ define([
var rangeRaw = timeSrv.timeRange(false); var rangeRaw = timeSrv.timeRange(false);
var promises = _.map(annotations, function(annotation) { var promises = _.map(annotations, function(annotation) {
if (annotation.snapshotData) {
self.receiveAnnotationResults(annotation.snapshotData);
return;
}
return datasourceSrv.get(annotation.datasource).then(function(datasource) { return datasourceSrv.get(annotation.datasource).then(function(datasource) {
var query = {range: range, rangeRaw: rangeRaw, annotation: annotation}; var query = {range: range, rangeRaw: rangeRaw, annotation: annotation};
return datasource.annotationQuery(query) return datasource.annotationQuery(query)
.then(self.receiveAnnotationResults) .then(self.receiveAnnotationResults)
.then(function(results) {
if (dashboard.snapshot) {
annotation.snapshotData = angular.copy(results);
}
})
.then(null, errorHandler); .then(null, errorHandler);
}, this); }, this);
}); });
@ -58,6 +67,8 @@ define([
for (var i = 0; i < results.length; i++) { for (var i = 0; i < results.length; i++) {
self.addAnnotation(results[i]); self.addAnnotation(results[i]);
} }
return results;
}; };
this.addAnnotation = function(options) { this.addAnnotation = function(options) {

View File

@ -101,8 +101,18 @@ function (angular, _) {
panel.links = []; panel.links = [];
panel.datasource = null; panel.datasource = null;
}); });
// remove annotations // remove annotation queries
dash.annotations.list = []; dash.annotations.list = _.chain(dash.annotations.list)
.filter(function(annotation) {
return annotation.enable;
})
.map(function(annotation) {
return {
name: annotation.name,
enable: annotation.enable,
snapshotData: annotation.snapshotData
};
}).value();
// remove template queries // remove template queries
_.each(dash.templating.list, function(variable) { _.each(dash.templating.list, function(variable) {
variable.query = ""; variable.query = "";
@ -122,6 +132,9 @@ function (angular, _) {
$scope.dashboard.forEachPanel(function(panel) { $scope.dashboard.forEachPanel(function(panel) {
delete panel.snapshotData; delete panel.snapshotData;
}); });
_.each($scope.dashboard.annotations.list, function(annotation) {
delete annotation.snapshotData;
});
}; };
$scope.deleteSnapshot = function() { $scope.deleteSnapshot = function() {

View File

@ -11,7 +11,7 @@ function (_, moment) {
} }
IndexPattern.intervalMap = { IndexPattern.intervalMap = {
"Hours": { startOf: 'hour', amount: 'hours'}, "Hourly": { startOf: 'hour', amount: 'hours'},
"Daily": { startOf: 'day', amount: 'days'}, "Daily": { startOf: 'day', amount: 'days'},
"Weekly": { startOf: 'isoWeek', amount: 'weeks'}, "Weekly": { startOf: 'isoWeek', amount: 'weeks'},
"Monthly": { startOf: 'month', amount: 'months'}, "Monthly": { startOf: 'month', amount: 'months'},

View File

@ -21,7 +21,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
}; };
}); });
module.controller('GraphCtrl', function($scope, $rootScope, panelSrv, annotationsSrv, panelHelper, $q) { module.controller('GraphCtrl', function($scope, $rootScope, panelSrv, annotationsSrv, panelHelper) {
$scope.panelMeta = new PanelMeta({ $scope.panelMeta = new PanelMeta({
panelName: 'Graph', panelName: 'Graph',
@ -144,7 +144,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
$scope.loadSnapshot = function(snapshotData) { $scope.loadSnapshot = function(snapshotData) {
panelHelper.updateTimeRange($scope); panelHelper.updateTimeRange($scope);
$scope.annotationsPromise = $q.when([]); $scope.annotationsPromise = annotationsSrv.getAnnotations($scope.dashboard);
$scope.dataHandler(snapshotData); $scope.dataHandler(snapshotData);
}; };