-
Notifications
You must be signed in to change notification settings - Fork 8
PLU-345: FormSG table field #1069
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
PLU-345: FormSG table field #1069
Conversation
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Datadog ReportBranch report: ✅ 0 Failed, 1011 Passed, 0 Skipped, 2m 57.99s Total Time |
ebecbae to
81ef243
Compare
45bc702 to
73b11bd
Compare
73b11bd to
e0d7696
Compare
f6e23ee to
ef7a1db
Compare
e0d7696 to
1c9f16f
Compare
2d5768a to
26b95a3
Compare
e3d9f86 to
0b57665
Compare
pregnantboy
left a comment
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.
looks good. works with 0 rows, deleted columns.
maybe refactor the isformtable check. too many if else cases
packages/frontend/src/components/FlowStepTestController/utils.tsx
Outdated
Show resolved
Hide resolved
packages/frontend/src/components/FlowStepTestController/utils.tsx
Outdated
Show resolved
Hide resolved
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 adds support for FormSG table fields in the For-Each action, enabling users to iterate through table data from FormSG submissions. The implementation converts FormSG table fields into structured table objects compatible with the existing For-Each functionality.
- Adds FormSG table field processing to convert table data into a standardized format
- Extends For-Each action to support FormSG table input source
- Updates frontend to properly handle FormSG table field previews and empty table states
Reviewed Changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/frontend/src/components/VariablesList/schema.ts | Added FormSG table data parsing and schema validation |
| packages/frontend/src/components/VariablesList/TableVariableItem.tsx | Added conditional modal opening for empty tables |
| packages/frontend/src/components/FlowStepTestController/utils.tsx | Added FormSG table input source handling and parameter matching logic |
| packages/backend/src/apps/toolbox/common/constants.ts | Added FORMSG_TABLE constant and table sources array |
| packages/backend/src/apps/toolbox/actions/for-each/schema.ts | Extended schema to support FormSG table input source |
| packages/backend/src/apps/toolbox/actions/for-each/index.ts | Updated action logic to handle FormSG table sources |
| packages/backend/src/apps/toolbox/actions/for-each/get-data-out-metadata.ts | Updated metadata generation for FormSG table sources |
| packages/backend/src/apps/formsg/triggers/new-submission/get-mock-data.ts | Added table object conversion for mock data |
| packages/backend/src/apps/formsg/triggers/new-submission/get-data-out-metadata.ts | Added table metadata building and visibility logic |
| packages/backend/src/apps/formsg/common/process-table-field.ts | New utility to convert FormSG table fields to structured format |
| packages/backend/src/apps/formsg/auth/decrypt-form-response.ts | Added table field processing during response decryption |
packages/backend/src/apps/formsg/triggers/new-submission/get-data-out-metadata.ts
Show resolved
Hide resolved
*NOTE: this is not a blocker for beta; intent is to release this while beta is happening* ### TL;DR This PR adds support for FormSG table fields in the For-Each action, enabling users to iterate through table data from FormSG submissions. ### What changed? - Added functionality to convert FormSG table field into `table` object to enable preview of row data and to use in for-each actions - Added a new input source type `FORMSG_TABLE` to the For-Each action - Updated the For-Each action to handle FormSG table fields, allowing iteration through table rows - Added test cases for the new table field functionality - Hide form cell values if there are no rows ### How to test? 1. Create a FormSG form with a table field 2. Set up a workflow that uses the FormSG trigger - [ ] Mock data - [ ] Should still show the individual cell values as "Response X, Row 1 Column 1" etc - [ ] Should have preview in test result - [ ] Modal should show all columns in the table - [ ] Modal should show 2 rows of mock data with each column filled - [ ] Actual submission - [ ] Should show the individual cell values with column headers if headers do not contain commas, otherwise resort to default (Column 1, Column 2, etc.) - [ ] Should have preview in test result - [ ] Preview should column headers if headers do not contain commas, otherwise default column names - [ ] Modal should show all columns in the table - [ ] Modal should show correct rows of mock data with each column filled - [ ] Actual submission with no data - [ ] Should NOT show individual cell values - [ ] Should NOT be able to preview ### Why make this change? FormSG table fields contain structured data that users often need to process row by row. This change enables users to iterate through table rows in a FormSG submission, making it possible to perform actions on each row of data separately. ### Screenshots **FormSG table preview** (can ignore the form connection issue, happens on local dev) Preview with mock data    **FormSG variable in for-each** 

NOTE: this is not a blocker for beta; intent is to release this while beta is happening
TL;DR
This PR adds support for FormSG table fields in the For-Each action, enabling users to iterate through table data from FormSG submissions.
What changed?
tableobject to enable preview of row data and to use in for-each actionsFORMSG_TABLEto the For-Each actionHow to test?
Mock data
Actual submission
Actual submission with no data
Why make this change?
FormSG table fields contain structured data that users often need to process row by row. This change enables users to iterate through table rows in a FormSG submission, making it possible to perform actions on each row of data separately.
Screenshots
FormSG table preview
(can ignore the form connection issue, happens on local dev)
Preview with mock data
FormSG variable in for-each