Skip to content

Commit ae6cae0

Browse files
committed
Merge branch 'master' of github.com:grafana/grafana
2 parents 2b99b64 + 16cd272 commit ae6cae0

File tree

6 files changed

+31
-6
lines changed

6 files changed

+31
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# 3.0.0 (unrelased master branch)
22

3-
43
### Breaking changes
54
**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
65
**KairosDB** The data source is no longer included in default builds. Can easily be installed via improved plugin system, closes #3524
76

87
### Enhancements ###
98
* **Sessions**: Support for memcached as session storage, closes [#3458](https://github.com/grafana/grafana/pull/3458)
109
* **mysql**: Grafana now supports ssl for mysql, closes [#3584](https://github.com/grafana/grafana/pull/3584)
10+
* **snapshot**: Annotations are now included in snapshots, closes [#3635](https://github.com/grafana/grafana/pull/3635)
1111

1212
# 2.6.1 (unrelased, 2.6.x branch)
1313

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
"karma-phantomjs-launcher": "0.2.1",
4848
"load-grunt-tasks": "3.4.0",
4949
"mocha": "2.3.4",
50+
"phantomjs": "^1.9.19",
5051
"reflect-metadata": "0.1.2",
5152
"rxjs": "5.0.0-beta.0",
5253
"systemjs": "0.19.6",

public/app/features/annotations/annotationsSrv.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,19 @@ define([
3838
var rangeRaw = timeSrv.timeRange(false);
3939

4040
var promises = _.map(annotations, function(annotation) {
41+
if (annotation.snapshotData) {
42+
self.receiveAnnotationResults(annotation.snapshotData);
43+
return;
44+
}
4145
return datasourceSrv.get(annotation.datasource).then(function(datasource) {
4246
var query = {range: range, rangeRaw: rangeRaw, annotation: annotation};
4347
return datasource.annotationQuery(query)
4448
.then(self.receiveAnnotationResults)
49+
.then(function(results) {
50+
if (dashboard.snapshot) {
51+
annotation.snapshotData = angular.copy(results);
52+
}
53+
})
4554
.then(null, errorHandler);
4655
}, this);
4756
});
@@ -58,6 +67,8 @@ define([
5867
for (var i = 0; i < results.length; i++) {
5968
self.addAnnotation(results[i]);
6069
}
70+
71+
return results;
6172
};
6273

6374
this.addAnnotation = function(options) {

public/app/features/dashboard/shareSnapshotCtrl.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,18 @@ function (angular, _) {
101101
panel.links = [];
102102
panel.datasource = null;
103103
});
104-
// remove annotations
105-
dash.annotations.list = [];
104+
// remove annotation queries
105+
dash.annotations.list = _.chain(dash.annotations.list)
106+
.filter(function(annotation) {
107+
return annotation.enable;
108+
})
109+
.map(function(annotation) {
110+
return {
111+
name: annotation.name,
112+
enable: annotation.enable,
113+
snapshotData: annotation.snapshotData
114+
};
115+
}).value();
106116
// remove template queries
107117
_.each(dash.templating.list, function(variable) {
108118
variable.query = "";
@@ -122,6 +132,9 @@ function (angular, _) {
122132
$scope.dashboard.forEachPanel(function(panel) {
123133
delete panel.snapshotData;
124134
});
135+
_.each($scope.dashboard.annotations.list, function(annotation) {
136+
delete annotation.snapshotData;
137+
});
125138
};
126139

127140
$scope.deleteSnapshot = function() {

public/app/plugins/datasource/elasticsearch/index_pattern.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ function (_, moment) {
1111
}
1212

1313
IndexPattern.intervalMap = {
14-
"Hours": { startOf: 'hour', amount: 'hours'},
14+
"Hourly": { startOf: 'hour', amount: 'hours'},
1515
"Daily": { startOf: 'day', amount: 'days'},
1616
"Weekly": { startOf: 'isoWeek', amount: 'weeks'},
1717
"Monthly": { startOf: 'month', amount: 'months'},

public/app/plugins/panels/graph/module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
2121
};
2222
});
2323

24-
module.controller('GraphCtrl', function($scope, $rootScope, panelSrv, annotationsSrv, panelHelper, $q) {
24+
module.controller('GraphCtrl', function($scope, $rootScope, panelSrv, annotationsSrv, panelHelper) {
2525

2626
$scope.panelMeta = new PanelMeta({
2727
panelName: 'Graph',
@@ -144,7 +144,7 @@ function (angular, _, moment, kbn, TimeSeries, PanelMeta) {
144144

145145
$scope.loadSnapshot = function(snapshotData) {
146146
panelHelper.updateTimeRange($scope);
147-
$scope.annotationsPromise = $q.when([]);
147+
$scope.annotationsPromise = annotationsSrv.getAnnotations($scope.dashboard);
148148
$scope.dataHandler(snapshotData);
149149
};
150150

0 commit comments

Comments
 (0)