From 96d65b55b66917f33207c105dd7d38396f31f830 Mon Sep 17 00:00:00 2001 From: Erik Sundell Date: Wed, 19 Dec 2018 21:23:05 +0100 Subject: [PATCH] rename template variables prop --- .../stackdriver/components/StackdriverPicker.tsx | 16 ++++++++-------- .../stackdriver/partials/query.aggregation.html | 6 +++--- .../stackdriver/partials/query.filter.html | 2 +- .../plugins/datasource/stackdriver/query_ctrl.ts | 2 +- 4 files changed, 13 insertions(+), 13 deletions(-) diff --git a/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx b/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx index 7f7e6f901fa..1cd9dcb1f53 100644 --- a/public/app/plugins/datasource/stackdriver/components/StackdriverPicker.tsx +++ b/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 { static defaultProps = { - templateVariables: [], + variables: [], options: [], groupName: 'Options', }; @@ -34,7 +34,7 @@ export class StackdriverPicker extends React.Component { } 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 { 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 { : 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}`, })), diff --git a/public/app/plugins/datasource/stackdriver/partials/query.aggregation.html b/public/app/plugins/datasource/stackdriver/partials/query.aggregation.html index 8d053256a2d..122f14a9cb6 100755 --- a/public/app/plugins/datasource/stackdriver/partials/query.aggregation.html +++ b/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'" > @@ -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'" > @@ -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'" > diff --git a/public/app/plugins/datasource/stackdriver/partials/query.filter.html b/public/app/plugins/datasource/stackdriver/partials/query.filter.html index 7ae42e73596..f93a7a6eb16 100644 --- a/public/app/plugins/datasource/stackdriver/partials/query.filter.html +++ b/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'" diff --git a/public/app/plugins/datasource/stackdriver/query_ctrl.ts b/public/app/plugins/datasource/stackdriver/query_ctrl.ts index 9ae5d4daae1..c8a2daf9ba5 100644 --- a/public/app/plugins/datasource/stackdriver/query_ctrl.ts +++ b/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' }], ]); }