File tree Expand file tree Collapse file tree 2 files changed +14
-2
lines changed
public/app/plugins/panel/singlestat Expand file tree Collapse file tree 2 files changed +14
-2
lines changed Original file line number Diff line number Diff line change 179
179
Min
180
180
</ li >
181
181
< li >
182
- < input type ="text " class ="input-small tight-form-input " ng-model ="ctrl.panel.gauge.minValue " ng-blur ="ctrl.render() " placeholder ="0 "> </ input >
182
+ < input type ="number " class ="input-small tight-form-input " ng-model ="ctrl.panel.gauge.minValue " ng-blur ="ctrl.render() " placeholder ="0 "> </ input >
183
183
</ li >
184
184
< li class ="tight-form-item last ">
185
185
Max
186
186
</ li >
187
187
< li >
188
- < input type ="text " class ="input-small tight-form-input last " ng-model ="ctrl.panel.gauge.maxValue " ng-blur ="ctrl.render() " placeholder ="100 "> </ input >
188
+ < input type ="number " class ="input-small tight-form-input last " ng-model ="ctrl.panel.gauge.maxValue " ng-blur ="ctrl.render() " placeholder ="100 "> </ input >
189
+ < span class ="alert-state-critical " ng-show ="ctrl.invalidGaugeRange ">
190
+
191
+ < i class ="fa fa-warning "> </ i >
192
+ Min value is bigger than max.
193
+ </ span >
189
194
</ li >
190
195
</ ul >
191
196
< div class ="clearfix "> </ div >
Original file line number Diff line number Diff line change @@ -18,6 +18,7 @@ class SingleStatCtrl extends MetricsPanelCtrl {
18
18
data : any ;
19
19
fontSizes : any [ ] ;
20
20
unitFormats : any [ ] ;
21
+ invalidGaugeRange : boolean ;
21
22
22
23
// Set and populate defaults
23
24
panelDefaults = {
@@ -287,6 +288,12 @@ class SingleStatCtrl extends MetricsPanelCtrl {
287
288
}
288
289
289
290
function addGauge ( ) {
291
+ ctrl . invalidGaugeRange = false ;
292
+ if ( panel . gauge . minValue > panel . gauge . maxValue ) {
293
+ ctrl . invalidGaugeRange = true ;
294
+ return ;
295
+ }
296
+
290
297
var plotCanvas = $ ( '<div></div>' ) ;
291
298
var plotCss = {
292
299
top : '10px' ,
You can’t perform that action at this time.
0 commit comments