feat(add-data): Add modal to import data via file upload#189
Conversation
beffea5 to
04316e3
Compare
| layerOptions: [ | ||
| { | ||
| translation: t("filters.categories.actions.forestInventary"), | ||
| value: LAYERS.INVENTARY, | ||
| }, | ||
| { | ||
| translation: t("filters.categories.actions.socioEco"), | ||
| value: LAYERS.ENQUETE, | ||
| }, | ||
| ], | ||
| logoSrc: "/logo_all4trees.png", |
There was a problem hiding this comment.
NB: this is a tenant config that drilled to the Add data dialog in the header.. I have plan to move away from props drilling and provide a new react context for these tenant configurations that are used in agnostic pages
cf #196
04316e3 to
54560ef
Compare
cf98511 to
9976ad4
Compare
54560ef to
db3ec55
Compare
| hasDashboard: true, | ||
| layerOptions: [ | ||
| { | ||
| translation: t("filters.categories.actions.forestInventary"), |
There was a problem hiding this comment.
To be updated to forestInventOry with an 'o', also the layer name will have to be updated after #182 merge
| { | ||
| translation: t("filters.categories.actions.socioEco"), | ||
| value: LAYERS.ENQUETE, | ||
| }, |
There was a problem hiding this comment.
New layer inventory_bio will need to be added after #182 merge
| // Accepted upload extensions per kind (coordo's file / kobotoolbox loaders). | ||
| // Form data is the multi-sheet KoboToolbox answers workbook (.xlsx). | ||
| export const ACCEPTED_EXTENSIONS_BY_KIND = { | ||
| [RESOURCE_KINDS.ExternalData]: ".csv,.xls,.xlsx", |
There was a problem hiding this comment.
| // Form data is the multi-sheet KoboToolbox answers workbook (.xlsx). | ||
| export const ACCEPTED_EXTENSIONS_BY_KIND = { | ||
| [RESOURCE_KINDS.ExternalData]: ".csv,.xls,.xlsx", | ||
| [RESOURCE_KINDS.FormData]: ".xlsx", |
There was a problem hiding this comment.
Same here, csv are supported too : https://github.com/dataforgoodfr/Coordonnees/blob/c6a65de3db142e9b1a7505224cce794c4d1ef7a2/coordo-py/coordo/loaders/kobotoolbox_loader.py#L216
| [RESOURCE_KINDS.FormData]: ".xlsx", | |
| [RESOURCE_KINDS.FormData]: [".csv", ".xlsx"], |
| "field": { | ||
| "file": "File to upload", | ||
| "form": "Layer / Form to update", | ||
| "formPlaceholder": "Select a layer", |
There was a problem hiding this comment.
| "formPlaceholder": "Select a layer", | |
| "formPlaceholder": "Select a data source", |
| "pending": "Envoi en cours...", | ||
| "submit": "Ajouter les données" | ||
| }, | ||
| "description": "Importez un fichier pour ajouter des données à une couche de la carte.", |
There was a problem hiding this comment.
| "description": "Importez un fichier pour ajouter des données à une couche de la carte.", | |
| "description": "Importez un fichier pour ajouter des données à la carte.", |
| "error": { | ||
| "generic": "Upload failed. Please try again.", | ||
| "missingFile": "Please choose a file to upload.", | ||
| "missingForm": "Please select a layer to update." |
There was a problem hiding this comment.
| "missingForm": "Please select a layer to update." | |
| "missingForm": "Please select a data source to update." |
| }, | ||
| "field": { | ||
| "file": "File to upload", | ||
| "form": "Layer / Form to update", |
There was a problem hiding this comment.
| "form": "Layer / Form to update", | |
| "form": "Data source to update", |
| "pending": "Uploading...", | ||
| "submit": "Add data" | ||
| }, | ||
| "description": "Upload a file to add data to a map layer.", |
There was a problem hiding this comment.
| "description": "Upload a file to add data to a map layer.", | |
| "description": "Upload a file to add data to the map.", |
| }, | ||
| "field": { | ||
| "file": "Fichier à importer", | ||
| "form": "Couche / Formulaire à mettre à jour", |
There was a problem hiding this comment.
| "form": "Couche / Formulaire à mettre à jour", | |
| "form": "Source de données à mettre à jour", |
Highlights
Demos
UI only
demo-upload-file-data-ui.mp4
Full flow
Waiting for backend