Skip to content
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

TP2000-1114: React enhanced forms proof of concept #1091

Merged
merged 46 commits into from
Feb 14, 2024
Merged

Conversation

eadpearce
Copy link
Contributor

TP2000-1114: React enhanced forms proof of concept

Why

  • FormSet code in Django is getting to be very complicated and due to the need to submit and refresh the page to add or delete items, makes the UX clunky
  • We are already using FormSets in a way that is not idiomatic for Django. React is better equipped to handle this kind of interactivity on the frontend and can make the UX smoother

What

  • Adds the required npm packages for React support
  • Adds a QuotaOrigins React component that renders a QuotaOriginForm that handles adding/deleting multiple quota origins before data is submitted to the backend for database changes
  • Adds govuk-react to allow the use of govuk styled React form components
  • Adds a custom add_extra_error method to the Django form that allows us to add errors to be passed to the React form which allows us to keep business rules checks and other validation on the backend
  • Data is passed from Django to React with a script tag in the form template
Screenshot 2023-11-14 at 16 35 53 Screenshot 2023-11-14 at 16 36 31

month: data.start_date_1,
year: data.start_date_2,
}}
errorText={originsErrors[`origins-${index}-start_date`]}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was never good at react and haven't done any in a while. Where does originsErrors come from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably should add a comment here explaining. This comes from django and is set in a script tag in the template

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah that makes sense I thought that but hadn't got that far in the review! I guess having some sort of commenting strucutre for components could be good.

Copy link
Contributor

@a-gleeson a-gleeson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of just in the common/js shouldeer we put this in a specific folder for quota's or use a more "react" folder layout

@eadpearce
Copy link
Contributor Author

@a-gleeson I was trying to find an example folder structure in the React docs but couldn't find anything and ended up just winging it. If you've got an example somewhere I can look at that would help a ton

@a-gleeson
Copy link
Contributor

@a-gleeson I was trying to find an example folder structure in the React docs but couldn't find anything and ended up just winging it. If you've got an example somewhere I can look at that would help a ton

I remember using this structure before and it was used in datadub too
https://github.com/uktrade/data-hub-frontend/tree/main/src/client/components

Copy link
Collaborator

@paulpepper-trade paulpepper-trade left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely to be the beginning of a lot more JavaScript in Tamato, so probably a good point at which to introduce a JavaScript linter. It'd also be worth popping a note in the docs about any linting capability that we start using.

)
else:
self.cleaned_data["origins"].append(form.cleaned_data)
return super().clean()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We'd normally call super().clean() at the beginning of the overridden funtion to allow the parent behaviour to do its thing. Probably worth using that convention or otherwise documenting why this is different.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why I'm calling it here at all tbh because the clean method of the django form just returns self.cleaned_data. All the actual cleaning happens in full_clean which we don't generally want to override

quotas/jinja2/includes/quotas/quota-edit-origins.jinja Outdated Show resolved Hide resolved
@codecov-commenter
Copy link

codecov-commenter commented Jan 26, 2024

Codecov Report

Attention: 23 lines in your changes are missing coverage. Please review.

Comparison is base (816b866) 93.08% compared to head (76faafa) 93.09%.

Files Patch % Lines
quotas/views.py 83.33% 6 Missing and 3 partials ⚠️
quotas/forms.py 84.31% 4 Missing and 4 partials ⚠️
quotas/tests/test_forms.py 88.23% 6 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##           master    #1091    +/-   ##
========================================
  Coverage   93.08%   93.09%            
========================================
  Files         576      576            
  Lines       43088    43288   +200     
  Branches     3100     3129    +29     
========================================
+ Hits        40110    40299   +189     
- Misses       2371     2379     +8     
- Partials      607      610     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

quotas/views.py Outdated Show resolved Hide resolved
quotas/forms.py Outdated Show resolved Hide resolved
quotas/views.py Outdated Show resolved Hide resolved
quotas/views.py Outdated Show resolved Hide resolved
@eadpearce eadpearce merged commit c913202 into master Feb 14, 2024
4 checks passed
@eadpearce eadpearce deleted the react-poc branch February 14, 2024 15:32
dougmills-DIT pushed a commit that referenced this pull request Feb 20, 2024
* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test
dougmills-DIT added a commit that referenced this pull request Feb 23, 2024
* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* initial commit - ref doc data model

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* initial commit - ref doc data model

* wip commit

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: A Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>
dougmills-DIT added a commit that referenced this pull request May 8, 2024
* Add reference_documents app

