浏览代码

rename template variables prop

Erik Sundell 7 年之前
父节点
当前提交
96d65b55b6

+ 8 - 8
public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx

@@ -10,7 +10,7 @@ export interface Props {
   placeholder?: string;
   className?: string;
   groupName?: string;
-  templateVariables?: any[];
+  variables?: any[];
 }
 
 interface State {
@@ -19,7 +19,7 @@ interface State {
 
 export class StackdriverPicker extends React.Component<Props, State> {
   static defaultProps = {
-    templateVariables: [],
+    variables: [],
     options: [],
     groupName: 'Options',
   };
@@ -34,7 +34,7 @@ export class StackdriverPicker extends React.Component<Props, State> {
   }
 
   componentWillReceiveProps(nextProps: Props) {
-    if (nextProps.options.length > 0 || nextProps.templateVariables.length) {
+    if (nextProps.options.length > 0 || nextProps.variables.length) {
       this.setState({ options: this.buildOptions(nextProps) });
     }
   }
@@ -44,10 +44,10 @@ export class StackdriverPicker extends React.Component<Props, State> {
     return nextProps.value !== this.props.value || !_.isEqual(nextOptions, this.state.options);
   }
 
-  buildOptions({ templateVariables = [], groupName = '', options }) {
-    return templateVariables.length > 0
+  buildOptions({ variables = [], groupName = '', options }) {
+    return variables.length > 0
       ? [
-          this.getTemplateVariablesGroup(),
+          this.getVariablesGroup(),
           {
             label: groupName,
             expanded: true,
@@ -57,10 +57,10 @@ export class StackdriverPicker extends React.Component<Props, State> {
       : options;
   }
 
-  getTemplateVariablesGroup() {
+  getVariablesGroup() {
     return {
       label: 'Template Variables',
-      options: this.props.templateVariables.map(v => ({
+      options: this.props.variables.map(v => ({
         label: `$${v.name}`,
         value: `$${v.name}`,
       })),

+ 3 - 3
public/app/plugins/datasource/stackdriver/partials/query.aggregation.html

@@ -8,7 +8,7 @@
       is-searchable="true"
       placeholder="'Select Aggregation'"
       className="'width-15'"
-      template-variables="ctrl.templateSrv.variables"
+      variables="ctrl.templateSrv.variables"
       group-name="'Aggregations'"
     ></stackdriver-picker>
   </div>
@@ -31,7 +31,7 @@
       is-searchable="true"
       placeholder="'Select Alignment'"
       className="'width-15'"
-      template-variables="ctrl.templateSrv.variables"
+      variables="ctrl.templateSrv.variables"
       group-name="'Alignment Options'"
     ></stackdriver-picker>
 
@@ -48,7 +48,7 @@
       is-searchable="true"
       placeholder="'Select Alignment'"
       className="'width-15'"
-      template-variables="ctrl.templateSrv.variables"
+      variables="ctrl.templateSrv.variables"
       group-name="'Alignment Periods'"
     ></stackdriver-picker>
   </div>

+ 1 - 1
public/app/plugins/datasource/stackdriver/partials/query.filter.html

@@ -19,7 +19,7 @@
       onChange="ctrl.handleMetricTypeChange"
       value="ctrl.target.metricType"
       options="ctrl.getMetricsList()"
-      template-variables="ctrl.templateSrv.variables"
+      variables="ctrl.templateSrv.variables"
       group-name="'Metric Types'"
       is-searchable="true"
       placeholder="'Select Metric'"

+ 1 - 1
public/app/plugins/datasource/stackdriver/query_ctrl.ts

@@ -71,7 +71,7 @@ export class StackdriverQueryCtrl extends QueryCtrl {
       'className',
       'placeholder',
       'groupName',
-      ['templateVariables', { watchDepth: 'reference' }],
+      ['variables', { watchDepth: 'reference' }],
     ]);
   }