diff --git a/.github/workflows/retag-test-to-uat.yml b/.github/workflows/retag-test-to-uat.yml index 8ddb14780c..280511f7d4 100644 --- a/.github/workflows/retag-test-to-uat.yml +++ b/.github/workflows/retag-test-to-uat.yml @@ -21,7 +21,7 @@ env: TAG_DEV: "dev" TAG_TEST: "test" TAG_PROD: "prod" - INSTANCE: "-test" + INSTANCE: "-uat" NAMESPACE_OVERRIDE: "3cd915-test" RELEASE_TAG: "test" diff --git a/source/frontend/src/features/leases/add/AddLeaseContainer.tsx b/source/frontend/src/features/leases/add/AddLeaseContainer.tsx index fca4c97597..71c3600692 100644 --- a/source/frontend/src/features/leases/add/AddLeaseContainer.tsx +++ b/source/frontend/src/features/leases/add/AddLeaseContainer.tsx @@ -96,7 +96,7 @@ export const AddLeaseContainer: React.FunctionComponent< isOkDisabled={formikRef.current?.isSubmitting || bcaLoading} onSave={handleSave} onCancel={handleCancel} - isValid={isValid} + displayRequiredFieldError={isValid === false} /> } showCloseButton diff --git a/source/frontend/src/features/mapSideBar/acquisition/AcquisitionView.tsx b/source/frontend/src/features/mapSideBar/acquisition/AcquisitionView.tsx index 6d6f2cd655..0c252e05f6 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/AcquisitionView.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/AcquisitionView.tsx @@ -34,7 +34,7 @@ import { FilePropertyRouter } from './router/FilePropertyRouter'; export interface IAcquisitionViewProps { onClose: (() => void) | undefined; - onSave: () => void; + onSave: () => Promise; onCancel: () => void; onMenuChange: (selectedIndex: number) => void; onShowPropertySelector: () => void; @@ -137,7 +137,7 @@ export const AcquisitionView: React.FunctionComponent = ( isOkDisabled={formikRef?.current?.isSubmitting} onSave={onSave} onCancel={onCancel} - isValid={isFormValid} + displayRequiredFieldError={isFormValid === false} /> ) } diff --git a/source/frontend/src/features/mapSideBar/acquisition/add/AddAcquisitionContainer.tsx b/source/frontend/src/features/mapSideBar/acquisition/add/AddAcquisitionContainer.tsx index fe2a28202a..5ad22a9827 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/add/AddAcquisitionContainer.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/add/AddAcquisitionContainer.tsx @@ -106,7 +106,7 @@ export const AddAcquisitionContainer: React.FC = isOkDisabled={helper.loading} onSave={handleSave} onCancel={close} - isValid={isValid} + displayRequiredFieldError={isValid === false} /> } > diff --git a/source/frontend/src/features/mapSideBar/acquisition/tabs/compensation/update/UpdateCompensationRequisitionForm.tsx b/source/frontend/src/features/mapSideBar/acquisition/tabs/compensation/update/UpdateCompensationRequisitionForm.tsx index 88db5a691c..11d1829b91 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/tabs/compensation/update/UpdateCompensationRequisitionForm.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/tabs/compensation/update/UpdateCompensationRequisitionForm.tsx @@ -324,7 +324,7 @@ const UpdateCompensationRequisitionForm: React.FC cancelFunc(formikProps.resetForm, formikProps.dirty)} - isValid={isValid} + displayRequiredFieldError={isValid === false} /> diff --git a/source/frontend/src/features/mapSideBar/acquisition/tabs/expropriation/form8/UpdateForm8Form.tsx b/source/frontend/src/features/mapSideBar/acquisition/tabs/expropriation/form8/UpdateForm8Form.tsx index 8f23b73d0b..14a61fd8ef 100644 --- a/source/frontend/src/features/mapSideBar/acquisition/tabs/expropriation/form8/UpdateForm8Form.tsx +++ b/source/frontend/src/features/mapSideBar/acquisition/tabs/expropriation/form8/UpdateForm8Form.tsx @@ -115,6 +115,9 @@ export const UpdateForm8Form: React.FC = ({ onSave={() => formikProps.submitForm()} isOkDisabled={formikProps.isSubmitting || !formikProps.dirty} onCancel={() => cancelFunc(formikProps.resetForm, formikProps.dirty)} + displayRequiredFieldError={ + formikProps.isValid === false && !!formikProps.submitCount + } /> diff --git a/source/frontend/src/features/mapSideBar/lease/LeaseContainer.tsx b/source/frontend/src/features/mapSideBar/lease/LeaseContainer.tsx index 88d5b4ee20..9f761f492b 100644 --- a/source/frontend/src/features/mapSideBar/lease/LeaseContainer.tsx +++ b/source/frontend/src/features/mapSideBar/lease/LeaseContainer.tsx @@ -216,7 +216,7 @@ export const LeaseContainer: React.FC = ({ leaseId, onClos isOkDisabled={formikRef?.current?.isSubmitting} onSave={handleSaveClick} onCancel={handleCancelClick} - isValid={isValid} + displayRequiredFieldError={isValid === false && !!formikRef.current?.submitCount} /> ) } diff --git a/source/frontend/src/features/mapSideBar/project/ProjectContainer.tsx b/source/frontend/src/features/mapSideBar/project/ProjectContainer.tsx index 85b9689f15..4f715d1b6c 100644 --- a/source/frontend/src/features/mapSideBar/project/ProjectContainer.tsx +++ b/source/frontend/src/features/mapSideBar/project/ProjectContainer.tsx @@ -21,6 +21,8 @@ export interface IProjectContainerViewProps { onClose: () => void; onSetProject: (project: Api_Project) => void; onSuccess: () => void; + setIsValid: (value: boolean) => void; + displayRequiredFieldsError: boolean; } export interface IProjectContainerProps { @@ -74,6 +76,8 @@ const ProjectContainer: React.FunctionComponent< getProject: { execute: getProject, loading: loadingProject }, } = useProjectProvider(); + const [isValid, setIsValid] = useState(false); + const [containerState, setContainerState] = useReducer( (prevState: ProjectContainerState, newState: Partial) => ({ ...prevState, @@ -117,6 +121,8 @@ const ProjectContainer: React.FunctionComponent< onSetProject={setProject} onClose={onClose} onSuccess={onSuccess} + setIsValid={setIsValid} + displayRequiredFieldsError={containerState.isSubmitting && !isValid} /> ); }; diff --git a/source/frontend/src/features/mapSideBar/project/ProjectContainerView.test.tsx b/source/frontend/src/features/mapSideBar/project/ProjectContainerView.test.tsx index 193e476834..191a19ec1e 100644 --- a/source/frontend/src/features/mapSideBar/project/ProjectContainerView.test.tsx +++ b/source/frontend/src/features/mapSideBar/project/ProjectContainerView.test.tsx @@ -20,6 +20,8 @@ const mockProps: IProjectContainerViewProps = { onSetProject: jest.fn(), onSetContainerState: jest.fn(), onSuccess: jest.fn(), + setIsValid: jest.fn(), + displayRequiredFieldsError: false, }; describe('ProjectSummaryView component', () => { diff --git a/source/frontend/src/features/mapSideBar/project/ProjectContainerView.tsx b/source/frontend/src/features/mapSideBar/project/ProjectContainerView.tsx index 2332fbff70..98c754a2d0 100644 --- a/source/frontend/src/features/mapSideBar/project/ProjectContainerView.tsx +++ b/source/frontend/src/features/mapSideBar/project/ProjectContainerView.tsx @@ -19,20 +19,23 @@ const ProjectContainerView: React.FC = ({ activeTab, isEditing, showConfirmModal, - isSubmitting, + displayRequiredFieldsError, onClose, onSetProject, onSetContainerState, onSuccess, + setIsValid, }) => { const close = useCallback(() => onClose && onClose(), [onClose]); const handleSaveClick = () => { if (formikRef !== undefined) { + setIsValid(formikRef.current?.isValid ?? false); onSetContainerState({ isSubmitting: true }); formikRef.current?.setSubmitting(true); - formikRef.current?.submitForm(); + return formikRef.current?.submitForm() ?? Promise.resolve(); } + return Promise.resolve(); }; const formikRef = useRef>(null); @@ -77,6 +80,7 @@ const ProjectContainerView: React.FC = ({ isOkDisabled={false} onSave={handleSaveClick} onCancel={handleCancelClick} + displayRequiredFieldError={displayRequiredFieldsError} /> ) } diff --git a/source/frontend/src/features/mapSideBar/project/add/AddProjectContainer.tsx b/source/frontend/src/features/mapSideBar/project/add/AddProjectContainer.tsx index b4ad7940c1..979072e14c 100644 --- a/source/frontend/src/features/mapSideBar/project/add/AddProjectContainer.tsx +++ b/source/frontend/src/features/mapSideBar/project/add/AddProjectContainer.tsx @@ -32,6 +32,7 @@ const AddProjectContainer: React.FC([]); const [costTypes, setCostTypes] = useState([]); const [workActivities, setWorkActivities] = useState([]); + const [isValid, setIsValid] = useState(true); useEffect(() => { async function fetchBusinessFunctions() { @@ -76,8 +77,10 @@ const AddProjectContainer: React.FC onClose && onClose(), [onClose]); - const handleSave = () => { - formikRef.current?.submitForm(); + const handleSave = async () => { + var result = await (formikRef.current?.submitForm() ?? Promise.resolve()); + setIsValid(formikRef.current?.isValid ?? false); + return result; }; const onSuccess = async (proj: Api_Project) => { @@ -93,7 +96,9 @@ const AddProjectContainer: React.FC} onClose={close} - footer={} + footer={ + + } > , IAddProjectFor } = props; const handleSubmit = async (values: ProjectForm, formikHelpers: FormikHelpers) => { - await onSubmit(values, formikHelpers); + var result = await onSubmit(values, formikHelpers); formikHelpers.setSubmitting(false); + return result; }; return ( diff --git a/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap b/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap index 034fcd3c1b..ef8a1f86b6 100644 --- a/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap +++ b/source/frontend/src/features/mapSideBar/project/add/__snapshots__/AddProjectContainer.test.tsx.snap @@ -680,7 +680,7 @@ exports[`AddProjectContainer component renders as expected 1`] = ` - .c2.btn { + .c1.btn { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -710,49 +710,49 @@ exports[`AddProjectContainer component renders as expected 1`] = ` cursor: pointer; } -.c2.btn:hover { +.c1.btn:hover { -webkit-text-decoration: underline; text-decoration: underline; opacity: 0.8; } -.c2.btn:focus { +.c1.btn:focus { outline-width: 0.4rem; outline-style: solid; outline-offset: 1px; box-shadow: none; } -.c2.btn.btn-primary { +.c1.btn.btn-primary { border: none; } -.c2.btn.btn-secondary { +.c1.btn.btn-secondary { background: none; } -.c2.btn.btn-info { +.c1.btn.btn-info { border: none; background: none; padding-left: 0.6rem; padding-right: 0.6rem; } -.c2.btn.btn-info:hover, -.c2.btn.btn-info:active, -.c2.btn.btn-info:focus { +.c1.btn.btn-info:hover, +.c1.btn.btn-info:active, +.c1.btn.btn-info:focus { background: none; } -.c2.btn.btn-light { +.c1.btn.btn-light { border: none; } -.c2.btn.btn-dark { +.c1.btn.btn-dark { border: none; } -.c2.btn.btn-link { +.c1.btn.btn-link { font-size: 1.6rem; font-weight: 400; background: none; @@ -773,9 +773,9 @@ exports[`AddProjectContainer component renders as expected 1`] = ` padding: 0; } -.c2.btn.btn-link:hover, -.c2.btn.btn-link:active, -.c2.btn.btn-link:focus { +.c1.btn.btn-link:hover, +.c1.btn.btn-link:active, +.c1.btn.btn-link:focus { -webkit-text-decoration: underline; text-decoration: underline; border: none; @@ -784,14 +784,14 @@ exports[`AddProjectContainer component renders as expected 1`] = ` outline: none; } -.c2.btn.btn-link:disabled, -.c2.btn.btn-link.disabled { +.c1.btn.btn-link:disabled, +.c1.btn.btn-link.disabled { background: none; pointer-events: none; } -.c2.btn:disabled, -.c2.btn:disabled:hover { +.c1.btn:disabled, +.c1.btn:disabled:hover { box-shadow: none; -webkit-user-select: none; -moz-user-select: none; @@ -802,15 +802,15 @@ exports[`AddProjectContainer component renders as expected 1`] = ` opacity: 0.65; } -.c2.Button .Button__icon { +.c1.Button .Button__icon { margin-right: 1.6rem; } -.c2.Button--icon-only:focus { +.c1.Button--icon-only:focus { outline: none; } -.c2.Button--icon-only .Button__icon { +.c1.Button--icon-only .Button__icon { margin-right: 0; } @@ -823,11 +823,6 @@ exports[`AddProjectContainer component renders as expected 1`] = ` z-index: 10; } -.c1 { - padding-top: 0.7rem; - color: red; -} -
@@ -836,18 +831,12 @@ exports[`AddProjectContainer component renders as expected 1`] = ` >
-
- Please check the required fields. -
-
+ />
- .c2.btn { + .c1.btn { display: -webkit-box; display: -webkit-flex; display: -ms-flexbox; @@ -1232,49 +1232,49 @@ exports[`AddResearchContainer component renders as expected 1`] = ` cursor: pointer; } -.c2.btn:hover { +.c1.btn:hover { -webkit-text-decoration: underline; text-decoration: underline; opacity: 0.8; } -.c2.btn:focus { +.c1.btn:focus { outline-width: 0.4rem; outline-style: solid; outline-offset: 1px; box-shadow: none; } -.c2.btn.btn-primary { +.c1.btn.btn-primary { border: none; } -.c2.btn.btn-secondary { +.c1.btn.btn-secondary { background: none; } -.c2.btn.btn-info { +.c1.btn.btn-info { border: none; background: none; padding-left: 0.6rem; padding-right: 0.6rem; } -.c2.btn.btn-info:hover, -.c2.btn.btn-info:active, -.c2.btn.btn-info:focus { +.c1.btn.btn-info:hover, +.c1.btn.btn-info:active, +.c1.btn.btn-info:focus { background: none; } -.c2.btn.btn-light { +.c1.btn.btn-light { border: none; } -.c2.btn.btn-dark { +.c1.btn.btn-dark { border: none; } -.c2.btn.btn-link { +.c1.btn.btn-link { font-size: 1.6rem; font-weight: 400; background: none; @@ -1295,9 +1295,9 @@ exports[`AddResearchContainer component renders as expected 1`] = ` padding: 0; } -.c2.btn.btn-link:hover, -.c2.btn.btn-link:active, -.c2.btn.btn-link:focus { +.c1.btn.btn-link:hover, +.c1.btn.btn-link:active, +.c1.btn.btn-link:focus { -webkit-text-decoration: underline; text-decoration: underline; border: none; @@ -1306,14 +1306,14 @@ exports[`AddResearchContainer component renders as expected 1`] = ` outline: none; } -.c2.btn.btn-link:disabled, -.c2.btn.btn-link.disabled { +.c1.btn.btn-link:disabled, +.c1.btn.btn-link.disabled { background: none; pointer-events: none; } -.c2.btn:disabled, -.c2.btn:disabled:hover { +.c1.btn:disabled, +.c1.btn:disabled:hover { box-shadow: none; -webkit-user-select: none; -moz-user-select: none; @@ -1324,15 +1324,15 @@ exports[`AddResearchContainer component renders as expected 1`] = ` opacity: 0.65; } -.c2.Button .Button__icon { +.c1.Button .Button__icon { margin-right: 1.6rem; } -.c2.Button--icon-only:focus { +.c1.Button--icon-only:focus { outline: none; } -.c2.Button--icon-only .Button__icon { +.c1.Button--icon-only .Button__icon { margin-right: 0; } @@ -1345,11 +1345,6 @@ exports[`AddResearchContainer component renders as expected 1`] = ` z-index: 10; } -.c1 { - padding-top: 0.7rem; - color: red; -} -
@@ -1358,18 +1353,12 @@ exports[`AddResearchContainer component renders as expected 1`] = ` >
-
- Please check the required fields. -
-
+ />