Commit 70071e5d by Erik Sundell

rename template variables prop

parent cf50cf16
...@@ -10,7 +10,7 @@ export interface Props { ...@@ -10,7 +10,7 @@ export interface Props {
placeholder?: string; placeholder?: string;
className?: string; className?: string;
groupName?: string; groupName?: string;
templateVariables?: any[]; variables?: any[];
} }
interface State { interface State {
...@@ -19,7 +19,7 @@ interface State { ...@@ -19,7 +19,7 @@ interface State {
export class StackdriverPicker extends React.Component<Props, State> { export class StackdriverPicker extends React.Component<Props, State> {
static defaultProps = { static defaultProps = {
templateVariables: [], variables: [],
options: [], options: [],
groupName: 'Options', groupName: 'Options',
}; };
...@@ -34,7 +34,7 @@ export class StackdriverPicker extends React.Component<Props, State> { ...@@ -34,7 +34,7 @@ export class StackdriverPicker extends React.Component<Props, State> {
} }
componentWillReceiveProps(nextProps: Props) { 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) }); this.setState({ options: this.buildOptions(nextProps) });
} }
} }
...@@ -44,10 +44,10 @@ export class StackdriverPicker extends React.Component<Props, State> { ...@@ -44,10 +44,10 @@ export class StackdriverPicker extends React.Component<Props, State> {
return nextProps.value !== this.props.value || !_.isEqual(nextOptions, this.state.options); return nextProps.value !== this.props.value || !_.isEqual(nextOptions, this.state.options);
} }
buildOptions({ templateVariables = [], groupName = '', options }) { buildOptions({ variables = [], groupName = '', options }) {
return templateVariables.length > 0 return variables.length > 0
? [ ? [
this.getTemplateVariablesGroup(), this.getVariablesGroup(),
{ {
label: groupName, label: groupName,
expanded: true, expanded: true,
...@@ -57,10 +57,10 @@ export class StackdriverPicker extends React.Component<Props, State> { ...@@ -57,10 +57,10 @@ export class StackdriverPicker extends React.Component<Props, State> {
: options; : options;
} }
getTemplateVariablesGroup() { getVariablesGroup() {
return { return {
label: 'Template Variables', label: 'Template Variables',
options: this.props.templateVariables.map(v => ({ options: this.props.variables.map(v => ({
label: `$${v.name}`, label: `$${v.name}`,
value: `$${v.name}`, value: `$${v.name}`,
})), })),
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
is-searchable="true" is-searchable="true"
placeholder="'Select Aggregation'" placeholder="'Select Aggregation'"
className="'width-15'" className="'width-15'"
template-variables="ctrl.templateSrv.variables" variables="ctrl.templateSrv.variables"
group-name="'Aggregations'" group-name="'Aggregations'"
></stackdriver-picker> ></stackdriver-picker>
</div> </div>
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
is-searchable="true" is-searchable="true"
placeholder="'Select Alignment'" placeholder="'Select Alignment'"
className="'width-15'" className="'width-15'"
template-variables="ctrl.templateSrv.variables" variables="ctrl.templateSrv.variables"
group-name="'Alignment Options'" group-name="'Alignment Options'"
></stackdriver-picker> ></stackdriver-picker>
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
is-searchable="true" is-searchable="true"
placeholder="'Select Alignment'" placeholder="'Select Alignment'"
className="'width-15'" className="'width-15'"
template-variables="ctrl.templateSrv.variables" variables="ctrl.templateSrv.variables"
group-name="'Alignment Periods'" group-name="'Alignment Periods'"
></stackdriver-picker> ></stackdriver-picker>
</div> </div>
......
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
onChange="ctrl.handleMetricTypeChange" onChange="ctrl.handleMetricTypeChange"
value="ctrl.target.metricType" value="ctrl.target.metricType"
options="ctrl.getMetricsList()" options="ctrl.getMetricsList()"
template-variables="ctrl.templateSrv.variables" variables="ctrl.templateSrv.variables"
group-name="'Metric Types'" group-name="'Metric Types'"
is-searchable="true" is-searchable="true"
placeholder="'Select Metric'" placeholder="'Select Metric'"
......
...@@ -71,7 +71,7 @@ export class StackdriverQueryCtrl extends QueryCtrl { ...@@ -71,7 +71,7 @@ export class StackdriverQueryCtrl extends QueryCtrl {
'className', 'className',
'placeholder', 'placeholder',
'groupName', 'groupName',
['templateVariables', { watchDepth: 'reference' }], ['variables', { watchDepth: 'reference' }],
]); ]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment