Browse Source

Disable prefix and postfix font size when gauge mode is enabled (#10573)

* Disable prefix and postfix font size when gauge mode is enabled

* Use function to hide prefix/postfix size when using gauge

* Rename disableFontSizes to canChangeFontSizes
Jonathan McCall 8 years ago
parent
commit
579d2b63f8

+ 2 - 2
public/app/plugins/panel/singlestat/editor.html

@@ -29,7 +29,7 @@
         <input type="text" class="gf-form-input width-12" ng-model="ctrl.panel.prefix" ng-change="ctrl.render()" ng-model-onblur>
         <label class="gf-form-label width-6">Font size</label>
         <div class="gf-form-select-wrapper">
-          <select class="gf-form-input" ng-model="ctrl.panel.prefixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()"></select>
+          <select class="gf-form-input" ng-model="ctrl.panel.prefixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()" ng-disabled="ctrl.canChangeFontSize()"></select>
         </div>
       </div>
     </div>
@@ -39,7 +39,7 @@
       <input type="text" class="gf-form-input width-12" ng-model="ctrl.panel.postfix" ng-change="ctrl.render()" ng-model-onblur>
       <label class="gf-form-label width-6">Font size</label>
       <div class="gf-form-select-wrapper">
-        <select class="input-small gf-form-input" ng-model="ctrl.panel.postfixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()"></select>
+        <select class="input-small gf-form-input" ng-model="ctrl.panel.postfixFontSize" ng-options="f for f in ctrl.fontSizes" ng-change="ctrl.render()" ng-disabled="ctrl.canChangeFontSize()"></select>
       </div>
     </div>
     <div class="gf-form">

+ 4 - 0
public/app/plugins/panel/singlestat/module.ts

@@ -198,6 +198,10 @@ class SingleStatCtrl extends MetricsPanelCtrl {
     this.setValueMapping(data);
   }
 
+   canChangeFontSize() {
+     return this.panel.gauge.show;
+   }
+
   setColoring(options) {
     if (options.background) {
       this.panel.colorValue = false;