Explorar o código

allow to add annotation for non editable dashboard

Mitsuhiro Tanda %!s(int64=7) %!d(string=hai) anos
pai
achega
fe301142ba
Modificáronse 1 ficheiros con 2 adicións e 2 borrados
  1. 2 2
      public/app/plugins/panel/graph/graph.ts

+ 2 - 2
public/app/plugins/panel/graph/graph.ts

@@ -674,7 +674,7 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
           return;
         }
 
-        if ((ranges.ctrlKey || ranges.metaKey) && dashboard.meta.canEdit) {
+        if ((ranges.ctrlKey || ranges.metaKey) && contextSrv.isEditor) {
           // Add annotation
           setTimeout(() => {
             eventManager.updateTime(ranges.xaxis);
@@ -695,7 +695,7 @@ function graphDirective(timeSrv, popoverSrv, contextSrv) {
           return;
         }
 
-        if ((pos.ctrlKey || pos.metaKey) && dashboard.meta.canEdit) {
+        if ((pos.ctrlKey || pos.metaKey) && contextSrv.isEditor) {
           // Skip if range selected (added in "plotselected" event handler)
           let isRangeSelection = pos.x !== pos.x1;
           if (!isRangeSelection) {