Skip to content
This repository has been archived by the owner on Aug 21, 2023. It is now read-only.

Create projects from locations #342

Merged
merged 7 commits into from
Mar 5, 2019

Conversation

maurizi
Copy link
Contributor

@maurizi maurizi commented Mar 1, 2019

Overview

We've imported a large amount of data into the Climate Change API, but the new data does not have City objects associated with it.

To accommodate that. rather than using the city endpoint for the autocomplete in the new project form and the lab header, we now use a Google geocoder, and make a separate AJAX call to the API to determine if that lat/lon has data.

This will allow us to support a broader number of locations than we do currrently.

Demo

Powered by Google:
screenshot from 2019-02-28 18-54-48
screenshot from 2019-02-28 18-53-42

No climate data message:
screenshot from 2019-02-28 18-55-01
screenshot from 2019-02-28 18-54-20

Notes

Optional. Ancillary topics, caveats, alternative strategies that didn't work out, anything else.

Testing Instructions

  • Bring up your local climate-change-api with the changes in Don't require city id in project json schema climate-change-api#875
  • Replace your src/app/constants.ts file with the one saved in LastPass as "Climate lab dev config"
  • yarn install
  • yarn run serve
  • You should be able to create new projects for locations that have been ingested in your local API instance
  • You should see an error and not be able to create projects for locations that are not in your local API instance
  • Similarly on the lab charts page, changing the location in the controls header should update the chart data or display an error

Checklist

  • yarn run serve clean?
  • yarn run build:prod clean?
  • yarn run lint clean?

Closes #333
Closes #266
Closes #251

@maurizi maurizi requested a review from ddohler March 1, 2019 00:14
@maurizi maurizi changed the title Feature/mvm/create projects from locations Create projects from locations Mar 1, 2019
maurizi added 3 commits March 1, 2019 15:45
Rather than using the city endpoint for the autocomplete in the new project
form and the lab header, we now use a Google geocoder, and make a separate AJAX
call to the API to determine if that lat/lon has data.

This will allow us to support a broader number of locations than we do
currently.

Closes #333
Closes #266
Closes #251
@maurizi maurizi force-pushed the feature/mvm/create-projects-from-locations branch from 3b725ea to 2b384fb Compare March 1, 2019 20:45
// invalid options. Google Places sets 'autocomplete="off"' regardless of
// what was set on the <input> before, so we need to override that in JS
this.input.nativeElement.autocomplete = 'forced-false';
this.input.nativeElement.removeEventListener('focus', forceAutocompleteOff);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It looks like this work-around is no longer working... I'm going to open an issue to address this - this will also be an issue on Temperate, which this was copied from.

Copy link
Contributor

@ddohler ddohler left a comment

Choose a reason for hiding this comment

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

This basically works, but on the charts page, if I enter city for which we don't have data, but then ignore the warning message and click to a different chart section anyway, I get the loading "wave" icon forever until I type in a valid city, which I don't think should happen. The chart controls along the top continue to be clickable but they have no effect, which I also think should be addressed. I can think of a few potential ways to handle the case where someone has a location with no data but continues to click around, but I'm not sure which one is best -- happy to discuss.

src/app/services/map-cell.service.ts Outdated Show resolved Hide resolved
src/app/services/map-cell.service.ts Outdated Show resolved Hide resolved
@maurizi
Copy link
Contributor Author

maurizi commented Mar 4, 2019

This basically works, but on the charts page, if I enter city for which we don't have data, but then ignore the warning message and click to a different chart section anyway, I get the loading "wave" icon forever until I type in a valid city, which I don't think should happen. The chart controls along the top continue to be clickable but they have no effect, which I also think should be addressed.

I tackled the first half of this in eef265d by reverting to the last valid city when you change indicators. As we discussed, I'd like to push off any further changes for the controls to #243

Copy link
Contributor

@ddohler ddohler left a comment

Choose a reason for hiding this comment

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

Looks good!

@maurizi maurizi merged commit 2fa22e9 into develop Mar 5, 2019
@maurizi maurizi deleted the feature/mvm/create-projects-from-locations branch March 5, 2019 13:43
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants