MapCampaigner icon indicating copy to clipboard operation
MapCampaigner copied to clipboard

Update rendered HTML to JSON endpoints

Open russbiggs opened this issue 5 years ago • 4 comments

contents.html, map.html and errors.html are currently rendered and stored on s3 then fetched during templating. This has cause some issue while making improvements so let's seek to render these client side with JS where it makes sense with JSON data endpoints.

russbiggs avatar Oct 31 '19 16:10 russbiggs

marking this as discussion because some thoguht should go into what should be server rendered and what is better sent as JSON then client rendered

russbiggs avatar Oct 31 '19 16:10 russbiggs

OK, I had a look on S3 and I think I get it.

The frontend would have templates for content.html, map.html, errors.html which would get data passed in from the backend for a specific campaign the user is trying to view by

  1. either reaching the routes /campaigns/<campaing-uuid>/feature_completeness.json, /campaigns/<campaing-uuid>/geojson_x.json, /campaigns/<campaing-uuid>/errors_x.json, /campaigns/<campaing-uuid>/count_feature.json,
  2. or reaching one route like /campaigns/<campaing-uuid>/render_campaign.json. Where render_campaign.json would contain data from the S3 files feature_completeness.json, geojson_x.json, errors_x.json, count_feature.json.

It looks like any of those would mean modifying the lambda function [prod/staging]_render_feature on the backend at least.

Eleonore9 avatar Nov 05 '19 11:11 Eleonore9

OK, views.py also need modifying and the campaign_detail.html would import a JS script where the Ajax calls would be made.

Eleonore9 avatar Nov 05 '19 12:11 Eleonore9

@Eleonore9 Jorge has updated map.html for his work in creating gpx, its now a flask template in his feature branch

russbiggs avatar Nov 06 '19 03:11 russbiggs