Skip to content
Snippets Groups Projects
Unverified Commit d29867e0 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Add custom warning message when leaving changing Data Model (segments and metrics) (#34398)

* Rename component to match the filename

* Fix typo

* Replace useBeforeUnload with LeaveConfirmationModal in SegmentForm

* Replace useBeforeUnload with LeaveConfirmationModal in MetricForm

* Update setup of MetricForm tests to allow testing navigation

* Update setup of SegmentForm tests to allow testing navigation

* Use proper history in MetricForm

* Refactor SegmentForm test setup to be consistent with the one of MetricForm

* Make MetricForm and SegmentForm tests consistent

* Add tests for not showing custom warning

* Add tests for showing custom warning when leaving with unsaved changes

* Extract FORM_URL

* Remove redundant asyncs and awaits

* Rename MetricForm.unit.spec.tsx & SegmentForm.unit.spec.tsx to MetricApp.unit.spec.tsx & SegmentApp.unit.spec.tsx and move them near the components they're testing

* Improve a11y

* Add missing endpoint mocks

* Improve selectors thanks to proper a11y

* Add tests for not showing warning modal when saving changes

* Convert CreateMetricForm to a functional component

* Convert CreateSegmentForm to a functional component

* Convert UpdateMetricFormInner to a functional component

* Convert UpdateSegmentFormInner to a functional component

* Disable LeaveConfirmationModal on scheduled navigation

* Setup metrics & segments POST endpoints

* Properly mock metric and segment creation

* Lift LeaveConfirmationModal from SegmentForm to SegmentApp

* Lift LeaveConfirmationModal from MetricForm to MetricApp

* Sort props

* Get rid of useCallbackEffect usage in MetricApp

* Get rid of useCallbackEffect usage in SegmentApp
parent 20c6fccc
No related branches found
No related tags found
No related merge requests found
Showing
with 517 additions and 202 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment