-
Notifications
You must be signed in to change notification settings - Fork 3
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
feat(map): download collection metrics [EP-3002] #328
Conversation
* wip * feat(map): download collection metrics [EP-3002]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great work! 👍
just some nitpicking
<h2 className="ng-text-display-s ng-body-color ng-margin-medium-bottom ng-margin-top-remove"> | ||
{t('Download metrics')} | ||
| ||
<i className="ng-icon-download-outline" style={{ verticalAlign: 'middle' }} /> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<i className="ng-icon-download-outline" style={{ verticalAlign: 'middle' }} /> | |
<i className="ng-icon-download-outline ng-vertical-align-middle" /> |
onCancel={() => setIsOnDownloadMetrics(false)} | ||
onDownloadStart={() => [setIsDownloadingMetrics(true), setIsOnDownloadMetrics(false)]} | ||
onDownloadEnd={() => setIsDownloadingMetrics(false)} | ||
onDownloadError={(err) => setDownloadError(err)} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
onDownloadError={(err) => setDownloadError(err)} | |
onDownloadError={setDownloadError} |
|
||
import { TitleHero, Card } from '@marapp/earth-shared'; | ||
import MetricService from 'services/MetricService'; | ||
import { ReactSelect, serializeFilters } from '@marapp/earth-shared'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
combine earth-shared imports
normalizedData.map((item) => ({ | ||
'#': item['#'], | ||
...flatten(omit(item, '#')), | ||
})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you can find a valid constant name to replace '#' eg: nr
the code would become:
normalizedData.map((item) => ({ | |
'#': item['#'], | |
...flatten(omit(item, '#')), | |
})) | |
normalizedData.map(({nr, ...item}) => ({ | |
nr, | |
...flatten(item), | |
})) |
const zipName = `${collectionSlug}-metrics.zip`; | ||
const zipContent = await zip.generateAsync({ type: 'blob' }); | ||
|
||
FileSaver.saveAs(zipContent, zipName); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should clear the previous error message somehow.
One suggestion could be to add onDownloadSuccess()
prop and call it here
const { data, meta } = await fetchMetricById(collectionId, { ...query, 'page[number]': page }); | ||
|
||
return meta.pagination.page < meta.pagination.total | ||
? data.concat(await downloadMetrics(collectionId, query, page + 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool ⚡
# [1.16.0](v1.15.0...v1.16.0) (2020-12-17) ### Bug Fixes * **admin:** Fix scrolling while in edit mode [EP-3146] ([1f3be9d](1f3be9d)) * **admin:** fix sidenav search box styling ([#346](#346)) ([1afcb1a](1afcb1a)) * **admin:** handle SSR request for window usage ([1d67f43](1d67f43)) * **admin:** hide collections from places ([#351](#351)) ([613994b](613994b)) * **admin:** loading indicator on user role [EP-3424] ([c9d5dec](c9d5dec)) * **admin:** place edit reset geojson on cancel [EP-3025] ([047af4b](047af4b)) * **auth:** Error message is not displayed when a invalid link from the email is clicked [EP-3443] ([#338](#338)) ([1ed7fe5](1ed7fe5)) * **map:** collection long name overlap [EP-3595] ([a4c906b](a4c906b)) * **map:** preserve language on refresh or app change ([#345](#345)) ([32294bb](32294bb)) * **map:** support for decodeFunction on layers ([b6b98ed](b6b98ed)) * **profile:** split profile fetching and display a visual loading ind… ([#340](#340)) ([9b1d1fa](9b1d1fa)) ### Features * **map:** Clip and export layers [EP-3594] ([7a118c8](7a118c8)) * **map:** download collection metrics [EP-3002] ([#328](#328)) ([7815e82](7815e82)) * **map:** download collection metrics [EP-3002] ([#333](#333)) ([cbc780c](cbc780c)) * **map:** keep map coordinates in url ([#331](#331)) ([2c8cec8](2c8cec8)) * **map:** weglot support [EP-3441] ([#341](#341)) ([5905af3](5905af3)) ### Reverts * Revert "feat(map): download collection metrics [EP-3002] (#328)" (#332) ([a6da184](a6da184)), closes [#328](#328) [#332](#332)
No description provided.