|
|
@@ -70,13 +70,13 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div ng-if="mode === 'edit' || mode === 'new'">
|
|
|
+ <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-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'></input>
|
|
|
+ <input type="text" class="gf-form-input" placeholder="name" ng-model='current.name' required></input>
|
|
|
</div>
|
|
|
<div class="gf-form max-width-19">
|
|
|
<span class="gf-form-label width-6">
|
|
|
@@ -102,15 +102,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</div>
|
|
|
|
|
|
- <div ng-show="current.type === 'interval'" class="gf-form-group">
|
|
|
+ <div ng-if="current.type === 'interval'" class="gf-form-group">
|
|
|
<h5 class="section-heading">Interval Options</h5>
|
|
|
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label width-9">Values</span>
|
|
|
- <input type="text" class="gf-form-input" placeholder="name" ng-model='current.query' placeholder="1m,10m,1h,6h,1d,7d" ng-model-onblur ng-change="runQuery()"></input>
|
|
|
+ <input type="text" class="gf-form-input" placeholder="name" ng-model='current.query' placeholder="1m,10m,1h,6h,1d,7d" ng-model-onblur ng-change="runQuery()" required></input>
|
|
|
</div>
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label width-9">Auto option</span>
|
|
|
@@ -134,15 +133,15 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div ng-show="current.type === 'custom'" class="gf-form-group">
|
|
|
+ <div ng-if="current.type === 'custom'" class="gf-form-group">
|
|
|
<h5 class="section-heading">Custom Options</h5>
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label width-13">Values separated by comma</span>
|
|
|
- <input type="text" class="gf-form-input" ng-model='current.query' ng-blur="runQuery()" placeholder="1, 10, 20, myvalue"></input>
|
|
|
+ <input type="text" class="gf-form-input" ng-model='current.query' ng-blur="runQuery()" placeholder="1, 10, 20, myvalue" required></input>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div ng-show="current.type === 'constant'" class="gf-form-group">
|
|
|
+ <div ng-if="current.type === 'constant'" class="gf-form-group">
|
|
|
<h5 class="section-heading">Constant options</h5>
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label">Value</span>
|
|
|
@@ -150,14 +149,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div ng-show="current.type === 'query'" class="gf-form-group">
|
|
|
+ <div ng-if="current.type === 'query'" class="gf-form-group">
|
|
|
<h5 class="section-heading">Query Options</h5>
|
|
|
|
|
|
<div class="gf-form-inline">
|
|
|
<div class="gf-form max-width-21">
|
|
|
<span class="gf-form-label width-7">Data source</span>
|
|
|
<div class="gf-form-select-wrapper max-width-14">
|
|
|
- <select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources"></select>
|
|
|
+ <select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required></select>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="gf-form max-width-21">
|
|
|
@@ -174,7 +173,7 @@
|
|
|
</div>
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label width-7">Query</span>
|
|
|
- <input type="text" class="gf-form-input" ng-model='current.query' placeholder="metric name or tags query" ng-model-onblur ng-change="runQuery()"></input>
|
|
|
+ <input type="text" class="gf-form-input" ng-model='current.query' placeholder="metric name or tags query" ng-model-onblur ng-change="runQuery()" required></input>
|
|
|
</div>
|
|
|
<div class="gf-form">
|
|
|
<span class="gf-form-label width-7">
|
|
|
@@ -223,19 +222,18 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div ng-show="current.type === 'adhoc'" class="gf-form-group">
|
|
|
+ <div ng-if="current.type === 'adhoc'" class="gf-form-group">
|
|
|
<h5 class="section-heading">Options</h5>
|
|
|
-
|
|
|
<div class="gf-form max-width-21">
|
|
|
<span class="gf-form-label width-8">Data source</span>
|
|
|
<div class="gf-form-select-wrapper max-width-14">
|
|
|
- <select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources"></select>
|
|
|
+ <select class="gf-form-input" ng-model="current.datasource" ng-options="f.value as f.name for f in datasources" required ng-change="validate()"></select>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div class="section gf-form-group" ng-show="variableTypes[current.type].supportsMulti">
|
|
|
- <h5 class="section-heading">Selection Options</h5>
|
|
|
+ <div class="section gf-form-group" ng-show="variableTypes[current.type].supportsMulti">
|
|
|
+ <h5 class="section-heading">Selection Options</h5>
|
|
|
<div class="section">
|
|
|
<gf-form-switch class="gf-form"
|
|
|
label="Multi-value"
|
|
|
@@ -272,7 +270,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <div class="gf-form-group">
|
|
|
+ <div class="gf-form-group" ng-show="current.options.length">
|
|
|
<h5>Preview of values (shows max 20)</h5>
|
|
|
<div class="gf-form-inline">
|
|
|
<div class="gf-form" ng-repeat="option in current.options | limitTo: 20">
|
|
|
@@ -280,12 +278,17 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
- </div>
|
|
|
|
|
|
- <div class="gf-form-button-row p-y-0">
|
|
|
- <button type="button" class="btn btn-success" ng-show="mode === 'edit'" ng-click="update();">Update</button>
|
|
|
- <button type="button" class="btn btn-success" ng-show="mode === 'new'" ng-click="add();">Add</button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div class="alert alert-info gf-form-group" ng-if="infoText">
|
|
|
+ {{infoText}}
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div class="gf-form-button-row p-y-0">
|
|
|
+ <button type="submit" class="btn btn-success" ng-show="mode === 'edit'" ng-click="update();">Update</button>
|
|
|
+ <button type="submit" class="btn btn-success" ng-show="mode === 'new'" ng-click="add();">Add</button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </form>
|
|
|
+ </div>
|
|
|
</div>
|
|
|
|