Просмотр исходного кода

Merge pull request #7758 from thuck/template_self_reference_7614

Validate query to avoid self-reference of variable #7614
Daniel Lee 8 лет назад
Родитель
Сommit
e527aebbf1
1 измененных файлов с 5 добавлено и 0 удалено
  1. 5 0
      public/app/features/templating/editor_ctrl.ts

+ 5 - 0
public/app/features/templating/editor_ctrl.ts

@@ -77,6 +77,11 @@ export class VariableEditorCtrl {
         return false;
         return false;
       }
       }
 
 
+      if ($scope.current.type === 'query' && $scope.current.query.match(new RegExp('\\$' + $scope.current.name))) {
+        $scope.appEvent('alert-warning', ['Validation', 'Query contains variable self-reference']);
+        return false;
+      }
+
       return true;
       return true;
     };
     };