Skip to content

Commit 72ba193

Browse files
committed
Merge branch 'dev'
2 parents 1f011b3 + 7750f9e commit 72ba193

35 files changed

+423
-311
lines changed

app/sensors/GeoDistanceDropdown.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export default class GeoDistanceDropdown extends Component {
4747

4848
// Set query information
4949
componentWillMount() {
50+
this.previousQuery = null; // initial value for onQueryChange
5051
this.googleMaps = window.google.maps;
5152
this.unit = this.props.unit;
5253
this.getUserLocation();
@@ -163,12 +164,20 @@ export default class GeoDistanceDropdown extends Component {
163164

164165
// set the query type and input data
165166
setQueryInfo() {
167+
const getQuery = (value) => {
168+
const currentQuery = this.props.customQuery ? this.props.customQuery(value) : this.customQuery(value);
169+
if (this.props.onQueryChange && JSON.stringify(this.previousQuery) !== JSON.stringify(currentQuery)) {
170+
this.props.onQueryChange(this.previousQuery, currentQuery);
171+
}
172+
this.previousQuery = currentQuery;
173+
return currentQuery;
174+
};
166175
const obj = {
167176
key: this.props.componentId,
168177
value: {
169178
queryType: this.type,
170179
dataField: this.props.dataField,
171-
customQuery: this.props.customQuery ? this.props.customQuery : this.customQuery,
180+
customQuery: getQuery,
172181
reactiveId: this.context.reactiveId,
173182
showFilter: this.props.showFilter,
174183
filterLabel: this.props.filterLabel ? this.props.filterLabel : this.props.componentId,
@@ -479,7 +488,8 @@ GeoDistanceDropdown.propTypes = {
479488
URLParams: React.PropTypes.bool,
480489
showFilter: React.PropTypes.bool,
481490
filterLabel: React.PropTypes.string,
482-
className: React.PropTypes.string
491+
className: React.PropTypes.string,
492+
onQueryChange: React.PropTypes.func
483493
};
484494

485495
// Default props value
@@ -518,5 +528,6 @@ GeoDistanceDropdown.types = {
518528
URLParams: TYPES.BOOLEAN,
519529
showFilter: TYPES.BOOLEAN,
520530
filterLabel: TYPES.STRING,
521-
className: TYPES.STRING
531+
className: TYPES.STRING,
532+
onQueryChange: TYPES.FUNCTION
522533
};

app/sensors/GeoDistanceSlider.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ export default class GeoDistanceSlider extends Component {
5252

5353
// Set query information
5454
componentWillMount() {
55+
this.previousQuery = null; // initial value for onQueryChange
5556
this.googleMaps = window.google.maps;
5657
this.getUserLocation();
5758
this.setQueryInfo();
@@ -148,12 +149,20 @@ export default class GeoDistanceSlider extends Component {
148149

149150
// set the query type and input data
150151
setQueryInfo() {
152+
const getQuery = (value) => {
153+
const currentQuery = this.props.customQuery ? this.props.customQuery(value) : this.customQuery(value);
154+
if (this.props.onQueryChange && JSON.stringify(this.previousQuery) !== JSON.stringify(currentQuery)) {
155+
this.props.onQueryChange(this.previousQuery, currentQuery);
156+
}
157+
this.previousQuery = currentQuery;
158+
return currentQuery;
159+
};
151160
const obj = {
152161
key: this.props.componentId,
153162
value: {
154163
queryType: this.type,
155164
dataField: this.props.dataField,
156-
customQuery: this.props.customQuery ? this.props.customQuery : this.customQuery,
165+
customQuery: getQuery,
157166
reactiveId: this.context.reactiveId,
158167
showFilter: this.props.showFilter,
159168
filterLabel: this.props.filterLabel ? this.props.filterLabel : this.props.componentId,
@@ -476,7 +485,8 @@ GeoDistanceSlider.propTypes = {
476485
URLParams: React.PropTypes.bool,
477486
showFilter: React.PropTypes.bool,
478487
filterLabel: React.PropTypes.string,
479-
className: React.PropTypes.string
488+
className: React.PropTypes.string,
489+
onQueryChange: React.PropTypes.func
480490
};
481491

482492
// Default props value
@@ -524,5 +534,6 @@ GeoDistanceSlider.types = {
524534
URLParams: TYPES.BOOLEAN,
525535
showFilter: TYPES.BOOLEAN,
526536
filterLabel: TYPES.STRING,
527-
className: TYPES.STRING
537+
className: TYPES.STRING,
538+
onQueryChange: TYPES.FUNCTION
528539
};

app/sensors/PlacesSearch.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ export default class PlacesSearch extends Component {
3737
}
3838

3939
componentWillMount() {
40+
this.previousQuery = null; // initial value for onQueryChange
4041
this.googleMaps = window.google.maps;
4142
this.setQueryInfo();
4243
this.getUserLocation(this.setDefaultLocation);
@@ -122,12 +123,20 @@ export default class PlacesSearch extends Component {
122123

123124
// set the query type and input data
124125
setQueryInfo() {
126+
const getQuery = (value) => {
127+
const currentQuery = this.props.customQuery ? this.props.customQuery(value) : this.customQuery(value);
128+
if (this.props.onQueryChange && JSON.stringify(this.previousQuery) !== JSON.stringify(currentQuery)) {
129+
this.props.onQueryChange(this.previousQuery, currentQuery);
130+
}
131+
this.previousQuery = currentQuery;
132+
return currentQuery;
133+
};
125134
const obj = {
126135
key: this.props.componentId,
127136
value: {
128137
queryType: this.type,
129138
inputData: this.props.dataField,
130-
customQuery: this.props.customQuery ? this.props.customQuery : this.customQuery,
139+
customQuery: getQuery,
131140
reactiveId: this.context.reactiveId,
132141
showFilter: this.props.showFilter,
133142
filterLabel: this.props.filterLabel ? this.props.filterLabel : this.props.componentId,
@@ -361,7 +370,8 @@ PlacesSearch.propTypes = {
361370
showFilter: React.PropTypes.bool,
362371
filterLabel: React.PropTypes.string,
363372
unit: React.PropTypes.oneOf(["mi", "miles", "yd", "yards", "ft", "feet", "in", "inch", "km", "kilometers", "m", "meters", "cm", "centimeters", "mm", "millimeters", "NM", "nmi", "nauticalmiles"]),
364-
className: React.PropTypes.string
373+
className: React.PropTypes.string,
374+
onQueryChange: React.PropTypes.func
365375
};
366376
// Default props value
367377
PlacesSearch.defaultProps = {
@@ -392,5 +402,6 @@ PlacesSearch.types = {
392402
URLParams: TYPES.BOOLEAN,
393403
showFilter: TYPES.BOOLEAN,
394404
filterLabel: TYPES.STRING,
395-
className: TYPES.STRING
405+
className: TYPES.STRING,
406+
onQueryChange: TYPES.FUNCTION
396407
};

dist/CustomQuery.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/GeoDistanceDropdown.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/GeoDistanceSlider.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/PlacesSearch.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/css/style.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/direction.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/earthquake.bundle.js

Lines changed: 11 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)