mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
template: dont allow template variables to begin with '__'
closes #7678
This commit is contained in:
parent
1631c8de95
commit
62eb19a186
@ -10,6 +10,7 @@ export class VariableEditorCtrl {
|
||||
constructor(private $scope, private datasourceSrv, private variableSrv, templateSrv) {
|
||||
$scope.variableTypes = variableTypes;
|
||||
$scope.ctrl = {};
|
||||
$scope.namePattern = /^((?!__).)*$/;
|
||||
|
||||
$scope.refreshOptions = [
|
||||
{value: 0, text: "Never"},
|
||||
|
@ -73,10 +73,13 @@
|
||||
<form ng-if="mode === 'edit' || mode === 'new'" name="ctrl.form">
|
||||
<h5 class="section-heading">Variable</h5>
|
||||
<div class="gf-form-group">
|
||||
<div class="gf-form" ng-show="ctrl.form.name.$error.pattern">
|
||||
<span class="gf-form-error">Template names cannot begin with '__' that's reserved for Grafanas global variables</span>
|
||||
</div>
|
||||
<div class="gf-form-inline">
|
||||
<div class="gf-form max-width-19">
|
||||
<span class="gf-form-label width-6">Name</span>
|
||||
<input type="text" class="gf-form-input" placeholder="name" ng-model='current.name' required></input>
|
||||
<input type="text" class="gf-form-input" name="name" placeholder="name" ng-model='current.name' required ng-pattern="namePattern"></input>
|
||||
</div>
|
||||
<div class="gf-form max-width-19">
|
||||
<span class="gf-form-label width-6">
|
||||
|
@ -66,6 +66,25 @@ $gf-form-margin: 0.25rem;
|
||||
}
|
||||
}
|
||||
|
||||
.gf-form-error {
|
||||
padding: $input-padding-y $input-padding-x;
|
||||
margin-right: $gf-form-margin;
|
||||
flex-shrink: 0;
|
||||
|
||||
background-color: $input-label-bg;
|
||||
display: block;
|
||||
font-size: $font-size-sm;
|
||||
margin-right: $gf-form-margin;
|
||||
|
||||
border: $input-btn-border-width solid $red;
|
||||
@include border-radius($label-border-radius-sm);
|
||||
|
||||
&--grow {
|
||||
flex-grow: 1;
|
||||
min-height: 2.60rem;
|
||||
}
|
||||
}
|
||||
|
||||
.gf-form-checkbox {
|
||||
flex-shrink: 0;
|
||||
padding: $input-padding-y $input-padding-x;
|
||||
|
Loading…
Reference in New Issue
Block a user