ERA-13735 Replace patrol track download with GeoJSON/CSV patrol exports#1656
Open
jeslefcourt wants to merge 3 commits into
Open
ERA-13735 Replace patrol track download with GeoJSON/CSV patrol exports#1656jeslefcourt wants to merge 3 commits into
jeslefcourt wants to merge 3 commits into
Conversation
Replace the "Download Patrol Track" kebab-menu option with two options, "Export Patrol GeoJson" and "Export Patrol CSV", both backed by the new patrol detail export API (PADAS/das#4076): - GeoJson: GET /activity/patrols/<id>?format=geojson&include_events=true&include_tracks=true - CSV: GET /activity/patrols/<id>?format=csv (patrol events export) The options no longer gate on the leader's track availability since the export also includes events; they are disabled only for unsaved patrols. Translation keys updated across all locales. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the Patrol list-item kebab menu to replace the legacy “Download Patrol Track” (subject tracks API) with two server-backed export actions that download patrol-scoped data via the patrol detail export API, and updates tests/localizations accordingly.
Changes:
- Replace “Download Patrol Track” with “Export Patrol GeoJson” and “Export Patrol CSV”, calling
${PATROLS_API_URL}${patrol.id}with format-specific query params. - Simplify enable/disable logic so exports are disabled only for unsaved patrols (no
id), and update Jest tests to cover both export options. - Replace old translation keys with new export-related keys across all existing
patrols.jsonlocale files.
Reviewed changes
Copilot reviewed 8 out of 8 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/PatrolMenu/index.js | Replaces track download logic with GeoJSON/CSV patrol exports and updates menu UI. |
| src/PatrolMenu/index.test.js | Updates unit tests to validate export actions (labels, disabled state, URL/params/filename). |
| public/locales/en-US/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
| public/locales/es/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
| public/locales/fr/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
| public/locales/ne-NP/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
| public/locales/pt/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
| public/locales/sw/patrols.json | Replaces patrol menu translation keys for the new export actions/tooltips. |
- Guard both export handlers against unsaved patrols and use static tooltip ids in the disabled branches (Copilot review) - Rethrow from downloadFileFromUrl's internal catch so callers get the real axios error, and show a translated error toast when an export fails instead of failing silently - Make the disabled-option tooltip reachable by keyboard (tabIndex) - Fix Swahili labels to use "hamisha" (export) instead of "nakili" (copy), which collided with the adjacent copy-link option - Test coverage for the disabled guards and the error toast Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
🚀 PR Environment Deployed
Access: https://era-13735.dev.pamdas.org |
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 9 out of 9 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
src/utils/download.js:18
- Axios normalizes response header keys to lowercase (e.g.
response.headers['content-type']). Usingheaders['Content-Type']here will typically beundefined, so the downloaded Blob may lose its MIME type (notably for CSV vs GeoJSON exports). Use the lowercase header key (optionally with a fallback) when setting the Blob type.
throw error;
});
const link = document.createElement('a');
const objectUrl = window.URL.createObjectURL(new Blob([data], { type: headers['Content-Type'] }));
Invalidates the cached translation bundles so the new patrolMenu keys render instead of falling back to raw key names. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the patrol kebab-menu option "Download Patrol Track" with two export options backed by the new patrol detail export API:
GET /activity/patrols/<id>?format=geojson&include_events=true&include_tracks=true, downloaded asPatrol_<serial>.geojsonGET /activity/patrols/<id>?format=csv(patrol events export), downloaded asPatrol_<serial>.csvDetails
downloadTrackButton/noTrackDataTooltipreplaced withexportPatrolGeoJsonButton,exportPatrolCsvButton, andnoDataToExportTooltipacross all locales.Depends on
Backend API: https://github.com/PADAS/das/pull/4076
Jira
ERA-13735
🤖 Generated with Claude Code