Allow editing in editable states ILLDEV-455 - #26
Merged
Conversation
Also removes a lot of mod-rs era stuff
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds requester-side editing support by introducing an edit route and gating the “Edit” action based on the broker state model’s editable flag, while also removing legacy “mod-rs era” directory/tiers utilities and consolidating request-form mapping logic.
Changes:
- Add
EditRouteand show an “Edit Patron Request” action only when the request’s requester-side state is markededitablein the state model. - Refactor Create/Edit flows to share form mapping (
brokerToForm/formToBroker) and shared-index selection handling (handleSISelect), plus a unifieduseOptionssource for select options. - Remove unused directory/tiers utilities and simplify test mocks around Stripes config and Okapi ky mutation stubbing.
Reviewed changes
Copilot reviewed 21 out of 21 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui-rs/translations/ui-rs/en.json | Adds a new edit error message key for callouts. |
| ui-rs/src/util/useNewDirectoryEntries.js | Removes legacy directory hook (deleted). |
| ui-rs/src/util/tiersBySymbol.js | Removes legacy tiers helper (deleted). |
| ui-rs/src/util/tierForRequest.js | Removes legacy tier lookup helper (deleted). |
| ui-rs/src/util/isRequestEditable.js | Adds helper to determine editability from state model + request state. |
| ui-rs/src/test/stripesCore.js | Simplifies Stripes core mock/stub config for route tests. |
| ui-rs/src/test/okapiKyMock.js | Simplifies post/put mocks; relies on jest per-test overrides. |
| ui-rs/src/routes/ViewRoute.test.js | Updates fixtures and asserts Edit action visibility based on editable state. |
| ui-rs/src/routes/ViewRoute.js | Fetches state model and conditionally renders Edit action (request app only). |
| ui-rs/src/routes/EditRoute.test.js | Adds coverage for edit prefill, PUT payload, redirects, and error callout. |
| ui-rs/src/routes/EditRoute.js | New edit route: fetches request + state model, gates by editability, PUTs updates. |
| ui-rs/src/routes/CreateRoute.test.js | Updates create tests for refactored form mapping/options. |
| ui-rs/src/routes/CreateRoute.js | Refactors create flow to use shared mapping/options; trims legacy logic. |
| ui-rs/src/index.js | Registers the new /requests/:id/edit route (request app only). |
| ui-rs/src/components/ViewPatronRequest/sections/EventHistory/EventHistory.js | Removes parseResponse: false option usage. |
| ui-rs/src/components/ViewMessageBanners.js | Updates cost banner gating (but still relies on request.state.code). |
| ui-rs/src/components/PatronRequestForm/useOptions.js | New shared select-options provider for the request form. |
| ui-rs/src/components/PatronRequestForm/PatronRequestForm.js | Simplifies form props; removes tiers/directory-driven fields and logic. |
| ui-rs/src/components/PatronRequestForm/operations.js | Adds operation constants for mapping behavior differences (create vs edit). |
| ui-rs/src/components/PatronRequestForm/handleSISelect.js | Extracts shared-index select mapping into a standalone mutator. |
| ui-rs/src/components/PatronRequestForm/formMapping.js | Centralizes broker↔form transformations, preserving undisplayed identifiers. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Also removes a lot of mod-rs era stuff