Merge remote-tracking branch 'upstream/create-annotations' into create-annotations

This commit is contained in:
Alexander Zobnin
2017-04-12 17:36:40 +03:00
11 changed files with 65 additions and 28 deletions

View File

@@ -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) {