* WIP - Templates >:(

* Get a template of some sort working

* Add reference document detail path and templates

* add date filters to the get_context_data function

* WiP

* Rough commit - working tabs - need cleaning up

* Add button to home form

* Add comm code links to table

* initial commit - ref doc data model

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

* Tp2000 1186 ref doc data model (#1164)

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* initial commit - ref doc data model

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* initial commit - ref doc data model

* wip commit

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* TP2000-1168 Add sub-quota, blocking period & suspension period nested review tabs (#1133)

* Add sub-quotas nested review tab

* Add quota blocking periods nested review tab

* Add quota suspension periods nested review tab

* Use tab title instead of model verbose name

* Add blocking period and suspension period SID to table

* Feat: expand expiring quotas report to include tabs (#1131)

* feat: invoke UI changes to reports and create new URL path to handle reports with multiple tabs (#1134)

* feat: Add both CSV and excel types for charts exporting (#1136)

* TP2000-1185  Add maintenance mode (#1137)

* Add MAINTENANCE_MODE setting and middleware

* Fix middleware removal and recursive redirect

* Add template view and url

* Add tests

* Update contact us form link for other pages

* Update text wording

* Remove database route during maintenance

* Update maintenance page template/url name

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Increment message id & record sequence number correctly (#1083)

* record seq number & message id fix

* fix taricXMLRenderer, pass in value of counter

* feat: implement URLs for quota reports to ease navigation (#1135)

* Update readme with maintenance mode instructions. (#1140)

* TP2000-1130 Move current workbasket from Session to custom User model (#1123)

* Update User model references

* Use custom User model

* TP2000-1152-handling-invalid-workbaskets (#1113)

* Update middleware to check for workbasket changing state

* Update to use decorator rather than middleware, add pytest fixtures

* Update tests that require a session workbasket to run

* Move views and urls to workbasket app and update template

* Add tests for when workbasket status changes

* Tidy up following Pauls comments

* Update models and templates to find workbasket in user model

* Update test fixtures for workbasket being in user model

* Tidy up and test updates

* Update referencing to User model

* Updating bdd tests for new user model

* Add and update view and model unit tests

* Update require_current_workbasket decorator docstring

* Add docstring, move template for NoActiveWorkBasket view

* Amend current workbasket id retrieval in template

* Amend custom User model migration

* Remake migration adding current_workbasket field to User model

* Remove unused ValidateSessionWorkBasketMiddleware

* Make current_workbasket optional

* Add User model to admin

* Use historical models to fix migration tests

* Move ContentType data migration so it may be applied

* Rename function to remove a users current workbasket

* Amend docstrings

* Remove reference to session middleware that is no longer used

* Update workbaskets models following Pauls review

* Bring back user workbasket middleware as extra security

* Move User model from workbaskets app to common app

* Add forgotten content type data migration

* Remove setup_content_type fixture following patch to migrator fixture

* Amend middleware util method name

* Remove uneeded DoesNotExist try except block

---------

Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>

* Bump aiohttp from 3.9.1 to 3.9.2 (#1142)

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.9.1 to 3.9.2.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](aio-libs/aiohttp@v3.9.1...v3.9.2)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update importer model matching to account for end dated objects. (#1146)

* update importer model matching to account for end dated objects.

* update importer model matching to account for end dated objects.

* Tp2000 1211 (#1148)

* update govuk dependency since its been deleted at source

* update govuk dependency since its been deleted at source

* Bump django from 3.2.23 to 3.2.24 (#1150)

Bumps [django](https://github.com/django/django) from 3.2.23 to 3.2.24.
- [Commits](django/django@3.2.23...3.2.24)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Tp2000 652  force rule check after real edit (#1130)

* added a check that if tracked models have been updated since the last checks business rules need run again
* data migration to add timestamps to tracked models and transaction checks
* tests for real edits
* tests for data migrations

* TP2000-1219  Prevent maintenance mode errors (#1152)

* Remove authbroker middleware when in maintenance mode

* Skip applying migrations in init script

* Prevent maintenance mode template attempts to access user attribute on request object

* Update privacy policy link

* Formatting updates and adding end date field to footnote create (#1154)

* TP2000-1114: React enhanced forms proof of concept (#1091)

* Add react

* Start to build origins form in react

* Build quota origin form with initial data

* Enable adding/removing of origins

* Repopulate form initial in case of error on submit

* Pass errors from django to react

* Create origins

* Add aria attribute

* Reinstate geo area descriptions in form

* Organise JS, code comments

* Add key for react list

* Simplify if statement

* Add exclusions formset

* Add jest for react testing

* Amend gitignore

* Fix error re-rendering component after submit fail

* Move state management into top level component

* Pass origin index to exclusions formset

* Submit origin pk

* Update constants.py

* Test form cleaned_data

* Update quota origins to use with_latest_description

* Use description from annotated query

* Update origins and add test

* Update origin exclusions

* Don't remove empty data

* Fix exclusions not pre-populating

* Add jest snapshot tests

* Add react tests

* Add jest tests to github actions

* Fix query not returning origin exclusions

* Fix disabled widget error

* Fix origins no longer being linked to quota when order number updated

* Update tests for workbasket change

* Add tests for add_extra_error form method

* Fix incorrect exclusion being removed

* Clean up babel config

* Remove unused field

* Create exclusions for updated and new origins

* Make sure exclusions are updated/deleted

* Move current() queryset into init

* Fix geographical area invalid choice error in test

* Move babel packages out of dev deps (#1155)

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* wip commit

* initial commit - ref doc data model

* wip commit

* initial commit - ref doc data model

* wip commit

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* added alignment report, reference document and reference document version views, refactored the checks and ran the checks several times against reference document versions.

* prep for merge to mega branch

* prep for merge to mega branch

* prep for merge to mega branch

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: A Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>

* prep for merge to mega branch

* Add command to import duties and quotas

* Add command to import duties and quotas

* Functionality to edit reference documents

* CRUD templates

* Reference Doc CRUD

* Add factories, add editing for rates - still WIP but working

* Add factories, add editing for rates - still WIP but working

* Add factories, add editing for rates - still WIP but working

* TP2000-1232 Reference doc UI management (#1165)

* Functionality to edit reference documents

* CRUD templates

* Reference Doc CRUD

* fixed time zone issue with factories.py

* Create update form tests

* fixed time zone issue with factories.py

* add basic tests for models

* add basic tests for models

* Add test init files

* View and form tests for ref doc crud

* Remove init files

* Add reference doc form and view tests

* Move get_area_name_by_id to model

* add basic tests for models

* add basic tests for models

* add basic tests for models

* update edit quota view

* fix views

* Ref doc versions create and edit urls/templates

* Ref doc formatting tidy up

* Ref doc versions create and edit views/form

* fix views

* fix views

* Update ref doc create breadcrumbs

* Ref doc version delete

* Delete ref doc version and confirmation pages

* Area ID and version form validation

* update data

* Ref doc versions form and view tests

* Add model test for get_area_name_by_id

* Update data model

* Preferential rate style and consistency tidy

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* separate out the context from reference document version details

* Pref quota bulk create base

* add / edit order number

* Bulk add preferential quotas for a commodity code list

* add / edit order number

* Bulk create quotas for multiple validity period volume combos

* WIP commit - quota and order number updates

* WIP commit - quota and order number updates

* quota and order number views + test fixes

* quota and order number views + test fixes

* Bulk create quotas redo without validityperiodform

* test fixes

* Add js remove button to additional quota definition forms

* tested quota order number and quota forms

* Preferential quota bulk create tests

* Content standardisations

* Add preferential quota bulk create for specific order numbers

* models 100% tested, forms 100% tested

* models 100% tested, forms 100% tested

* Ref doc and versions view tests

* added more tests

* added more tests

* tidy up for PR

* tidy up for PR

* Stop add new button submitting form when js is disabled

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* tidy up for PR

* content corrections

* content corrections

* fixes for breadcrumbs

* fixes for breadcrumbs

* minor fix

* minor text changes

* updates to ref doc data import management command

* Test fixes after content change

* Updates from Dale's review

* updated based on PR comments

* updated based on PR comments

* updated js based on linting issues

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: Lauren Qurashi <lauren.qurashi@digital.trade.gov.uk>
Co-authored-by: Anthoni Gleeson <anthoni.gleeson@digital.trade.gov.uk>
Co-authored-by: Dale Cannon <118175145+dalecannon@users.noreply.github.com>
Co-authored-by: Tash Boyse <57753415+nboyse@users.noreply.github.com>
Co-authored-by: Matthew McKenzie <97194636+mattjamc@users.noreply.github.com>
Co-authored-by: Dale Cannon <dale.cannon@digital.trade.gov.uk>
Co-authored-by: Paul Pepper <85895113+paulpepper-trade@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Edie Pearce <edie.pearce@digital.trade.gov.uk>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants