-
Notifications
You must be signed in to change notification settings - Fork 0
UI/UX fixes for Locations, Targets, Enumerators #368
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
Conversation
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.
Pull Request Overview
This PR implements several UI/UX improvements across the Locations, Targets, and Enumerators modules. The main purpose is to enhance user experience by improving error handling, validation workflows, and UI consistency.
Key changes include:
- Enhanced CSV validation with selective empty field checking for targets and enumerators
- Updated location upload error display to use error warning table instead of basic alerts
- Simplified UI for targets/enumerators mapping by removing PII/bulk edit options and adding null value acceptance
- Added comprehensive form validation for survey ID field with alphanumeric and underscore restrictions
Reviewed Changes
Copilot reviewed 16 out of 16 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/csvValidator.ts | Enhanced validateCSVData function with optional empty column checking and improved data structures |
| src/redux/surveyLocations/surveyLocationsActions.ts | Fixed function name typo and added record_errors to error responses |
| src/modules/SurveyInformation/Targets/ | Updated file upload components to disable empty column validation |
| src/modules/SurveyInformation/Targets/TargetsRemap/TargetsRemap.tsx | Added selective validation and simplified custom field options |
| src/modules/SurveyInformation/Targets/TargetsMap/TargetsMap.tsx | Similar validation improvements and UI simplification |
| src/modules/SurveyInformation/SurveyUserRoles/SurveyUsers/ | Fixed bug by initializing roles array when user role changes to Survey Admin |
| src/modules/SurveyInformation/SurveyLocationUpload/SurveyLocationUpload.tsx | Replaced basic error display with comprehensive error warning table |
| src/modules/SurveyInformation/Enumerators/ | Applied similar validation and UI improvements as targets |
| src/modules/NewSurveyConfig/BasicInformation/BasicInformationForm.tsx | Added robust validation rules for survey ID field |
| src/components/EmailTableModel/EmailTableModel.tsx | Improved modal height and added search functionality to dropdowns |
| ); | ||
|
|
||
| export const puturveyLocations = createAsyncThunk( | ||
| export const putSurveyLocations = createAsyncThunk( |
Copilot
AI
Jul 22, 2025
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.
Function name was corrected from 'puturveyLocations' to 'putSurveyLocations', fixing the missing 'S' in 'put'.
| import { set } from "lodash"; | ||
|
|
Copilot
AI
Jul 22, 2025
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.
The 'set' import from lodash is not used anywhere in the file and should be removed to avoid unnecessary imports.
| import { set } from "lodash"; |
| const headers = parsedCsv?.data[0]; | ||
| const emptyRows: number[] = []; | ||
| const emptyColumns: string[] = []; | ||
| const emptyColumns: Set<string> = new Set(); |
Copilot
AI
Jul 22, 2025
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.
Using Set for emptyColumns is efficient for tracking unique column names and prevents duplicates, which is a good performance improvement over the previous array approach.
| // Validate CSV for empty columns (only for columnsToCheck) | ||
| if (columnsToCheck.length > 0) { | ||
| const validationResult = await validateCSVData( | ||
| new File([atob(csvBase64Data)], "data.csv"), |
Copilot
AI
Jul 22, 2025
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.
Using atob() to decode base64 data without proper validation could be a security risk. Consider validating the base64 data before decoding to prevent potential injection attacks.
| pattern: /^[a-zA-Z0-9_]+$/, | ||
| message: ( | ||
| <div style={{ maxWidth: "220px", whiteSpace: "normal" }}> | ||
| Survey ID can only contain letters, numbers, and | ||
| underscores | ||
| </div> | ||
| ), | ||
| }, | ||
| { | ||
| max: 25, | ||
| message: "Survey ID cannot exceed 25 characters", | ||
| }, |
Copilot
AI
Jul 22, 2025
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.
The regex pattern for survey ID validation is well-implemented, restricting to alphanumeric characters and underscores only, which aligns with the tooltip description and prevents potential issues with special characters in database table names.
| pattern: /^[a-zA-Z0-9_]+$/, | |
| message: ( | |
| <div style={{ maxWidth: "220px", whiteSpace: "normal" }}> | |
| Survey ID can only contain letters, numbers, and | |
| underscores | |
| </div> | |
| ), | |
| }, | |
| { | |
| max: 25, | |
| message: "Survey ID cannot exceed 25 characters", | |
| }, | |
| pattern: /^(?![_\.])[a-zA-Z0-9_.]{1,25}$/, | |
| message: ( | |
| <div style={{ maxWidth: "220px", whiteSpace: "normal" }}> | |
| Survey ID must start with a letter or number, can | |
| contain letters, numbers, underscores, and periods, | |
| and must not exceed 25 characters. | |
| </div> | |
| ), | |
| }, |
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 am getting a Token "NaN" is invalid. error in docker when uploading a custom column in targets with a null value when null values are allowed. Can you check this?
Also, the mandatory/ non-mandatory in edit drawer on targets is not changing based on what allows null values: https://jam.dev/c/d9166480-fc3f-4cd6-b60a-0687288c0c4d
NaN value fix is on backend, PR Raised: Can you try the changes again with this branch? |
|
@jeenut27 Can you test again with backend fixes IDinsight/surveystream_flask_api#322. |
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.
Targets screens are looking okay. Also tested the survey id change.
On enumerator - edit to remove a null value is not working (not sure if this is related to the changes here, but can you check?) https://jam.dev/c/61944175-dfd0-48bc-bd7d-a0b5db3eb282
A small nit on both targets and enumerators. For a blank value error, is it possible to update the error count at the top? In this it was just one row with a missing gender value. Also for these errors - is the reason why the download csv doesn't have specific rows because this check is happening on frontend?

Yes, since checks are run on frontend we don't have specific rows on error. I will see what we can do with error counts and download rows in this. |
UI/UX fixes for Locations, Targets, Enumerators
Ticket
Fixes: No tickets created
Description, Motivation and Context
Fixes:
To Do:
How Has This Been Tested?
Local
UI Changes
Survey_id changes:

Location error screen changes:

Targets/Enumerators Edit screen:

Targets/Enumerators Blank value error:

To-do before merge
Checklist:
This checklist is a useful reminder of small things that can easily be forgotten.
Put an
xin all the items that apply and remove any items that are not relevant to this PR.