mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Merge remote-tracking branch 'upstream/create-annotations' into create-annotations
This commit is contained in:
@@ -35,6 +35,13 @@ export class AnnotationsSrv {
|
||||
|
||||
// combine the annotations and flatten results
|
||||
var annotations = _.flattenDeep([results[0], results[1]]);
|
||||
// filter out annotations that do not belong to requesting panel
|
||||
annotations = _.filter(annotations, item => {
|
||||
if (item.panelId && options.panel.id !== item.panelId) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
});
|
||||
|
||||
// look for alert state for this panel
|
||||
var alertState = _.find(results[2], {panelId: options.panel.id});
|
||||
@@ -127,20 +134,9 @@ export class AnnotationsSrv {
|
||||
}
|
||||
|
||||
postAnnotation(annotations) {
|
||||
console.log("POST /api/annotations\n", annotations);
|
||||
|
||||
// Not implemented yet
|
||||
let implemented = true;
|
||||
if (implemented) {
|
||||
return Promise.all(_.map(annotations, annotation => {
|
||||
return this.backendSrv.post('/api/annotations', annotation);
|
||||
}))
|
||||
.catch(error => {
|
||||
console.log(error);
|
||||
});
|
||||
} else {
|
||||
return Promise.resolve("Not implemented");
|
||||
}
|
||||
return Promise.all(_.map(annotations, annotation => {
|
||||
return this.backendSrv.post('/api/annotations', annotation);
|
||||
}));
|
||||
}
|
||||
|
||||
translateQueryResult(annotation, results) {
|
||||
|
||||
Reference in New Issue
Block a user