Sfoglia il codice sorgente

refactoring: slight changes to PR #13247

Torkel Ödegaard 7 anni fa
parent
commit
7d44aacf4a

+ 2 - 2
public/app/features/dashboard/submenu/submenu.html

@@ -4,8 +4,8 @@
       <label class="gf-form-label template-variable" ng-hide="variable.hide === 1">
         {{variable.label || variable.name}}
       </label>
-      <value-select-dropdown ng-if="variable.type !== 'adhoc' && variable.type !== 'text'" variable="variable" on-updated="ctrl.variableUpdated(variable)"></value-select-dropdown>
-      <input type="text" ng-if="variable.type === 'text'" ng-model="variable.query" class="gf-form-input width-9"  ng-blur="variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ng-keydown="$event.keyCode === 13 && variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ></input>
+      <value-select-dropdown ng-if="variable.type !== 'adhoc' && variable.type !== 'textbox'" variable="variable" on-updated="ctrl.variableUpdated(variable)"></value-select-dropdown>
+      <input type="text" ng-if="variable.type === 'textbox'" ng-model="variable.query" class="gf-form-input width-12"  ng-blur="variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ng-keydown="$event.keyCode === 13 && variable.current.value != variable.query && variable.updateOptions() && ctrl.variableUpdated(variable);" ></input>
     </div>
     <ad-hoc-filters ng-if="variable.type === 'adhoc'" variable="variable"></ad-hoc-filters>
   </div>

+ 5 - 5
public/app/features/templating/text_variable.ts → public/app/features/templating/TextBoxVariable.ts

@@ -1,13 +1,13 @@
 import { Variable, assignModelProperties, variableTypes } from './variable';
 
-export class TextVariable implements Variable {
+export class TextBoxVariable implements Variable {
   query: string;
   current: any;
   options: any[];
   skipUrlSync: boolean;
 
   defaults = {
-    type: 'text',
+    type: 'textbox',
     name: '',
     hide: 2,
     label: '',
@@ -51,8 +51,8 @@ export class TextVariable implements Variable {
   }
 }
 
-variableTypes['text'] = {
-  name: 'Text',
-  ctor: TextVariable,
+variableTypes['textbox'] = {
+  name: 'Text box',
+  ctor: TextBoxVariable,
   description: 'Define a textbox variable, where users can enter any arbitrary string',
 };

+ 2 - 2
public/app/features/templating/all.ts

@@ -9,7 +9,7 @@ import { DatasourceVariable } from './datasource_variable';
 import { CustomVariable } from './custom_variable';
 import { ConstantVariable } from './constant_variable';
 import { AdhocVariable } from './adhoc_variable';
-import { TextVariable } from './text_variable';
+import { TextBoxVariable } from './TextBoxVariable';
 
 coreModule.factory('templateSrv', () => {
   return templateSrv;
@@ -23,5 +23,5 @@ export {
   CustomVariable,
   ConstantVariable,
   AdhocVariable,
-  TextVariable
+  TextBoxVariable,
 };

+ 2 - 2
public/app/features/templating/partials/editor.html

@@ -155,10 +155,10 @@
 			</div>
 		</div>
 
-		<div ng-if="current.type === 'text'" class="gf-form-group">
+		<div ng-if="current.type === 'textbox'" class="gf-form-group">
 			<h5 class="section-heading">Text options</h5>
 			<div class="gf-form">
-				<span class="gf-form-label">Value</span>
+				<span class="gf-form-label">Default value</span>
 				<input type="text" class="gf-form-input" ng-model='current.query' ng-blur="runQuery()" placeholder="default value, if any"></input>
 			</div>
 		</div>