Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
108 commits
Select commit Hold shift + click to select a range
d6e1178
added production location info page, part of the redux, passed countr…
Dec 18, 2024
6eec3e6
added processing type data
Dec 19, 2024
266d749
minor fixes
Dec 19, 2024
4129ab7
minor changes regarding coderabbitAI comments
Dec 20, 2024
645646e
Merge branch 'main' into OSDEV-1130-implement-collecting-contribution…
Dec 20, 2024
9a7880c
added task description
Dec 20, 2024
cacecc5
changes with arrow icon, revert propType, simplified handlers
Dec 24, 2024
4a98939
added cursor and changed structure of title and btn
Dec 24, 2024
f0dfa78
errorText changed, fixed styles
Dec 25, 2024
f5c9ab9
removed default option
Dec 25, 2024
8dc80e6
fixed classes
Dec 26, 2024
61d7cef
Change the release date for version 1.27.0 (#466)
Innavin369 Dec 20, 2024
c37757e
[OSDEV-1533] Moderation Decision Date should be N/A if "status_change…
Innavin369 Dec 26, 2024
fdcf385
[OSDEV-1532] Fix date filter on the Moderation Queue page (#469)
Innavin369 Dec 26, 2024
3dcf1f5
Make integration of POST /v1/production-locations/ (partial impl)
VadimKovalenkoSNF Dec 27, 2024
c32fd03
Parse request data object
VadimKovalenkoSNF Dec 30, 2024
ff5be59
Minor refactoring
VadimKovalenkoSNF Dec 30, 2024
c253c9c
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 7, 2025
aebc370
Minor post-merge fixes
VadimKovalenkoSNF Jan 7, 2025
277ab75
Remove redundant code
VadimKovalenkoSNF Jan 7, 2025
062ef95
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 7, 2025
044e87a
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 8, 2025
e74a94f
Minor merge conflict fixes
VadimKovalenkoSNF Jan 9, 2025
39f5041
Integration of modal window (partial impl)
VadimKovalenkoSNF Jan 9, 2025
a423100
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 9, 2025
e88f06c
Add interval to fetch moderation event
VadimKovalenkoSNF Jan 10, 2025
26afd31
Introduce ProductionLocationDialog
VadimKovalenkoSNF Jan 13, 2025
7c96de2
Remove interval to get moderation record, introduce cleaned_data in t…
VadimKovalenkoSNF Jan 14, 2025
6c10f10
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 14, 2025
0a6738a
Apply separate routing for PATCH and POST
VadimKovalenkoSNF Jan 14, 2025
0bb4281
Fix routing
VadimKovalenkoSNF Jan 14, 2025
fe0b740
Disable empty labels
VadimKovalenkoSNF Jan 15, 2025
64b2767
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 15, 2025
a749999
Add data handling from the localStorage
VadimKovalenkoSNF Jan 16, 2025
e0253ab
Hide modal window on clicking back button in browser
VadimKovalenkoSNF Jan 16, 2025
b786e9a
Refactor local storage key naming
VadimKovalenkoSNF Jan 16, 2025
cb5648a
Connect single procution location, populate response to the form fields
VadimKovalenkoSNF Jan 16, 2025
6d63cc3
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 16, 2025
7cebefc
Use lodash isEmpty intead of custom method
VadimKovalenkoSNF Jan 16, 2025
fbe6335
Connect PATCH endpoint
VadimKovalenkoSNF Jan 16, 2025
74fa171
Force trailing slash in URL to prevent broken UX scenarios
VadimKovalenkoSNF Jan 16, 2025
5407df5
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 18, 2025
116250e
Manually replace changes from OSDEV-1374
VadimKovalenkoSNF Jan 18, 2025
924f80e
Integrate FE routing
VadimKovalenkoSNF Jan 20, 2025
2b588b8
Refactor fetchProductionLocationByOsId()
VadimKovalenkoSNF Jan 20, 2025
3a12aa4
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 20, 2025
eedb506
Minor lint fixes, more prop types
VadimKovalenkoSNF Jan 20, 2025
a6ac24a
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 21, 2025
4dac01f
Fix submitMethod proptype, rollback signals.py file
VadimKovalenkoSNF Jan 21, 2025
552bf2a
Create responsive close dialog button, create effect to go back feature
VadimKovalenkoSNF Jan 21, 2025
fa37609
Pass moderation status to the chip component
VadimKovalenkoSNF Jan 21, 2025
46ca133
Refactor text transform
VadimKovalenkoSNF Jan 22, 2025
11a40b1
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 22, 2025
74adb1d
Upd styles for chip component depending on moderation status
VadimKovalenkoSNF Jan 22, 2025
6e692d2
Fix merge confilicts leftovers
VadimKovalenkoSNF Jan 22, 2025
43431d5
Fix unit tests
VadimKovalenkoSNF Jan 22, 2025
1670ee0
Fix bug with zero number of workers
VadimKovalenkoSNF Jan 22, 2025
2d14b04
Refactor modal window rendering
VadimKovalenkoSNF Jan 22, 2025
d1866b6
Fix backrouting and single number of workers
VadimKovalenkoSNF Jan 22, 2025
7ebccab
Handle claim link in ProductionLocationDialog
VadimKovalenkoSNF Jan 22, 2025
628e95a
Refactor getting of claim status
VadimKovalenkoSNF Jan 22, 2025
2bdcd3e
Optimize routing of /contribute/single-location
VadimKovalenkoSNF Jan 22, 2025
042a544
reuse contributeProductionLocationRoute
VadimKovalenkoSNF Jan 23, 2025
ad0aa01
Update test_production_locations_partial_update
VadimKovalenkoSNF Jan 23, 2025
1161d49
Update test_production_locations_create
VadimKovalenkoSNF Jan 23, 2025
9167351
Add more tests for ProductionLocationDialog test
VadimKovalenkoSNF Jan 23, 2025
1f9a4cb
Add test for dialog on close
VadimKovalenkoSNF Jan 23, 2025
780c288
Minor optimizations
VadimKovalenkoSNF Jan 23, 2025
b67ebed
Refactor renderValue() function
VadimKovalenkoSNF Jan 23, 2025
afe757c
Apply minor fixes
VadimKovalenkoSNF Jan 23, 2025
ded0db0
Minor test fix
VadimKovalenkoSNF Jan 23, 2025
1780fb9
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 23, 2025
274cf4e
Remove console.log
VadimKovalenkoSNF Jan 23, 2025
cc83354
Refactor claim button
VadimKovalenkoSNF Jan 23, 2025
468b9e2
Minor test fix
VadimKovalenkoSNF Jan 23, 2025
edff79d
Connect sector to fieds for the modal dialog
VadimKovalenkoSNF Jan 23, 2025
b147829
Refactor sector rendering on dialod popup
VadimKovalenkoSNF Jan 24, 2025
f041625
Apply errro handling on FE
VadimKovalenkoSNF Jan 24, 2025
358a715
Refactor routing between SearchByNameAndAddressSuccessResult and Prod…
VadimKovalenkoSNF Jan 24, 2025
305e251
Update search param props
VadimKovalenkoSNF Jan 24, 2025
4794001
Update release notes
VadimKovalenkoSNF Jan 24, 2025
3685703
Fix bug with non-cleared Redux state with pending moderation event
VadimKovalenkoSNF Jan 27, 2025
68d2d77
Refactor disabled claim button message
VadimKovalenkoSNF Jan 27, 2025
34a4022
Add info icon to pending claim button
VadimKovalenkoSNF Jan 27, 2025
ba2aad4
Update unit tests
VadimKovalenkoSNF Jan 27, 2025
321ad32
Bring back box shadow for confirm button
VadimKovalenkoSNF Jan 27, 2025
0286c92
Fix lint issue
VadimKovalenkoSNF Jan 27, 2025
9ba00ea
Update tooltip text
VadimKovalenkoSNF Jan 28, 2025
3f98a94
Filter empty additional data before passing to ProductionLocationDial…
VadimKovalenkoSNF Jan 28, 2025
4ff5b35
Refactor claimButton parameter handling
VadimKovalenkoSNF Jan 28, 2025
e987656
Reuse getIsMobile util function
VadimKovalenkoSNF Jan 28, 2025
c49fb12
Refactor claimButton parameters
VadimKovalenkoSNF Jan 28, 2025
54accbd
Create makeContributeProductionLocationUpdateURL
VadimKovalenkoSNF Jan 28, 2025
491f0f9
Refactor convertRangeField
VadimKovalenkoSNF Jan 29, 2025
04ed47c
Refactor parseContribData
VadimKovalenkoSNF Jan 29, 2025
96db96c
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 29, 2025
beea517
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 29, 2025
8d813e6
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 29, 2025
e6a1948
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 30, 2025
ca50453
Merge branch 'main' into OSDEV-1365-SLC-integrate-collecting-contribu…
VadimKovalenkoSNF Jan 31, 2025
4e616aa
Minor review fixes
VadimKovalenkoSNF Jan 31, 2025
f735504
Use memoization for the getIsMobile() function
VadimKovalenkoSNF Jan 31, 2025
5360439
Refactor routing handling and abstract conditions in ProductionLocati…
VadimKovalenkoSNF Jan 31, 2025
22e9e5b
Minor refactoring
VadimKovalenkoSNF Jan 31, 2025
0ecf1bc
Add contitional instruction on production location info page
VadimKovalenkoSNF Jan 31, 2025
39e4a61
Refactor duplicated contributeProductionLocation
VadimKovalenkoSNF Jan 31, 2025
5a434d4
Add timeout clearing
VadimKovalenkoSNF Jan 31, 2025
a12983b
Add useMemo to the inputData
VadimKovalenkoSNF Jan 31, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion doc/release/RELEASE-NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,21 @@ This project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html
- Connected GET `v1/production-locations`.
- Routing between pages `Production Location Search`,`Search returned no results`, `Production Location Information`, `Search results`, and `I don't see my Location` pop-up is configured.
- Max result limit set to 100.
* [OSDEV-1365](https://opensupplyhub.atlassian.net/browse/OSDEV-1365) - SLC: Integrate collecting contribution data page.
* [OSDEV-1370](https://opensupplyhub.atlassian.net/browse/OSDEV-1370) - SLC: Connect Backend API submission with "Thank for Submitting" screen
- Integrated `POST /v1/production-locations/` in `/contribute/production-location/info/` page.
- Integrated `PATCH /v1/production-locations/` in `/contribute/production-location/{os_id}/info/` page.
- Production location info page is now rendered using two routes: /contribute/production-location/info/ and /contribute/production-location/{os_id}/info/. First route for creating new production location, second is for updating existing one.
- Implemented error popup on error response for `PATCH | POST /v1/production-locations/`.
- Implemented error popup on error response for `GET /v1/moderation-events/{moderation_id}`.
- Integrated "Thank for Submitting" modal dialog. When popup is appeared, path parameter `{moderation-id}` will be attached to `/contribute/production-location/{os_id}/info/` or `/contribute/production-location/info/`.
- Implemented temporary saving of moderation events in local storage for a seamless user experience.
- Created separate mobile and desktop layouts for "Thank for Submitting" modal dialog.
- Created link to claim from "Thank for Submitting" modal dialog only if production location is available for claim and moderation event is not pending.
- Implemented serializing and validation production location fields before passing to the "Thank for Submitting" modal dialog.
- Refactored routing between search results page and production location info page. Search parameters are now stored in the Redux state, so the 'Go Back' button in production location info page will lead to the previous search.
* [OSDEV-1558](https://opensupplyhub.atlassian.net/browse/OSDEV-1558) - Added a new field, `action_type`, to the moderation event. This data appears on the Contribution Record page when a moderator creates a new location or matches it to an existing one.


### Release instructions:
* Ensure that the following commands are included in the `post_deployment` command:
* `migrate`
Expand Down
6 changes: 4 additions & 2 deletions src/django/api/tests/test_production_locations_create.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,8 @@ def test_default_throttling_is_applied(self, mock_get):
response_body_dict.get('created_at'),
stringified_created_at
)
self.assertEqual(len(response_body_dict), 3)
self.assertIn("cleaned_data", response_body_dict)
self.assertEqual(len(response_body_dict), 4)

# Now simulate the 31st request, which should be throttled.
throttled_response = self.client.post(
Expand Down Expand Up @@ -205,7 +206,8 @@ def test_moderation_event_created_with_valid_data(
response_moderation_id,
str(moderation_event.uuid)
)
self.assertEqual(len(response_body_dict), 3)
self.assertIn("cleaned_data", response_body_dict)
self.assertEqual(len(response_body_dict), 4)

@patch('api.geocoding.requests.get')
def test_moderation_event_not_created_with_invalid_data(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,8 @@ def test_default_throttling_is_applied(self, mock_get):
response_body_dict.get('os_id'),
self.production_location.id
)
self.assertEqual(len(response_body_dict), 4)
self.assertIn("cleaned_data", response_body_dict)
self.assertEqual(len(response_body_dict), 5)

# Now simulate the 31st request, which should be throttled.
throttled_response = self.client.patch(
Expand Down Expand Up @@ -269,7 +270,8 @@ def test_moderation_event_created_with_valid_data(
response_body_dict.get('os_id'),
self.production_location.id
)
self.assertEqual(len(response_body_dict), 4)
self.assertIn("cleaned_data", response_body_dict)
self.assertEqual(len(response_body_dict), 5)

@patch('api.geocoding.requests.get')
def test_moderation_event_not_created_with_invalid_data(
Expand Down
6 changes: 4 additions & 2 deletions src/django/api/views/v1/production_locations.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,8 @@ def create(self, request):
{
'moderation_id': result.moderation_event.uuid,
'moderation_status': result.moderation_event.status,
'created_at': result.moderation_event.created_at
'created_at': result.moderation_event.created_at,
'cleaned_data': result.moderation_event.cleaned_data,
},
status=result.status_code
)
Expand Down Expand Up @@ -238,7 +239,8 @@ def partial_update(self, request, pk=None):
'os_id': result.os.id,
'moderation_id': result.moderation_event.uuid,
'moderation_status': result.moderation_event.status,
'created_at': result.moderation_event.created_at
'created_at': result.moderation_event.created_at,
'cleaned_data': result.moderation_event.cleaned_data,
},
status=result.status_code
)
12 changes: 12 additions & 0 deletions src/react/src/App.css
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,18 @@ hr {
align-items: center;
}

.mobile-dialog-close-button {
border: 2px solid white !important;
border-radius: 50% !important;
color: white !important;
padding: 7px !important;
position: fixed !important;
right: 0;
top: 140px;
margin-right: 48px !important;
z-index: 10000 !important;
}

@media (max-width: 600px) {
.user-profile-title-bar {
flex-direction: column;
Expand Down
25 changes: 22 additions & 3 deletions src/react/src/Routes.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import ContributeProductionLocation from './components/Contribute/ContributeProd
import SearchByOsIdResult from './components/Contribute/SearchByOsIdResult';
import SearchByNameAndAddressResult from './components/Contribute/SearchByNameAndAddressResult';
import ProductionLocationInfo from './components/Contribute/ProductionLocationInfo';
import withProductionLocationSubmit from './components/Contribute/HOC/withProductionLocationSubmit';

import { sessionLogin } from './actions/auth';
import { fetchFeatureFlags } from './actions/featureFlags';
Expand Down Expand Up @@ -60,9 +61,18 @@ import {
contributeProductionLocationRoute,
searchByOsIdResultRoute,
searchByNameAndAddressResultRoute,
productionLocationInfoRoute,
productionLocationInfoRouteCreate,
productionLocationInfoRouteUpdate,
} from './util/constants';

// Pre-wrapping components outside of Routes to prevent redundant re-renders on component mount
const WrappedProductionLocationInfoUpdate = withProductionLocationSubmit(
ProductionLocationInfo,
);
const WrappedProductionLocationInfoCreate = withProductionLocationSubmit(
ProductionLocationInfo,
);

class Routes extends Component {
componentDidMount() {
window.addEventListener('resize', () =>
Expand Down Expand Up @@ -184,8 +194,17 @@ class Routes extends Component {
/>
<Route
exact
path={productionLocationInfoRoute}
component={ProductionLocationInfo}
path={productionLocationInfoRouteUpdate}
component={
WrappedProductionLocationInfoUpdate
}
/>
<Route
exact
path={productionLocationInfoRouteCreate}
component={
WrappedProductionLocationInfoCreate
}
/>
<Route exact path="/about/processing">
<ExternalRedirect
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import renderWithProviders from "../../util/testUtils/renderWithProviders";
import ConfirmNotFoundLocationDialog from "../../components/Contribute/ConfirmNotFoundLocationDialog";
import history from "../../util/history";
import { contributeProductionLocationRoute, productionLocationInfoRoute } from "../../util/constants";
import { contributeProductionLocationRoute, productionLocationInfoRouteCommon } from "../../util/constants";

jest.mock("../../util/history", () => ({
push: jest.fn(),
Expand Down Expand Up @@ -72,9 +72,7 @@ describe("ConfirmNotFoundLocationDialog component", () => {

expect(mockHandleConfirmDialogClose).toHaveBeenCalledTimes(1);
expect(mockClearLocations).toHaveBeenCalledTimes(1);
expect(history.push).toHaveBeenCalledWith(
productionLocationInfoRoute,
);
expect(history.push).toHaveBeenCalledWith(productionLocationInfoRouteCommon);
});

test("closes the dialog when the close button is clicked", () => {
Expand Down
Loading