Commit cf50cf16 by Erik Sundell

rename selected prop

parent ed673d35
...@@ -6,7 +6,7 @@ export interface Props { ...@@ -6,7 +6,7 @@ export interface Props {
onChange: (value: string) => void; onChange: (value: string) => void;
options: any[]; options: any[];
isSearchable: boolean; isSearchable: boolean;
selected: string; value: string;
placeholder?: string; placeholder?: string;
className?: string; className?: string;
groupName?: string; groupName?: string;
...@@ -41,7 +41,7 @@ export class StackdriverPicker extends React.Component<Props, State> { ...@@ -41,7 +41,7 @@ export class StackdriverPicker extends React.Component<Props, State> {
shouldComponentUpdate(nextProps: Props) { shouldComponentUpdate(nextProps: Props) {
const nextOptions = this.buildOptions(nextProps); const nextOptions = this.buildOptions(nextProps);
return nextProps.selected !== this.props.selected || !_.isEqual(nextOptions, this.state.options); return nextProps.value !== this.props.value || !_.isEqual(nextOptions, this.state.options);
} }
buildOptions({ templateVariables = [], groupName = '', options }) { buildOptions({ templateVariables = [], groupName = '', options }) {
...@@ -70,7 +70,7 @@ export class StackdriverPicker extends React.Component<Props, State> { ...@@ -70,7 +70,7 @@ export class StackdriverPicker extends React.Component<Props, State> {
getSelectedOption() { getSelectedOption() {
const { options } = this.state; const { options } = this.state;
const allOptions = options.every(o => o.options) ? _.flatten(options.map(o => o.options)) : options; const allOptions = options.every(o => o.options) ? _.flatten(options.map(o => o.options)) : options;
return allOptions.find(option => option.value === this.props.selected); return allOptions.find(option => option.value === this.props.value);
} }
render() { render() {
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<label class="gf-form-label query-keyword width-9">Aggregation</label> <label class="gf-form-label query-keyword width-9">Aggregation</label>
<stackdriver-picker <stackdriver-picker
onChange="ctrl.handleAggregationChange" onChange="ctrl.handleAggregationChange"
selected="ctrl.target.aggregation.crossSeriesReducer" value="ctrl.target.aggregation.crossSeriesReducer"
options="ctrl.aggOptions" options="ctrl.aggOptions"
is-searchable="true" is-searchable="true"
placeholder="'Select Aggregation'" placeholder="'Select Aggregation'"
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
<label class="gf-form-label query-keyword width-15">Aligner</label> <label class="gf-form-label query-keyword width-15">Aligner</label>
<stackdriver-picker <stackdriver-picker
onChange="ctrl.handleAlignmentChange" onChange="ctrl.handleAlignmentChange"
selected="ctrl.target.aggregation.perSeriesAligner" value="ctrl.target.aggregation.perSeriesAligner"
options="ctrl.alignOptions" options="ctrl.alignOptions"
is-searchable="true" is-searchable="true"
placeholder="'Select Alignment'" placeholder="'Select Alignment'"
...@@ -43,7 +43,7 @@ ...@@ -43,7 +43,7 @@
<label class="gf-form-label query-keyword width-9">Alignment Period</label> <label class="gf-form-label query-keyword width-9">Alignment Period</label>
<stackdriver-picker <stackdriver-picker
onChange="ctrl.handleAlignmentPeriodChange" onChange="ctrl.handleAlignmentPeriodChange"
selected="ctrl.target.aggregation.alignmentPeriod" value="ctrl.target.aggregation.alignmentPeriod"
options="ctrl.alignmentPeriods" options="ctrl.alignmentPeriods"
is-searchable="true" is-searchable="true"
placeholder="'Select Alignment'" placeholder="'Select Alignment'"
......
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<span class="gf-form-label width-9 query-keyword">Service</span> <span class="gf-form-label width-9 query-keyword">Service</span>
<stackdriver-picker <stackdriver-picker
onChange="ctrl.handleServiceChange" onChange="ctrl.handleServiceChange"
selected="ctrl.target.service" value="ctrl.target.service"
options="ctrl.services" options="ctrl.services"
is-searchable="false" is-searchable="false"
placeholder="'Select Services'" placeholder="'Select Services'"
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
<span class="gf-form-label width-9 query-keyword">Metric</span> <span class="gf-form-label width-9 query-keyword">Metric</span>
<stackdriver-picker <stackdriver-picker
onChange="ctrl.handleMetricTypeChange" onChange="ctrl.handleMetricTypeChange"
selected="ctrl.target.metricType" value="ctrl.target.metricType"
options="ctrl.getMetricsList()" options="ctrl.getMetricsList()"
template-variables="ctrl.templateSrv.variables" template-variables="ctrl.templateSrv.variables"
group-name="'Metric Types'" group-name="'Metric Types'"
......
...@@ -66,7 +66,7 @@ export class StackdriverQueryCtrl extends QueryCtrl { ...@@ -66,7 +66,7 @@ export class StackdriverQueryCtrl extends QueryCtrl {
react2AngularDirective('stackdriverPicker', StackdriverPicker, [ react2AngularDirective('stackdriverPicker', StackdriverPicker, [
'options', 'options',
'onChange', 'onChange',
'selected', 'value',
'isSearchable', 'isSearchable',
'className', 'className',
'placeholder', 'placeholder',
......
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