feat: move activity types new and edit to mui - #977
Conversation
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
santipalenque
left a comment
There was a problem hiding this comment.
@priscila-moneo looks good ! just one thing
| linkToPresentationType, | ||
| unlinkFromPresentationType | ||
| }) => { | ||
| const [isSaving, setIsSaving] = useState(false); |
There was a problem hiding this comment.
please use baseState loading prop . it is set at the beginning of each action call: example
| linkToPresentationType, | ||
| unlinkFromPresentationType | ||
| }) => { | ||
| const isSaving = Boolean(loading); |
There was a problem hiding this comment.
isSaving is derived from the global baseState.loading counter instead of local state. This means any concurrent request (autocomplete, list reload, etc.) incorrectly disables the form while the user is filling it in.
The canonical pattern for popups in this project (see summit-admin-popup-dialog-pattern.md and the media-file-type-dialog.js reference) requires:
const [isSaving, setIsSaving] = useState(false)in the popupsetIsSaving(true)before calling save.finally(() => setIsSaving(false))to reset
Related: saveEventType is connected directly via Redux-connect in this dialog (mapDispatchToProps line 132), which is also an anti-pattern per the project rules — the save action belongs in the parent's handleSave, passed down as a single onSave prop.
see https://app.clickup.com/t/9014802374/86bag2zk7
| dispatch( | ||
| showSuccessMessage(T.translate("edit_event_type.event_type_saved")) | ||
| ); | ||
| return dispatch(getEventTypes()); |
There was a problem hiding this comment.
The list reload (dispatch(getEventTypes())) belongs in the parent's handleSave, not inside the action. As-is, saveEventType is coupled to the list page: it can't be reused in any other context without triggering a full list refresh.
The canonical shape (from the media-file-type-list-page.js reference and ticket 86bag2zk7) is:
// parent
const handleSave = (entity) =>
saveEventType(entity)
.then(() => getEventTypes(term, DEFAULT_CURRENT_PAGE, perPage, order, orderDir));Same issue applies to the POST path on line 155.
77cea30 to
6872754
Compare
Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar>
82c99d3 to
bb7892e
Compare
Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar>
09d60d6
into
feature/move-activity-types-grid-mui
* feat: move activity types new and edit to mui Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * fix: feedback from PR Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> --------- Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar>
* feat: move activity type list to mui Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * fix: feedback from PR Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * feat: move activity types new and edit to mui (#977) * feat: move activity types new and edit to mui Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * fix: feedback from PR Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> --------- Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * feat: migrate EventTypeForm to Formik + MUI dialog Replaces the legacy Bootstrap class-component EventTypeForm (embedded in the MUI dialog shipped in PR #969 with no DialogActions footer) with a single pure Formik + MUI EventTypeDialog, following company-dialog.js (PR #910) as the primary pattern and the tabbed layout from selection-plan-form.js (PR #917). - Main / Schedule settings tabs; MuiFormikTextField/Select/Checkbox/ AsyncAutocomplete; MuiColorInput with ref-based color tracking to avoid re-rendering the whole form on every drag - Media upload types linked-list rebuilt with Autocomplete + MuiTable, matching the track-groups-tab.js / company-dialog.js sponsorship table pattern, with dedup against already-linked types - EventTypeDialog is now a pure component; Redux wiring moved up into event-type-list-page.js, whose mapStateToProps now exposes currentEventType/currentEventTypeErrors matching every other list+dialog page's naming convention - Yup validation (positiveNumberValidation from utils/yup.js) for the numeric fields, with a NaN-safe fallback in handleSubmit since Formik does not auto-cast values on submit - Fixed a real renderValue bug in the shared MuiFormikSelect wrapper (echoed the raw value instead of resolving the MenuItem label, invisible elsewhere because other consumers' labels matched their values) - benefits 8 other call sites - Fixed a stale-errors-across-entities bug in event-type-reducer.js (RECEIVE_EVENT_TYPE didn't reset errors, unlike UPDATE_EVENT_TYPE) 87 test suites / 733 tests passing, 0 lint errors on touched files. Live-verified against a real summit without modifying its data. ref: https://app.clickup.com/t/86bac70mf * fix: unify color picker field between event-type and company dialogs Both dialogs duplicated a ColorPickerField that tracked the picked color in a useRef, splicing it into the payload only at submit time. This was a workaround for mui-color-input firing onChange on every pointermove while dragging, but it meant the color never participated in Formik state: no yup validation, stale server-side errors that never cleared on a corrective edit, and no name/id for the label or useScrollToError to target. Extract a shared MuiFormikColorField (src/components/mui/formik-inputs) that keeps local state for instant drag/typing feedback but commits to Formik (value + touched + validation) only on blur, avoiding a full-dialog re-render storm while still getting real validation and error-clearing. Add hexColorValidation() to src/utils/yup.js and wire it into both dialogs' schemas. Also fixes an unrelated pre-existing bug found while running the suite: MuiFormikAsyncAutocomplete referenced an undeclared defaultOptions variable, crashing every page that uses it. * refactor: migrate company/event-type actions off base-actions snackbar wrapper company-actions.js and event-type-actions.js now import snackbarErrorHandler and snackbarSuccessHandler directly from openstack-uicore-foundation instead of the local src/actions/base-actions.js wrapper, which is being phased out in favor of uicore-foundation as the single source of truth. Other action files still using the base-actions wrapper will be migrated incrementally (tracked in docs/plans/clickup-migrate-snackbar-handlers-to-uicore.md). event-type-actions.js also switches getEventTypes/getEventType/saveEventType/ deleteEventType/seedEventTypes from authErrorHandler (blocking alert) to snackbarErrorHandler, adds a success snackbar for seedEventTypes, and adds the event_types_seed i18n key. Also removes a leftover dispatch(showMessage(success_message, ...)) call in saveEventType's create branch left over from this migration - its backing success_message const had been deleted, so it would have thrown ReferenceError: success_message is not defined on every new event type creation. The snackbarSuccessHandler dispatch right below it already covers the success message. * fix: commit color field pending value on Enter to avoid stale submit * test: add event type list page coverage for search, pagination and crud flows * fix: reset to first page when sorting event type list * fix: refresh paginated event type list after seeding defaults * fix: close event type dialog on save success regardless of list refresh outcome * fix: sync color field display when formik value changes externally * fix: show global spinner during event type delete and seed operations --------- Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> Co-authored-by: smarcet <smarcet@gmail.com>
* feat: move activity type list to mui Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * fix: feedback from PR Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * feat: move activity types new and edit to mui (#977) * feat: move activity types new and edit to mui Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * fix: feedback from PR Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> --------- Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> * feat: migrate EventTypeForm to Formik + MUI dialog Replaces the legacy Bootstrap class-component EventTypeForm (embedded in the MUI dialog shipped in PR #969 with no DialogActions footer) with a single pure Formik + MUI EventTypeDialog, following company-dialog.js (PR #910) as the primary pattern and the tabbed layout from selection-plan-form.js (PR #917). - Main / Schedule settings tabs; MuiFormikTextField/Select/Checkbox/ AsyncAutocomplete; MuiColorInput with ref-based color tracking to avoid re-rendering the whole form on every drag - Media upload types linked-list rebuilt with Autocomplete + MuiTable, matching the track-groups-tab.js / company-dialog.js sponsorship table pattern, with dedup against already-linked types - EventTypeDialog is now a pure component; Redux wiring moved up into event-type-list-page.js, whose mapStateToProps now exposes currentEventType/currentEventTypeErrors matching every other list+dialog page's naming convention - Yup validation (positiveNumberValidation from utils/yup.js) for the numeric fields, with a NaN-safe fallback in handleSubmit since Formik does not auto-cast values on submit - Fixed a real renderValue bug in the shared MuiFormikSelect wrapper (echoed the raw value instead of resolving the MenuItem label, invisible elsewhere because other consumers' labels matched their values) - benefits 8 other call sites - Fixed a stale-errors-across-entities bug in event-type-reducer.js (RECEIVE_EVENT_TYPE didn't reset errors, unlike UPDATE_EVENT_TYPE) 87 test suites / 733 tests passing, 0 lint errors on touched files. Live-verified against a real summit without modifying its data. ref: https://app.clickup.com/t/86bac70mf * fix: unify color picker field between event-type and company dialogs Both dialogs duplicated a ColorPickerField that tracked the picked color in a useRef, splicing it into the payload only at submit time. This was a workaround for mui-color-input firing onChange on every pointermove while dragging, but it meant the color never participated in Formik state: no yup validation, stale server-side errors that never cleared on a corrective edit, and no name/id for the label or useScrollToError to target. Extract a shared MuiFormikColorField (src/components/mui/formik-inputs) that keeps local state for instant drag/typing feedback but commits to Formik (value + touched + validation) only on blur, avoiding a full-dialog re-render storm while still getting real validation and error-clearing. Add hexColorValidation() to src/utils/yup.js and wire it into both dialogs' schemas. Also fixes an unrelated pre-existing bug found while running the suite: MuiFormikAsyncAutocomplete referenced an undeclared defaultOptions variable, crashing every page that uses it. * refactor: migrate company/event-type actions off base-actions snackbar wrapper company-actions.js and event-type-actions.js now import snackbarErrorHandler and snackbarSuccessHandler directly from openstack-uicore-foundation instead of the local src/actions/base-actions.js wrapper, which is being phased out in favor of uicore-foundation as the single source of truth. Other action files still using the base-actions wrapper will be migrated incrementally (tracked in docs/plans/clickup-migrate-snackbar-handlers-to-uicore.md). event-type-actions.js also switches getEventTypes/getEventType/saveEventType/ deleteEventType/seedEventTypes from authErrorHandler (blocking alert) to snackbarErrorHandler, adds a success snackbar for seedEventTypes, and adds the event_types_seed i18n key. Also removes a leftover dispatch(showMessage(success_message, ...)) call in saveEventType's create branch left over from this migration - its backing success_message const had been deleted, so it would have thrown ReferenceError: success_message is not defined on every new event type creation. The snackbarSuccessHandler dispatch right below it already covers the success message. * fix: commit color field pending value on Enter to avoid stale submit * test: add event type list page coverage for search, pagination and crud flows * fix: reset to first page when sorting event type list * fix: refresh paginated event type list after seeding defaults * fix: close event type dialog on save success regardless of list refresh outcome * fix: sync color field display when formik value changes externally * fix: show global spinner during event type delete and seed operations --------- Signed-off-by: Priscila Moneo <priscila_moneo@hotmail.com.ar> Co-authored-by: smarcet <smarcet@gmail.com>
ref: https://app.clickup.com/t/9014802374/86bacr6x8