Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR for #29 Geocoder widget #95

Merged
merged 13 commits into from Mar 10, 2020
Merged

PR for #29 Geocoder widget #95

merged 13 commits into from Mar 10, 2020

Conversation

justb4
Copy link
Collaborator

@justb4 justb4 commented Aug 15, 2019

A first rough version, bit in the dark on Unit testing, seems many existing tests fail because of config missing?

Implementation was still a bit more involved than foreseen, mainly because of some Vuetify v-combobox (dropdown state) quirks and dealing with the different Geocoder Providers behaviour.

Three Geocoders supported: 'osm' (OSM Nominatim), 'photon' (Photon) and 'opencage' (OpenCage, needs API key). We can extend with other later such as MapQuest and Bing.

Multiple commits, but may be squashed.

Copy link
Collaborator

@chrismayer chrismayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool @justb4. I like this a lot, especially the architecture with the different providers 👍 I added a few little remarks as inline comments. At least the test suite should be running (see my hint how to inject an app-config to the test spec.) before merging this.

What's also nice to have would be a clearing button to remove the search text. This could be done by clearable option of the Vuetify combobox. But this raises some layout issues. So I pledge that we postpone this.
The ability to add a result point or a result bbox to the map is already discussed in #29 and we also do this later on.

I'll open issues for these 2 points oncve this is merged.

Thanks again! Great work!

src/components/geocoder/GeocoderController.js Show resolved Hide resolved
src/components/geocoder/Geocoder.vue Show resolved Hide resolved
describe('props', () => {
let comp;
beforeEach(() => {
comp = shallowMount(Geocoder);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please look at test/unit/specs/components/ol/Map.spec.js or test/unit/specs/components/measuretool/MeasureWin.spec.js how to inject an app-config for the tests.

Copy link
Collaborator Author

@justb4 justb4 Mar 7, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Took some time (and sweat) but added more unit tests, in particular invoking the search input and combobox and verifying results even on map. Still could not get fake XHR and Timers working with Sinon, so faked with a setTimeout() in the test. So a real "Nominatim" search is performed for a well-known place/address in Bonn...

Also merged with latest version upgrades from #104 like OL6, Vue, Vuetify, and still works.

Made a slight implementation change: replacing callback from the GeocoderControllerto the Geocoder with a real async/await approach. Made testing also easier.

So unless more tests are required this is done, possibly additional issues for enhancements.

Copy link
Collaborator

@chrismayer chrismayer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot. This component is great enhancement for Wegue 👍 . I just has a look at the code and tested the Geocoder in several apps. Works really well 🎉 🎆 . This is good to go IMHO.

I'll create some follow-up issues / task regrading the geocoder UI as discussed here (e.g. clear button, etc.).

Comment on lines +86 to +94
// // Do the query via Ajax XHR, returning JSON. Async callback via Promise.
// json(ajax)
// .then(response => {
// // Call back parent with data formatted by Provider
// this.parent.onQueryResult(this.provider.handleResponse(response));
// })
// .catch(err => {
// this.parent.onQueryResult(undefined, err);
// });
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this be removed?

@chrismayer
Copy link
Collaborator

I'll merge now. Thanks again @justb4!

@chrismayer chrismayer merged commit 64c9955 into wegue-oss:master Mar 10, 2020
justb4 pushed a commit to Geolicious/wegue that referenced this pull request May 28, 2020
justb4 added a commit to Geolicious/wegue that referenced this pull request May 28, 2020
justb4 added a commit to Geolicious/wegue that referenced this pull request May 28, 2020
…-panel

Fixes wegue-oss#91 add header with close button to all Side Drawer Panels, merged in wegue-oss#95 from master (bigger icons LayerList). Looks good.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants