@@ -70,13 +70,13 @@ <h2 class="tabbed-view-title">
70
70
</ div >
71
71
</ div >
72
72
73
- < div ng-if ="mode === 'edit' || mode === 'new' ">
73
+ < form ng-if ="mode === 'edit' || mode === 'new' " name =" ctrl.form ">
74
74
< h5 class ="section-heading "> Variable</ h5 >
75
75
< div class ="gf-form-group ">
76
76
< div class ="gf-form-inline ">
77
77
< div class ="gf-form max-width-19 ">
78
78
< span class ="gf-form-label width-6 "> Name</ span >
79
- < input type ="text " class ="gf-form-input " placeholder ="name " ng-model ='current.name '> </ input >
79
+ < input type ="text " class ="gf-form-input " placeholder ="name " ng-model ='current.name ' required > </ input >
80
80
</ div >
81
81
< div class ="gf-form max-width-19 ">
82
82
< span class ="gf-form-label width-6 ">
@@ -102,15 +102,14 @@ <h5 class="section-heading">Variable</h5>
102
102
</ div >
103
103
</ div >
104
104
</ div >
105
-
106
105
</ div >
107
106
108
- < div ng-show ="current.type === 'interval' " class ="gf-form-group ">
107
+ < div ng-if ="current.type === 'interval' " class ="gf-form-group ">
109
108
< h5 class ="section-heading "> Interval Options</ h5 >
110
109
111
110
< div class ="gf-form ">
112
111
< span class ="gf-form-label width-9 "> Values</ span >
113
- < 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 >
112
+ < 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 >
114
113
</ div >
115
114
< div class ="gf-form ">
116
115
< span class ="gf-form-label width-9 "> Auto option</ span >
@@ -134,30 +133,30 @@ <h5 class="section-heading">Interval Options</h5>
134
133
</ div >
135
134
</ div >
136
135
137
- < div ng-show ="current.type === 'custom' " class ="gf-form-group ">
136
+ < div ng-if ="current.type === 'custom' " class ="gf-form-group ">
138
137
< h5 class ="section-heading "> Custom Options</ h5 >
139
138
< div class ="gf-form ">
140
139
< span class ="gf-form-label width-13 "> Values separated by comma</ span >
141
- < input type ="text " class ="gf-form-input " ng-model ='current.query ' ng-blur ="runQuery() " placeholder ="1, 10, 20, myvalue "> </ input >
140
+ < input type ="text " class ="gf-form-input " ng-model ='current.query ' ng-blur ="runQuery() " placeholder ="1, 10, 20, myvalue " required > </ input >
142
141
</ div >
143
142
</ div >
144
143
145
- < div ng-show ="current.type === 'constant' " class ="gf-form-group ">
144
+ < div ng-if ="current.type === 'constant' " class ="gf-form-group ">
146
145
< h5 class ="section-heading "> Constant options</ h5 >
147
146
< div class ="gf-form ">
148
147
< span class ="gf-form-label "> Value</ span >
149
148
< input type ="text " class ="gf-form-input " ng-model ='current.query ' ng-blur ="runQuery() " placeholder ="your metric prefix "> </ input >
150
149
</ div >
151
150
</ div >
152
151
153
- < div ng-show ="current.type === 'query' " class ="gf-form-group ">
152
+ < div ng-if ="current.type === 'query' " class ="gf-form-group ">
154
153
< h5 class ="section-heading "> Query Options</ h5 >
155
154
156
155
< div class ="gf-form-inline ">
157
156
< div class ="gf-form max-width-21 ">
158
157
< span class ="gf-form-label width-7 "> Data source</ span >
159
158
< div class ="gf-form-select-wrapper max-width-14 ">
160
- < select class ="gf-form-input " ng-model ="current.datasource " ng-options ="f.value as f.name for f in datasources "> </ select >
159
+ < select class ="gf-form-input " ng-model ="current.datasource " ng-options ="f.value as f.name for f in datasources " required > </ select >
161
160
</ div >
162
161
</ div >
163
162
< div class ="gf-form max-width-21 ">
@@ -174,7 +173,7 @@ <h5 class="section-heading">Query Options</h5>
174
173
</ div >
175
174
< div class ="gf-form ">
176
175
< span class ="gf-form-label width-7 "> Query</ span >
177
- < input type ="text " class ="gf-form-input " ng-model ='current.query ' placeholder ="metric name or tags query " ng-model-onblur ng-change ="runQuery() "> </ input >
176
+ < 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 >
178
177
</ div >
179
178
< div class ="gf-form ">
180
179
< span class ="gf-form-label width-7 ">
@@ -223,19 +222,18 @@ <h5 class="section-heading">Data source options</h5>
223
222
</ div >
224
223
</ div >
225
224
226
- < div ng-show ="current.type === 'adhoc' " class ="gf-form-group ">
225
+ < div ng-if ="current.type === 'adhoc' " class ="gf-form-group ">
227
226
< h5 class ="section-heading "> Options</ h5 >
228
-
229
227
< div class ="gf-form max-width-21 ">
230
228
< span class ="gf-form-label width-8 "> Data source</ span >
231
229
< div class ="gf-form-select-wrapper max-width-14 ">
232
- < select class ="gf-form-input " ng-model ="current.datasource " ng-options ="f.value as f.name for f in datasources "> </ select >
230
+ < 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 >
233
231
</ div >
234
232
</ div >
235
- </ div >
233
+ </ div >
236
234
237
- < div class ="section gf-form-group " ng-show ="variableTypes[current.type].supportsMulti ">
238
- < h5 class ="section-heading "> Selection Options</ h5 >
235
+ < div class ="section gf-form-group " ng-show ="variableTypes[current.type].supportsMulti ">
236
+ < h5 class ="section-heading "> Selection Options</ h5 >
239
237
< div class ="section ">
240
238
< gf-form-switch class ="gf-form "
241
239
label ="Multi-value "
@@ -272,20 +270,25 @@ <h5>Value groups/tags (Experimental feature)</h5>
272
270
</ div >
273
271
</ div >
274
272
275
- < div class ="gf-form-group ">
273
+ < div class ="gf-form-group " ng-show =" current.options.length " >
276
274
< h5 > Preview of values (shows max 20)</ h5 >
277
275
< div class ="gf-form-inline ">
278
276
< div class ="gf-form " ng-repeat ="option in current.options | limitTo: 20 ">
279
277
< span class ="gf-form-label "> {{option.text}}</ span >
280
278
</ div >
281
279
</ div >
282
280
</ div >
283
- </ div >
284
281
285
- < div class ="gf-form-button-row p-y-0 ">
286
- < button type ="button " class ="btn btn-success " ng-show ="mode === 'edit' " ng-click ="update(); "> Update</ button >
287
- < button type ="button " class ="btn btn-success " ng-show ="mode === 'new' " ng-click ="add(); "> Add</ button >
288
- </ div >
289
- </ div >
282
+ < div class ="alert alert-info gf-form-group " ng-if ="infoText ">
283
+ {{infoText}}
284
+ </ div >
285
+
286
+ < div class ="gf-form-button-row p-y-0 ">
287
+ < button type ="submit " class ="btn btn-success " ng-show ="mode === 'edit' " ng-click ="update(); "> Update</ button >
288
+ < button type ="submit " class ="btn btn-success " ng-show ="mode === 'new' " ng-click ="add(); "> Add</ button >
289
+ </ div >
290
+
291
+ </ form >
292
+ </ div >
290
293
</ div >
291
294
0 commit comments