소스 검색

Annotations: Check that timeEnd if defined before comparing to avoid false truthiness (#18903)

* Check that timeEnd if defined before comparing to avoid false truthiness

* Moved loop

Fixes #18902
Shavonn Brown 6 년 전
부모
커밋
849d4881cd
1개의 변경된 파일2개의 추가작업 그리고 4개의 파일을 삭제
  1. 2 4
      public/app/features/annotations/annotations_srv.ts

+ 2 - 4
public/app/features/annotations/annotations_srv.ts

@@ -60,10 +60,6 @@ export class AnnotationsSrv {
         });
 
         annotations = dedupAnnotations(annotations);
-        for (let i = 0; i < annotations.length; i++) {
-          const a = annotations[i];
-          a.isRegion = a.time !== a.timeEnd;
-        }
 
         // look for alert state for this panel
         const alertState: any = _.find(results[1], { panelId: options.panel.id });
@@ -181,7 +177,9 @@ export class AnnotationsSrv {
 
     for (const item of results) {
       item.source = annotation;
+      item.isRegion = item.timeEnd && item.time !== item.timeEnd;
     }
+
     return results;
   }
 }