Feature/companies list mui - #910
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughCompany state, actions, and UI are updated for a dialog-driven company management flow. The async autocomplete gains default-options support, company strings are extended, and a new ChangesCompany Management MUI Refactor
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
c27c41f to
ecef716
Compare
c32be01 to
4616df3
Compare
There was a problem hiding this comment.
Actionable comments posted: 7
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/actions/company-actions.js (2)
210-219:⚠️ Potential issue | 🟠 Major | ⚡ Quick winEnsure
attachLogoclears loading state when company creation fails.Line 197 starts loading, but in the create-before-upload branch (Line 210-219), a failure in
postRequestnever reachesuploadFile(wherestopLoadinglives), leaving loading stuck.💡 Suggested fix
} else { - return postRequest( + return postRequest( createAction(UPDATE_COMPANY), createAction(COMPANY_ADDED), `${window.API_BASE_URL}/api/v1/companies`, normalizedEntity, snackbarErrorHandler, entity - )(params)(dispatch).then((payload) => { - dispatch(uploadFile(payload.response, file)); - }); + )(params)(dispatch) + .then((payload) => dispatch(uploadFile(payload.response, file))) + .catch((err) => { + dispatch(stopLoading()); + throw err; + }); } };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/actions/company-actions.js` around lines 210 - 219, The postRequest call in the attachLogo function (lines 210-219) only handles the success case via the .then() handler which calls uploadFile and its associated stopLoading action, but does not handle errors from postRequest. Add a .catch() handler to the promise chain that dispatches the stopLoading action when postRequest fails, ensuring the loading state is cleared regardless of whether the request succeeds or fails.
155-191:⚠️ Potential issue | 🟠 Major | ⚡ Quick winReturn the request promise from
saveCompany.Line 156 and Line 174 start async requests but do not return them. The thunk resolves early, so callers cannot await real completion (which can break dialog
isSaving/post-save sequencing).💡 Suggested fix
if (entity.id) { - putRequest( + return putRequest( createAction(UPDATE_COMPANY), createAction(COMPANY_UPDATED), `${window.API_BASE_URL}/api/v1/companies/${entity.id}`, normalizedEntity, snackbarErrorHandler, entity )(params)(dispatch) .then(() => { dispatch( snackbarSuccessHandler({ title: T.translate("general.success"), html: T.translate("edit_company.company_saved") }) ); }) .finally(() => dispatch(stopLoading())); } else { - postRequest( + return postRequest( createAction(UPDATE_COMPANY), createAction(COMPANY_ADDED), `${window.API_BASE_URL}/api/v1/companies`, normalizedEntity, snackbarErrorHandler, entity )(params)(dispatch) .then(() => { dispatch( snackbarSuccessHandler({ title: T.translate("general.success"), html: T.translate("edit_company.company_created") }) ); }) .finally(() => dispatch(stopLoading())); }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/actions/company-actions.js` around lines 155 - 191, The saveCompany function does not return the promises from the async requests, causing the thunk to resolve before the actual requests complete. Add return statements before both the putRequest call (in the if block when entity.id exists) and the postRequest call (in the else block) to return the promise chains, allowing callers to properly await the completion of the save operations and maintain correct sequencing for dialog state management.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/components/mui/formik-inputs/mui-formik-color-input.js`:
- Line 8: The localValue state in the component is only initialized once from
field.value using useState, so it does not update when the Formik field value
changes externally (such as during form resets). Add a useEffect hook with
field.value as a dependency that calls setLocalValue whenever field.value
changes. This will ensure the color picker always displays the current Formik
field value even when it is updated externally.
In `@src/pages/companies/company-list-page.js`:
- Around line 78-80: The useState hook at the initial companies fetch is being
misused with a callback and dependency array, but useState ignores the second
argument entirely and is not intended for side effects. Replace the useState
call with useEffect to properly handle the side effect of calling getCompanies
on component mount, similar to how getSponsoredProjects is correctly implemented
elsewhere in the file. Move the getCompanies invocation inside the useEffect
function body and pass an empty dependency array to ensure it executes only on
initial component mount.
In `@src/pages/companies/components/company-dialog.js`:
- Around line 96-114: The `country` field is missing from the Formik
`initialValues` object in the company-dialog.js file, even though a country
autocomplete input exists in the form. Add the missing `country` field to the
initialValues object alongside the other fields like `city` and `state`, using
the pattern `country: initialEntity?.country ?? ""` to ensure the country value
is properly initialized and preserved when the form is submitted via
formik.values.
- Around line 174-184: The handleDeleteSponsorship function is not awaiting the
Promise returned by showConfirmDialog, which causes the confirm variable to hold
a Promise object instead of the boolean result. Since a Promise object is always
truthy, the if (confirm) check will always be true and onDeleteSponsorship will
execute immediately without waiting for user confirmation. Make the function
async by adding the async keyword to its declaration, then add await before the
showConfirmDialog call when assigning to confirm, so the code waits for the
user's response before executing onDeleteSponsorship.
- Around line 155-161: The handleAddSponsorshipType function calls
onAddSponsorship with incorrect argument order. The current order passes
(companyId, projectId, sponsorshipTypeId), but the function expects (projectId,
sponsorshipTypeId, entity) where the company ID must be included in the entity
object as a property. Reorder the arguments so selectedSponsoredProject is
passed first, selectedSponsorShipType second, and create an entity object as the
third argument that contains the company ID from formik.values.id.
In `@src/reducers/companies/company-reducer.js`:
- Around line 104-111: The code assumes that the find() call searching through
project_sponsorships will always return a match, but when no
supporting_companies matches the given supportingCompanyId, the variable f will
be undefined. When f is undefined, the subsequent filter operation trying to
access f.id will throw an error. Add a guard condition to check that f is
defined and truthy before attempting to filter project_sponsorships by f.id. If
f is undefined, return the current state unchanged or handle the case
appropriately instead of proceeding with the filter.
- Around line 63-69: The reducer's switch statement for the LOGOUT_USER case is
missing null safety for the payload object. In the destructuring assignment
where type and payload are extracted from the action parameter, add a default
value of an empty object to the payload variable to handle cases where
action.payload is undefined. Then, replace the unsafe hasOwnProperty call on
payload with Object.prototype.hasOwnProperty.call(payload, "persistStore") to
safely check for the persistStore property without throwing a TypeError when
payload is undefined.
---
Outside diff comments:
In `@src/actions/company-actions.js`:
- Around line 210-219: The postRequest call in the attachLogo function (lines
210-219) only handles the success case via the .then() handler which calls
uploadFile and its associated stopLoading action, but does not handle errors
from postRequest. Add a .catch() handler to the promise chain that dispatches
the stopLoading action when postRequest fails, ensuring the loading state is
cleared regardless of whether the request succeeds or fails.
- Around line 155-191: The saveCompany function does not return the promises
from the async requests, causing the thunk to resolve before the actual requests
complete. Add return statements before both the putRequest call (in the if block
when entity.id exists) and the postRequest call (in the else block) to return
the promise chains, allowing callers to properly await the completion of the
save operations and maintain correct sequencing for dialog state management.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 0f161bb2-ad2c-464d-98fc-783e2d30d6b7
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
package.jsonsrc/actions/company-actions.jssrc/components/mui/formik-inputs/mui-formik-async-select.jssrc/components/mui/formik-inputs/mui-formik-color-input.jssrc/i18n/en.jsonsrc/pages/companies/company-list-page.jssrc/pages/companies/components/company-dialog.jssrc/reducers/companies/company-list-reducer.jssrc/reducers/companies/company-reducer.js
smarcet
left a comment
There was a problem hiding this comment.
Review contra patrón popup/dialog (ticket #86bag2zk7)
El ticket #86bag2zk7 define el patrón canónico para popups en páginas de lista MUI. Esta PR introduce el mismo CompanyListPage + CompanyDialog pero desvía del patrón en 4 puntos críticos y tiene 2 bugs adicionales. Ver los comentarios inline para detalle específico.
smarcet
left a comment
There was a problem hiding this comment.
Review against the popup/dialog pattern defined in ticket #86bag2zk7. The new CompanyListPage + CompanyDialog deviates from the established pattern in 4 critical points and has 2 additional bugs. See inline comments for details.
Superseded by updated review with only confirmed findings
smarcet
left a comment
There was a problem hiding this comment.
Review against ticket #86bag2zk7. Four confirmed bugs and one question on an intentional behavior change. See inline comments.
…er and actions Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
00063d2 to
b82a7fb
Compare
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/actions/company-actions.js (1)
208-220: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick winReturn the upload promise from
attachLogoand cover create-failure loading cleanup (Line 208, Line 218).
attachLogoresolves before the upload finishes becausedispatch(uploadFile(...))is not returned in either branch. Also, in the create path, a failedPOST /companiesleavesstartLoading()unbalanced.Suggested fix
const uploadFile = picAttr === "logo" ? uploadLogo : uploadBigLogo; if (entity.id) { - dispatch(uploadFile(entity, file)); + return dispatch(uploadFile(entity, file)); } else { return postRequest( createAction(UPDATE_COMPANY), createAction(COMPANY_ADDED), `${window.API_BASE_URL}/api/v1/companies`, normalizedEntity, snackbarErrorHandler, entity - )(params)(dispatch).then((payload) => { - dispatch(uploadFile(payload.response, file)); - }); + )(params)(dispatch) + .then((payload) => { + return dispatch(uploadFile(payload.response, file)); + }) + .catch((err) => { + dispatch(stopLoading()); + throw err; + }); } };🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/actions/company-actions.js` around lines 208 - 220, The attachLogo function does not properly return the upload promise because dispatch(uploadFile(...)) is not returned in either branch, causing the function to resolve before the upload completes. In the first branch (when entity.id exists), return the result of dispatch(uploadFile(entity, file)). In the second branch (POST request path), return the result of dispatch(uploadFile(payload.response, file)) from within the .then() callback. Additionally, add a .catch() handler to the promise chain to ensure proper cleanup of the loading state when the POST request fails, maintaining the balance of startLoading() call.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@src/actions/company-actions.js`:
- Around line 262-263: Add a guard clause before calling startsWith on
normalizedEntity.color to prevent runtime errors when color is null, undefined,
or not a string. Verify that normalizedEntity.color exists and is a string type
before attempting to call the startsWith method, and only execute the substr
operation when the guard condition is satisfied.
In `@src/components/mui/formik-inputs/mui-formik-async-select.js`:
- Around line 21-24: The component has inconsistent handling of multi-select
mode, using both isMulti prop (in the function parameter destructuring and at
Line 96 with Autocomplete) and multiple prop (at Line 30 for value shape and
Line 73 for selection mapping, and Line 140). Standardize on a single prop name
throughout the component by replacing all occurrences of the multiple prop with
isMulti to ensure consistent behavior when determining whether the component
should operate in multi-select or single-select mode across value shape
handling, selection mapping, and the Autocomplete component configuration.
---
Outside diff comments:
In `@src/actions/company-actions.js`:
- Around line 208-220: The attachLogo function does not properly return the
upload promise because dispatch(uploadFile(...)) is not returned in either
branch, causing the function to resolve before the upload completes. In the
first branch (when entity.id exists), return the result of
dispatch(uploadFile(entity, file)). In the second branch (POST request path),
return the result of dispatch(uploadFile(payload.response, file)) from within
the .then() callback. Additionally, add a .catch() handler to the promise chain
to ensure proper cleanup of the loading state when the POST request fails,
maintaining the balance of startLoading() call.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 27ef094a-3b4d-481f-93f7-ae55d6229799
⛔ Files ignored due to path filters (1)
yarn.lockis excluded by!**/yarn.lock,!**/*.lock
📒 Files selected for processing (9)
package.jsonsrc/actions/company-actions.jssrc/components/mui/formik-inputs/mui-formik-async-select.jssrc/i18n/en.jsonsrc/pages/companies/company-list-page.jssrc/pages/companies/components/__tests__/company-dialog.test.jssrc/pages/companies/components/company-dialog.jssrc/reducers/companies/company-list-reducer.jssrc/reducers/companies/company-reducer.js
✅ Files skipped from review due to trivial changes (2)
- package.json
- src/i18n/en.json
🚧 Files skipped from review as they are similar to previous changes (4)
- src/pages/companies/components/tests/company-dialog.test.js
- src/reducers/companies/company-list-reducer.js
- src/pages/companies/company-list-page.js
- src/reducers/companies/company-reducer.js
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
|
@tomrndom there's an argument order mismatch in The dialog calls: onAddSponsorship(
formik.values.id, // company id
selectedSponsoredProject, // project id
selectedSponsorShipType // sponsorship type id (a number)
)But saveSupportingCompany(
selectedSponsoredProject,
selectedSponsorShipType,
{ id: 0, company: { id: companyId } }
)With the current order, onAddSponsorship(
selectedSponsoredProject,
selectedSponsorShipType,
{ id: 0, company: { id: formik.values.id } }
) |
|
@tomrndom When export const attachLogo = (entity, file, picAttr) => async (dispatch) => {
// ...
if (entity.id) {
dispatch(uploadFile(entity, file)); // no return
}
};Because it's an setIsSaving(true);
onAttach(initialEntity, uploadLogo, field)
.finally(() => setIsSaving(false)); // fires in the same tick
Fix is a one-liner: if (entity.id) {
return dispatch(uploadFile(entity, file)); // propagates the Promise
} |
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com>
When onAttach rejected (e.g. network error after CDN upload), the dialog kept showing the new logo preview while the server association never happened. A subsequent Save would then strip the logo field (normalizeEntity deletes logo for existing companies) and overwrite with no logo. Capture prevValue before the optimistic setFieldValue and restore it in .catch(), matching the pattern already used by handleLogoRemove. Add regression test: asserts Save re-enables and data-logo reverts to the previous value when onAttach rejects.
…regression test - Replace Spanish inline comment in mui-formik-async-select with English - Add test: rejected onSave keeps dialog open and re-enables save button
When creating a new company (id=0), onUploadStart sets isSaving=true but the subsequent if (initialEntity?.id) block is falsy, so setIsSaving(false) was never called after the CDN upload completed. Add else branch to handleLogoUploadComplete that resets isSaving for new companies without calling onAttach (which is only meaningful for existing companies that need the logo attached server-side immediately). Add regression test: renders new company, triggers big_logo upload, asserts save button re-enables and onAttach is not called.
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
* 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: refactor list page into MUI and uicore components, adjust reducer and actions Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: company dialog, temporal components, WIP attach logo Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: add missing data into formik Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: adjust change son reducer and default values for colors Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: add isSaving prop into list and dialog Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: replace input color component Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: isolate color picker to improve performance Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: adjust isSaving pattern, clean dead code, return promises Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: adjust logo upload, unit tests cases, country value from string Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: remove logo actions, fix color save, isSaving on upload Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: update uicore version Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: return uploadFile on attachLogo, onAddSponsorship params fix Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix: adjust reducer cases, add catches, multi on async select adjustment Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> * fix(company-dialog): revert logo preview on onAttach failure When onAttach rejected (e.g. network error after CDN upload), the dialog kept showing the new logo preview while the server association never happened. A subsequent Save would then strip the logo field (normalizeEntity deletes logo for existing companies) and overwrite with no logo. Capture prevValue before the optimistic setFieldValue and restore it in .catch(), matching the pattern already used by handleLogoRemove. Add regression test: asserts Save re-enables and data-logo reverts to the previous value when onAttach rejects. * fix(company-dialog): translate Spanish comment and add rejected-save regression test - Replace Spanish inline comment in mui-formik-async-select with English - Add test: rejected onSave keeps dialog open and re-enables save button * fix(companies): re-enable save after logo CDN upload on new company When creating a new company (id=0), onUploadStart sets isSaving=true but the subsequent if (initialEntity?.id) block is falsy, so setIsSaving(false) was never called after the CDN upload completed. Add else branch to handleLogoUploadComplete that resets isSaving for new companies without calling onAttach (which is only meaningful for existing companies that need the logo attached server-side immediately). Add regression test: renders new company, triggers big_logo upload, asserts save button re-enables and onAttach is not called. --------- Signed-off-by: Tomás Castillo <tcastilloboireau@gmail.com> 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/86b9n7p5w
Signed-off-by: Tomás Castillo tcastilloboireau@gmail.com
Summary by CodeRabbit