Skip to content
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

IA-3783 bulk push of gps from submissions to org unit [frontend] #1891

Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
57b30fc
API call check push gps - WIP
tdethier Dec 13, 2024
7fa6975
Added tests with wrong account and wrong IDs
tdethier Dec 13, 2024
84d43de
Added missing tests
tdethier Dec 13, 2024
162d612
WIF: bulk push GPS from submissions to OrgUnits
hakifran Dec 16, 2024
1bd1e8b
WIP: bulk push gps-front
hakifran Dec 16, 2024
5774253
Merge branch 'main' into IA-3783-Bulk-push-of-gps-from-submissions-to…
hakifran Dec 17, 2024
e9d23c7
Merge branch 'IA-3782_push-bulk-gps-from-instances-backend' into IA-3…
hakifran Dec 17, 2024
ede85f0
get warnings and status from backend
hakifran Dec 17, 2024
ce8014a
WIP
hakifran Dec 17, 2024
acd345e
refactor the code
hakifran Dec 19, 2024
df0089f
Merge branch 'main' into IA-3783-Bulk-push-of-gps-from-submissions-to…
hakifran Dec 20, 2024
c998119
Move warning code into different file
hakifran Dec 20, 2024
0dc4677
Added task instance_bulk_gps_push
tdethier Dec 20, 2024
5a7541d
Merge branch 'IA-3782_push-bulk-gps-from-instances-backend' into IA-3…
hakifran Dec 20, 2024
0c64cbd
launch task
hakifran Dec 20, 2024
2d0e1a7
remove see all link
hakifran Dec 20, 2024
dac8b65
WIP: refactor
hakifran Dec 21, 2024
2849398
WIP: refactor the code
hakifran Dec 21, 2024
f1c0a5a
Disable launch and launch and show task when warning are not all appr…
hakifran Dec 26, 2024
592164c
add warning for warning approval
hakifran Dec 26, 2024
97ad3a0
fix approve warning code
hakifran Dec 26, 2024
c5b85e0
refactor code
hakifran Dec 27, 2024
b13ae85
add snackBar message on launch task
hakifran Jan 2, 2025
2434d82
Merge branch 'main' into IA-3783-Bulk-push-of-gps-from-submissions-to…
hakifran Jan 2, 2025
e4efcee
API call check push gps - WIP
tdethier Dec 13, 2024
24e7458
Added tests with wrong account and wrong IDs
tdethier Dec 13, 2024
5ee64de
Added missing tests
tdethier Dec 13, 2024
b1ccb78
Added task instance_bulk_gps_push
tdethier Dec 20, 2024
5de317c
Added OrgUnit IDs in API response
tdethier Jan 2, 2025
5284160
Merge branch 'IA-3782_push-bulk-gps-from-instances-backend' into IA-3…
tdethier Jan 3, 2025
675ce3a
initialize approval
hakifran Jan 6, 2025
befbc1e
add ignoreErrorCodes on useSnackQuery hook
hakifran Jan 6, 2025
0f2594d
move code and use ConfirmCancelModal
hakifran Jan 7, 2025
d0bf02d
remove the initializeApproval method
hakifran Jan 7, 2025
c39a657
display the correct titleMessage
hakifran Jan 7, 2025
515fc27
fix conflict in hat/assets/js/apps/Iaso/domains/app/translations/fr.json
hakifran Jan 7, 2025
ceb6a13
Merge branch 'main' into IA-3667_push-bulk-gps-from-instances
hakifran Jan 7, 2025
f3c839b
Merge branch 'IA-3667_push-bulk-gps-from-instances' into IA-3783-Bulk…
hakifran Jan 7, 2025
e19669a
API call check push gps - WIP
tdethier Dec 13, 2024
40d5068
Added tests with wrong account and wrong IDs
tdethier Dec 13, 2024
337ea3a
Added missing tests
tdethier Dec 13, 2024
13bc589
Added task instance_bulk_gps_push
tdethier Dec 20, 2024
a8fd361
Added OrgUnit IDs in API response
tdethier Jan 2, 2025
cf4d32f
WIF: bulk push GPS from submissions to OrgUnits
hakifran Dec 16, 2024
c41db96
WIP: bulk push gps-front
hakifran Dec 16, 2024
a8db030
API call check push gps - WIP
tdethier Dec 13, 2024
85f7c70
Added tests with wrong account and wrong IDs
tdethier Dec 13, 2024
3a4381b
Added missing tests
tdethier Dec 13, 2024
7fc32f9
get warnings and status from backend
hakifran Dec 17, 2024
bbb01cf
WIP
hakifran Dec 17, 2024
dcabf19
refactor the code
hakifran Dec 19, 2024
ba208e4
Move warning code into different file
hakifran Dec 20, 2024
c640e58
Added task instance_bulk_gps_push
tdethier Dec 20, 2024
2215a66
launch task
hakifran Dec 20, 2024
c8355aa
remove see all link
hakifran Dec 20, 2024
c678e40
WIP: refactor
hakifran Dec 21, 2024
ed2ea53
WIP: refactor the code
hakifran Dec 21, 2024
e5110c4
Disable launch and launch and show task when warning are not all appr…
hakifran Dec 26, 2024
b5ba402
add warning for warning approval
hakifran Dec 26, 2024
d1addf7
fix approve warning code
hakifran Dec 26, 2024
5bc174e
refactor code
hakifran Dec 27, 2024
7a8d268
add snackBar message on launch task
hakifran Jan 2, 2025
85d58c4
Added tests with wrong account and wrong IDs
tdethier Dec 13, 2024
b156e25
Added OrgUnit IDs in API response
tdethier Jan 2, 2025
9c5078c
initialize approval
hakifran Jan 6, 2025
681cf04
add ignoreErrorCodes on useSnackQuery hook
hakifran Jan 6, 2025
12f0f34
move code and use ConfirmCancelModal
hakifran Jan 7, 2025
a8835ca
remove the initializeApproval method
hakifran Jan 7, 2025
6286b33
display the correct titleMessage
hakifran Jan 7, 2025
fb170d5
Merge branch 'IA-3782_push-bulk-gps-from-instances-backend' into IA-3…
tdethier Jan 7, 2025
08ca56c
change warning info
hakifran Jan 8, 2025
f2de770
fix conflict
hakifran Jan 8, 2025
d334cad
apply requested changes
hakifran Jan 9, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion hat/assets/js/apps/Iaso/domains/app/translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@
"iaso.datasources.emptyProjectsError": "Please choose at least one project",
"iaso.datasources.exportDataSource": "Export data source: {dataSourceName}",
"iaso.datasources.geoPkg": "Import GeoPackage",
"iaso.dataSources.goToCurrentTask": "Launch and show task",
hakifran marked this conversation as resolved.
Show resolved Hide resolved
"iaso.datasources.gpkg.chooseFile": "Choose file",
"iaso.datasources.gpkg.explication": "Import OrgUnits from a GeoPackage file, all the OrgUnits present in the file will be updated.{breakingLine}The file must be correctly formatted.{breakingLine}",
"iaso.datasources.gpkg.importTaskExplication": "The import will be processed in the background and can take a dozen minutes to complete.",
Expand Down Expand Up @@ -329,6 +328,7 @@
"iaso.groupsets.groupBelonging": "Groups belonging",
"iaso.groupsets.validation.field_required": "Ce champ est obligatoire",
"iaso.hospital": "Hospital",
"iaso.instance.approveAllWarningsMessage": "All warnings must be approved before launching the locations push.",
"iaso.instance.coordinate": "Coordinates",
"iaso.instance.created_at": "Created in Iaso",
"iaso.instance.delete": "Delete instance(s)",
Expand Down Expand Up @@ -385,16 +385,20 @@
"iaso.instance.logs.versionB": "Version B",
"iaso.instance.missingFile": "Cannot find an instance with a file",
"iaso.instance.missingGeolocation": "Cannot find an instance with geolocation",
"iaso.instance.multipleInstancesOneOrgUnitWarningMessage": "Multiple submissions are using the same org unit",
"iaso.instance.noGpsForSomeInstaces": "Some instances don't have locations. Nothing will be applied for those OrgUnits.",
"iaso.instance.NoLocksHistory": "There's no history",
"iaso.instance.org_unit": "Org unit",
"iaso.instance.org_unit_type_name": "Org unit type",
"iaso.instance.patchInstanceError": "An error occurred while saving submission",
"iaso.instance.patchInstanceSuccesfull": "Submission saved successfully",
"iaso.instance.period": "Period",
"iaso.instance.pushGpsWarningMessage": "You are about to push the locations of {submissionCount} instances to {orgUnitCount} OrgUnits",
"iaso.instance.queryBuilder": "Search in submitted fields",
"iaso.instance.removeLockAction": "Unlock the submission",
"iaso.instance.selectedOrgUnit": "Selected Org unit",
"iaso.instance.selectVersionToCompare": "Please select the version to compare",
"iaso.instance.someOrgUnitsHasAlreadyGps": "Some OrgUnits already have GPS coordinates. Do you want to proceed and overwrite them?",
"iaso.instance.source_created_at": "Created on device",
"iaso.instance.table.label.instanceHeaderTooltip": "Label: {label} - Name: {key}",
"iaso.instance.title": "Submissions",
Expand Down Expand Up @@ -432,6 +436,7 @@
"iaso.label.altitude": "Altitude",
"iaso.label.anyGeography": "With point or territory",
"iaso.label.apply": "Apply",
"iaso.label.approve": "Approve",
"iaso.label.approved": "Approved",
"iaso.label.assignments": "Assignments",
"iaso.label.before": "Before",
Expand Down Expand Up @@ -537,6 +542,7 @@
"iaso.label.fromOrgunit": "(from Org Unit)",
"iaso.label.geo_json": "Geo json shape",
"iaso.label.geographicalData": "Geographical data",
"iaso.label.goToCurrentTask": "Launch and show task",
"iaso.label.group": "Group",
"iaso.label.groups": "Groups",
"iaso.label.groupSet": "Group Set",
Expand Down Expand Up @@ -661,6 +667,7 @@
"iaso.label.projects": "Projects",
"iaso.label.published": "Published",
"iaso.label.publishingStatus": "Publishing status",
"iaso.label.pushGpsToOrgUnits": "Push GPS from submissions to Org units",
"iaso.label.quarter": "Quarter",
"iaso.label.rawHtml": "Raw html",
"iaso.label.reAssignInstance": "Re-assign instance",
Expand All @@ -676,6 +683,7 @@
"iaso.label.save": "Save",
"iaso.label.search": "Search",
"iaso.label.see": "See",
"iaso.label.seeAll": "See all",
"iaso.label.seeAllVersions": "See all versions",
"iaso.label.seeChildren": "See children",
"iaso.label.seeDetails": "See details",
Expand Down Expand Up @@ -1290,6 +1298,8 @@
"iaso.snackBar.paymentLotTaskLaunched": "The creation of the payment lot may take a few moments. Try refreshing the Payment Lots page if it doesn't appear",
"iaso.snackBar.paymentsBulkUpdateLaunched": "The modifications to the payments will take a few moments to take effect",
"iaso.snackBar.permissionError": "You don't have permission to perform this action",
"iaso.snackBar.pushGpsTaskError": "An error occurred while pushing GPS from submissions to Org units",
"iaso.snackBar.pushGpsTaskPlanned": "Push GPS from submissions to Org units was planned with success",
"iaso.snackBar.reload": "Reload",
"iaso.snackBar.reloadPage": "A new version is available! Refresh the page.",
"iaso.snackBar.restoreInstanceError": "An error occured while restoring the instance",
Expand Down
11 changes: 11 additions & 0 deletions hat/assets/js/apps/Iaso/domains/app/translations/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,7 @@
"iaso.groupsets.groupBelonging": "Appartenance aux groupes",
"iaso.groupsets.validation.field_required": "Ce champ est obligatoire",
"iaso.hospital": "Hôpital",
"iaso.instance.approveAllWarningsMessage": "Tous les avertissements doivent être approuvés avant de lancer la génération des localisations.",
"iaso.instance.coordinate": "Coordonnées",
"iaso.instance.created_at": "Création dans Iaso",
"iaso.instance.delete": "Effacer une(des) soumission(s)",
Expand Down Expand Up @@ -385,16 +386,20 @@
"iaso.instance.logs.versionB": "Version B",
"iaso.instance.missingFile": "Aucun fichier trouvé",
"iaso.instance.missingGeolocation": "Aucune soumission trouvée avec une localisation",
"iaso.instance.multipleInstancesOneOrgUnitWarningMessage": "Plusieurs soumissions utilisent la même unité d'org.",
"iaso.instance.noGpsForSomeInstaces": "Certaines soumissions n'ont pas de GPS. Rien ne sera appliqué pour ces unités d'organisation.",
"iaso.instance.NoLocksHistory": "Il n'y a pas d'historique",
"iaso.instance.org_unit": "Unités d'organisation",
"iaso.instance.org_unit_type_name": "Type d'unité d'org.",
"iaso.instance.patchInstanceError": "Une erreur est survenue lors de la sauvegarde de la soumission",
"iaso.instance.patchInstanceSuccesfull": "Soumission sauvée avec succès",
"iaso.instance.period": "Période",
"iaso.instance.pushGpsWarningMessage": "Vous êtes sur le point de transférer les GPS des soumissions {submissionCount} vers {orgUnitCount} unités d'Org.",
"iaso.instance.queryBuilder": "Rechercher dans les champs soumis",
"iaso.instance.removeLockAction": "Déverrouiller la soumission",
"iaso.instance.selectedOrgUnit": "Unité d'org. sélectionnée",
"iaso.instance.selectVersionToCompare": "Veuillez sélectionner la version à comparer",
"iaso.instance.someOrgUnitsHasAlreadyGps": "Certaines unités d'Org. ont déjà des coordonnées GPS. Voulez-vous continuer et les écraser ?",
"iaso.instance.source_created_at": "Création sur appareil",
"iaso.instance.table.label.instanceHeaderTooltip": "Label: {label} - Nom: {key}",
"iaso.instance.title": "Soumissions",
Expand Down Expand Up @@ -432,6 +437,7 @@
"iaso.label.altitude": "Altitude",
"iaso.label.anyGeography": "Avec point ou territoire",
"iaso.label.apply": "Appliquer",
"iaso.label.approve": "Approuvez",
"iaso.label.approved": "Approuvé",
"iaso.label.assignments": "Assignations",
"iaso.label.before": "Avant",
Expand Down Expand Up @@ -537,6 +543,7 @@
"iaso.label.fromOrgunit": "(de l'unité d'organisation)",
"iaso.label.geo_json": "Forme geo json",
"iaso.label.geographicalData": "Données géographiques",
"iaso.label.goToCurrentTask": "Lancer et montrer la tâche",
"iaso.label.group": "Groupe",
"iaso.label.groups": "Groupes",
"iaso.label.groupSet": "Ensemble de Groupes",
Expand Down Expand Up @@ -661,6 +668,7 @@
"iaso.label.projects": "Projets",
"iaso.label.published": "Publié",
"iaso.label.publishingStatus": "Statut de publication",
"iaso.label.pushGpsToOrgUnits": "Transférer les GPS des soumissions vers les unités d'org.",
"iaso.label.quarter": "Trimestre",
"iaso.label.rawHtml": "Simple HTML",
"iaso.label.reAssignInstance": "Assigner la soumission",
Expand All @@ -676,6 +684,7 @@
"iaso.label.save": "Sauver",
"iaso.label.search": "Recherche",
"iaso.label.see": "Voir",
"iaso.label.seeAll": "Voir tout",
"iaso.label.seeAllVersions": "Voir toutes les versions",
"iaso.label.seeChildren": "Voir les enfants",
"iaso.label.seeDetails": "Voir les détails",
Expand Down Expand Up @@ -1290,6 +1299,8 @@
"iaso.snackBar.paymentLotTaskLaunched": "La création du lot de paiements peut prendre un instant. Essayez de rafraîchir la page Lots de Paiements s'il n'apparaît pas",
"iaso.snackBar.paymentsBulkUpdateLaunched": "Les modifications peuvent prendre un moment avant d'être visibles",
"iaso.snackBar.permissionError": "Vous n'avez pas la permission d'effectuer cette action",
"iaso.snackBar.pushGpsTaskError": "Une erreur s'est produite lors de l'envoi des GPS des soumissions aux unités d'org.",
"iaso.snackBar.pushGpsTaskPlanned": "Le transfert des GPS des soumissions aux unités d'org. a été planifié avec succès.",
"iaso.snackBar.reload": "Recharger",
"iaso.snackBar.reloadPage": "Une nouvelle version est disponible! Rafraichissez la page.",
"iaso.snackBar.restoreInstanceError": "Une erreur s'est produite lors de la récupération de l'instance",
Expand Down
3 changes: 1 addition & 2 deletions hat/assets/js/apps/Iaso/domains/dataSources/messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,8 @@ const MESSAGES = defineMessages({
id: 'iaso.dataSources.validateStatus',
defaultMessage: 'Validate status',
},

goToCurrentTask: {
id: 'iaso.dataSources.goToCurrentTask',
id: 'iaso.label.goToCurrentTask',
defaultMessage: 'Launch and show task',
},
launch: {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { Button, Grid, Typography } from '@mui/material';
import { useSafeIntl } from 'bluesquare-components';
import React, { FunctionComponent } from 'react';
import MESSAGES from '../../messages';

type Props = {
condition: boolean;
message: { defaultMessage: string; id: string };
approveCondition: boolean;
onApproveClick: () => void;
};

const PushBulkGpsWarning: FunctionComponent<Props> = ({
condition,
message,
approveCondition,
onApproveClick,
}) => {
const { formatMessage } = useSafeIntl();
if (!condition) return null;

return (
<Grid
item
xs={12}
container
spacing={2}
alignItems="center"
direction="row"
>
<Grid item xs={8}>
<Typography component="ul" sx={{ color: 'warning.main' }}>
<Typography component="li">
{formatMessage(message)}
</Typography>
</Typography>
</Grid>
<Grid item xs={1} display="flex" justifyContent="flex-start">
{/* <LinkWithLocation to={linkTo}>
{formatMessage(MESSAGES.seeAll)}
</LinkWithLocation> */}
</Grid>
<Grid item xs={3} display="flex" justifyContent="flex-end">
<Button
variant="outlined"
color={approveCondition ? 'primary' : 'warning'}
onClick={onApproveClick}
>
{formatMessage(
approveCondition ? MESSAGES.approved : MESSAGES.approve,
)}
</Button>
</Grid>
</Grid>
);
};

export default PushBulkGpsWarning;
Loading
Loading