From 5e72328816858db82e50f241798a85da405e1b63 Mon Sep 17 00:00:00 2001 From: gregorylavery <100631366+gregorylavery@users.noreply.github.com> Date: Thu, 3 Oct 2024 15:26:51 -0700 Subject: [PATCH 01/25] fix: Ce 478 (#685) Co-authored-by: Barrett Falk Co-authored-by: dmitri-korin-bcps <108112696+dmitri-korin-bcps@users.noreply.github.com> Co-authored-by: Scarlett <35635257+Scarlett-Truong@users.noreply.github.com> Co-authored-by: Mike <100624415+marqueone-ps@users.noreply.github.com> Co-authored-by: Mike Sears Co-authored-by: jeznorth Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: afwilcox Co-authored-by: Scarlett --- .../complaints/details/complaint-details-edit.tsx | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx b/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx index 12e74b885..75ab31ca4 100644 --- a/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx +++ b/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx @@ -144,9 +144,9 @@ export const ComplaintDetailsEdit: FC = () => { let assignableOfficers: Option[] = officersInAgencyList !== null ? officersInAgencyList.map((officer: Officer) => ({ - value: officer.person_guid.person_guid, - label: `${officer.person_guid.last_name}, ${officer.person_guid.first_name}`, - })) + value: officer.person_guid.person_guid, + label: `${officer.person_guid.last_name}, ${officer.person_guid.first_name}`, + })) : []; assignableOfficers.unshift({ value: "Unassigned", label: "None" }); @@ -286,6 +286,9 @@ export const ComplaintDetailsEdit: FC = () => { cancelConfirmed: resetErrorMessages, }, hideCallback: () => { + // Set these values back to the originally saved values as this is a 'cancel pending changes' action + setLongitude(getEditableCoordinates(coordinates, Coordinates.Longitude)); + setLatitude(getEditableCoordinates(coordinates, Coordinates.Latitude)); window.scrollTo({ top: 0, behavior: "smooth" }); }, }), From da3a597bac265e1fe2160d497c01edd5dcc75fc3 Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Thu, 3 Oct 2024 16:28:38 -0700 Subject: [PATCH 02/25] chore(CE-1118): CE-1118 Add Ryan as officer for test and prod (#689) --- migrations/migrations/R__Create-Test-Data.sql | 52 +++++++++++++++++++ .../R__Test-Data-Creation.sql | 11 +++- 2 files changed, 61 insertions(+), 2 deletions(-) diff --git a/migrations/migrations/R__Create-Test-Data.sql b/migrations/migrations/R__Create-Test-Data.sql index d2dd0a9c2..48de3c9bf 100644 --- a/migrations/migrations/R__Create-Test-Data.sql +++ b/migrations/migrations/R__Create-Test-Data.sql @@ -1637,6 +1637,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.person ( + person_guid, + first_name, + middle_name_1, + middle_name_2, + last_name, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, + 'Ryan', + NULL, + NULL, + 'Rondeau', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:16:16.754' + ) ON CONFLICT +DO NOTHING; + ------------------------- -- INSERT OFFICER RECORDS ------------------------- @@ -2285,6 +2311,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.officer ( + officer_guid, + user_id, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp, + person_guid, + office_guid, + auth_user_guid + ) +VALUES + ( + '06ff894b-3895-4d32-8a4a-1fcc0be23e47'::uuid, + 'RRONDEAU', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:20:48.186', + '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, + 'c3d8519c-73cb-48a1-8058-358883d5ef4f'::uuid, + '77c6040d69b74757903f1cba37404db4'::uuid + ) ON CONFLICT +DO NOTHING; + -- Reset offices to nr-compliance-enforcement values UPDATE public.officer SET diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index aa20e1241..de6fdb14b 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -183,7 +183,6 @@ INSERT INTO public.office VALUES('9fc7327b-b206-4a5c-88f1-2875a456eb49'::uuid, 'nr-compliance-enforcement', '2023-06-29 22:16:16.754', 'nr-compliance-enforcement', '2023-06-29 22:16:16.754', 'WLMSLK', 'COS') ON CONFLICT DO NOTHING; - ------------------------- -- Insert PERSON records ------------------------- @@ -320,7 +319,10 @@ INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('17439e37-ca97-4031-a009-b23ca58c21e1'::uuid, 'Jeremy', NULL, NULL, 'Dunsdon', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') ON CONFLICT DO NOTHING; - +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, 'Ryan', NULL, NULL, 'Rondeau', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') +ON CONFLICT DO NOTHING; ------------------------- -- INSERT OFFICER RECORDS @@ -454,6 +456,10 @@ INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid) VALUES('623fbd02-dff5-4d45-9ab3-f0acbe8d83ed'::uuid, 'JXDUNSDO', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '17439e37-ca97-4031-a009-b23ca58c21e1'::uuid, '5128179c-f622-499b-b8e5-b39199081f22'::uuid) ON CONFLICT DO NOTHING; +INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) +VALUES('06ff894b-3895-4d32-8a4a-1fcc0be23e47'::uuid, 'RRONDEAU', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '77c6040d69b74757903f1cba37404db4'::uuid) +ON CONFLICT DO NOTHING; -------------------------------- --- Scatter our team throughout the province for testing --- Note that this script runs after the seed data script (which runs in prod) and moves us out of COSH @@ -472,6 +478,7 @@ UPDATE public.officer SET office_guid = '313f4ec3-e88a-41c2-9956-78c7b18cb71d' W UPDATE public.officer SET office_guid = 'db343458-8eca-42c2-91ec-070b3e6de663' WHERE user_id='TSPRADO'; UPDATE public.officer SET office_guid = 'db343458-8eca-42c2-91ec-070b3e6de663' WHERE user_id='M2SEARS'; UPDATE public.officer SET office_guid = '79fe321b-7716-413f-b878-c5fd6100317d' WHERE user_id='GRLAVERY'; +UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='RRONDEAU'; ------------------------- -- INSERT COMPLAINT RECORDS From da5087f7744ba2fa452e39fbc3c0dfb798db653a Mon Sep 17 00:00:00 2001 From: jon-funk Date: Fri, 4 Oct 2024 10:24:57 -0700 Subject: [PATCH 03/25] chore(CE-1118): add Jon as officer to test and prod data (#688) --- migrations/migrations/R__Create-Test-Data.sql | 52 +++++++++++++++++++ .../R__Test-Data-Creation.sql | 9 ++++ 2 files changed, 61 insertions(+) diff --git a/migrations/migrations/R__Create-Test-Data.sql b/migrations/migrations/R__Create-Test-Data.sql index 48de3c9bf..c00fe3291 100644 --- a/migrations/migrations/R__Create-Test-Data.sql +++ b/migrations/migrations/R__Create-Test-Data.sql @@ -1140,6 +1140,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.person ( + person_guid, + first_name, + middle_name_1, + middle_name_2, + last_name, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + '97f3cee5-6f4a-410f-810f-d431595fccee'::uuid, + 'Jonathan', + NULL, + NULL, + 'Funk', + 'FLYWAY', + '2023-06-29 22:16:16.754', + 'FLYWAY', + '2023-06-29 22:16:16.754' + ) ON CONFLICT +DO NOTHING; + INSERT INTO public.person ( person_guid, @@ -1876,6 +1902,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.officer ( + officer_guid, + user_id, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp, + person_guid, + office_guid, + auth_user_guid + ) +VALUES + ( + 'b17ee2c1-a26b-4911-ac6f-810b8fdfaab3'::uuid, + 'JFUNK', + 'FLYWAY', + '2023-06-29 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:20:48.186', + '97f3cee5-6f4a-410f-810f-d431595fccee'::uuid, + 'c3d8519c-73cb-48a1-8058-358883d5ef4f'::uuid, + 'f896cbb2d5254e54a4ad581dc80681d1'::uuid + ) ON CONFLICT +DO NOTHING; + INSERT INTO public.officer ( officer_guid, diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index de6fdb14b..ef92d3951 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -321,6 +321,10 @@ VALUES('17439e37-ca97-4031-a009-b23ca58c21e1'::uuid, 'Jeremy', NULL, NULL, 'Duns ON CONFLICT DO NOTHING; INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('97f3cee5-6f4a-410f-810f-d431595fccee'::uuid, 'Jonathan', NULL, NULL, 'Funk', 'FLYWAY', '2023-06-29 22:16:16.754', 'FLYWAY', '2023-06-29 22:16:16.754') +ON CONFLICT DO NOTHING; +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, 'Ryan', NULL, NULL, 'Rondeau', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') ON CONFLICT DO NOTHING; @@ -458,6 +462,10 @@ VALUES('623fbd02-dff5-4d45-9ab3-f0acbe8d83ed'::uuid, 'JXDUNSDO', 'FLYWAY', '2024 ON CONFLICT DO NOTHING; INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) +VALUES('b17ee2c1-a26b-4911-ac6f-810b8fdfaab3'::uuid, 'JFUNK', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '97f3cee5-6f4a-410f-810f-d431595fccee'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, 'f896cbb2d5254e54a4ad581dc80681d1'::uuid) +ON CONFLICT DO NOTHING; +INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) VALUES('06ff894b-3895-4d32-8a4a-1fcc0be23e47'::uuid, 'RRONDEAU', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '77c6040d69b74757903f1cba37404db4'::uuid) ON CONFLICT DO NOTHING; -------------------------------- @@ -478,6 +486,7 @@ UPDATE public.officer SET office_guid = '313f4ec3-e88a-41c2-9956-78c7b18cb71d' W UPDATE public.officer SET office_guid = 'db343458-8eca-42c2-91ec-070b3e6de663' WHERE user_id='TSPRADO'; UPDATE public.officer SET office_guid = 'db343458-8eca-42c2-91ec-070b3e6de663' WHERE user_id='M2SEARS'; UPDATE public.officer SET office_guid = '79fe321b-7716-413f-b878-c5fd6100317d' WHERE user_id='GRLAVERY'; +UPDATE public.officer SET office_guid = '9fc7327b-b206-4a5c-88f1-2875a456eb49' WHERE user_id='JFUNK'; UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='RRONDEAU'; ------------------------- From 94f9304274f51467c3b75b016d9155a2303e112d Mon Sep 17 00:00:00 2001 From: Mike Vesprini <11034827+mikevespi@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:43:59 -0700 Subject: [PATCH 04/25] chore: CE 1119 add Mike to users (#690) Co-authored-by: barrfalk --- migrations/migrations/R__Create-Test-Data.sql | 53 +++++++++++++++++++ .../R__Test-Data-Creation.sql | 10 ++++ 2 files changed, 63 insertions(+) diff --git a/migrations/migrations/R__Create-Test-Data.sql b/migrations/migrations/R__Create-Test-Data.sql index c00fe3291..6568b672b 100644 --- a/migrations/migrations/R__Create-Test-Data.sql +++ b/migrations/migrations/R__Create-Test-Data.sql @@ -1296,6 +1296,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.person ( + person_guid, + first_name, + middle_name_1, + middle_name_2, + last_name, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + '141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, + 'Mike', + NULL, + NULL, + 'Vesprini', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:16:16.754' + ) ON CONFLICT +DO NOTHING; + INSERT INTO public.person ( person_guid, @@ -2024,6 +2050,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.officer ( + officer_guid, + user_id, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp, + person_guid, + office_guid, + auth_user_guid + ) +VALUES + ( + '44123934-a2cf-4eae-88af-f682f7548f89'::uuid, + 'MVESPRIN', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:20:48.186', + '141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, + 'c3d8519c-73cb-48a1-8058-358883d5ef4f'::uuid, + '01a5ad69-0675-4359-a0a7-909f55e2c67a'::uuid + ) ON CONFLICT +DO NOTHING; + INSERT INTO public.officer ( officer_guid, @@ -9591,6 +9643,7 @@ UPDATE feature_agency_xref SET active_ind = false WHERE feature_code = 'METH_FLT UPDATE feature_agency_xref SET active_ind = false WHERE feature_code = 'METH_FLTR' AND agency_code = 'PARKS'; UPDATE feature_agency_xref SET active_ind = true WHERE feature_code = 'METH_FLTR' AND agency_code = 'EPO'; + -------------------------- -- New Changes above this line ------------------------- diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index ef92d3951..6633bad60 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -327,6 +327,10 @@ INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, 'Ryan', NULL, NULL, 'Rondeau', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') ON CONFLICT DO NOTHING; +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, 'Mike', NULL, NULL, 'Vesprini', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') +ON CONFLICT DO NOTHING; ------------------------- -- INSERT OFFICER RECORDS @@ -468,6 +472,11 @@ INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) VALUES('06ff894b-3895-4d32-8a4a-1fcc0be23e47'::uuid, 'RRONDEAU', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '77c6040d69b74757903f1cba37404db4'::uuid) ON CONFLICT DO NOTHING; +INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) +VALUES('44123934-a2cf-4eae-88af-f682f7548f89'::uuid, 'MVESPRIN', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '01a5ad69-0675-4359-a0a7-909f55e2c67a'::uuid) +ON CONFLICT DO NOTHING; + -------------------------------- --- Scatter our team throughout the province for testing --- Note that this script runs after the seed data script (which runs in prod) and moves us out of COSH @@ -488,6 +497,7 @@ UPDATE public.officer SET office_guid = 'db343458-8eca-42c2-91ec-070b3e6de663' W UPDATE public.officer SET office_guid = '79fe321b-7716-413f-b878-c5fd6100317d' WHERE user_id='GRLAVERY'; UPDATE public.officer SET office_guid = '9fc7327b-b206-4a5c-88f1-2875a456eb49' WHERE user_id='JFUNK'; UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='RRONDEAU'; +UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='MVESPRIN'; ------------------------- -- INSERT COMPLAINT RECORDS From 043c1e73bd4380a6fd30ede6c3e3f54a5d522c61 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Tue, 8 Oct 2024 12:40:22 -0700 Subject: [PATCH 05/25] feat: CE-750 Display Current Date in Filter when only one date selected (#697) --- .../containers/complaints/complaint-filter-bar.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx b/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx index 9c253d1a5..f0ad8dd28 100644 --- a/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx +++ b/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx @@ -44,12 +44,13 @@ export const ComplaintFilterBar: FC = ({ } = state; const dateRangeLabel = (): string | undefined => { + const currentDate = new Date().toLocaleDateString(); if (startDate !== null && endDate !== null) { return `${startDate?.toLocaleDateString()} - ${endDate?.toLocaleDateString()}`; } else if (startDate !== null) { - return `${startDate?.toLocaleDateString()} - `; + return `${startDate?.toLocaleDateString()} - ${currentDate}`; } else if (endDate !== null) { - return ` - ${endDate?.toLocaleDateString()}`; + return `${currentDate} - ${endDate?.toLocaleDateString()}`; } else { return undefined; } From 343bf71a7dae94e902e6fe14f50d1461ab9ea9be Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Tue, 8 Oct 2024 15:13:42 -0700 Subject: [PATCH 06/25] chore(CE-535): Refactor ValidationInput and ValidationSelect to use CompInput and CompSelect (#696) Co-authored-by: afwilcox --- frontend/src/app/common/validation-input.tsx | 50 ------------- frontend/src/app/common/validation-select.tsx | 44 ------------ .../src/app/components/common/comp-input.tsx | 2 +- .../details/complaint-details-create.tsx | 70 ++++++++++--------- .../details/complaint-details-edit.tsx | 60 ++++++++-------- 5 files changed, 69 insertions(+), 157 deletions(-) delete mode 100644 frontend/src/app/common/validation-input.tsx delete mode 100644 frontend/src/app/common/validation-select.tsx diff --git a/frontend/src/app/common/validation-input.tsx b/frontend/src/app/common/validation-input.tsx deleted file mode 100644 index 5216cc888..000000000 --- a/frontend/src/app/common/validation-input.tsx +++ /dev/null @@ -1,50 +0,0 @@ -import { FC } from "react"; - -interface ValidationInputProps { - className: string; - defaultValue?: string; - id: string; - onChange: Function; - errMsg: string; - type: string; - step?: string; - maxLength?: number; - value?: string; -} - -export const ValidationInput: FC = ({ - className, - defaultValue, - id, - onChange, - errMsg, - type, - step, - maxLength, - value, -}) => { - const handleInputChange = (event: React.ChangeEvent) => { - const newValue = event.target.value; - onChange(newValue); // Call the parent's onChange function - }; - - const errClass = errMsg === "" ? "" : "error-message"; - const calulatedClass = errMsg === "" ? className : className + " error-border"; - return ( -
-
- -
-
{errMsg}
-
- ); -}; diff --git a/frontend/src/app/common/validation-select.tsx b/frontend/src/app/common/validation-select.tsx deleted file mode 100644 index 1ac4168cd..000000000 --- a/frontend/src/app/common/validation-select.tsx +++ /dev/null @@ -1,44 +0,0 @@ -import { FC } from "react"; -import Option from "../types/app/option"; -import Select from "react-select"; - -interface ValidationSelectProps { - className: string; - options: Option[]; - defaultValue?: Option; - placeholder: string; - id: string; - classNamePrefix: string; - onChange: (selectedOption: Option | null) => void; - errMsg: string; -} - -export const ValidationSelect: FC = ({ - className, - options, - defaultValue, - placeholder, - id, - classNamePrefix, - onChange, - errMsg, -}) => { - const calulatedClass = errMsg === "" ? "" : "error-message"; - const calulatedBorderClass = errMsg === "" ? "" : "error-select-border"; - return ( -
-
- = ({ equipment, assignedOffic {/* COORDINATES */}
Latitude / Longitude -
+
Date: Tue, 8 Oct 2024 18:33:55 -0700 Subject: [PATCH 08/25] chore(ci): Dockerfile updates (#693) Signed-off-by: OMPRAKASH MISHRA Co-authored-by: afwilcox --- backend/Dockerfile | 33 +++++---------- backend/src/app.module.ts | 4 +- .../backend/templates/deployment.yaml | 5 +-- .../webeoc/templates/deployment.yaml | 16 ++------ frontend/Dockerfile | 5 +-- webeoc/Dockerfile | 41 +++++++------------ webeoc/src/main.ts | 1 + 7 files changed, 34 insertions(+), 71 deletions(-) diff --git a/backend/Dockerfile b/backend/Dockerfile index a6f5816d4..a7d9cda9f 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -1,6 +1,5 @@ -# https://catalog.redhat.com/software/containers/ubi8/nodejs-18-minimal/627d1c38e35da88581633bf1 -FROM registry.access.redhat.com/ubi8/nodejs-18-minimal:1-33.1679485315@sha256:74af9dc2b620022c77fcd712b811f64a03c1444ff1e9b9596a242b2edf3cf96f AS builder - +# Build +FROM node:22-slim AS build # Install packages, build and keep only prod packages USER root WORKDIR /app @@ -10,26 +9,15 @@ RUN npm ci --omit=dev && \ npm run build # Deployment container -FROM registry.access.redhat.com/ubi8/ubi-micro:8.7-6@sha256:af0a83c2fb7db1b63a5655c85f3f37d32b114443b8969fd8a40d47429cd87016 - -# Set node to production -ENV NODE_ENV production - -# Node packages and dependencies -COPY --from=builder /usr/bin/node /usr/bin/ -COPY --from=builder /usr/lib64/libz.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlidec.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlienc.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libcrypto.so.1.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libssl.so.1.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libstdc++.so.6 /usr/lib64/ -COPY --from=builder /usr/lib64/libgcc_s.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlicommon.so.1 /usr/lib64/ +# Deploy using minimal Distroless image +FROM gcr.io/distroless/nodejs22-debian12:nonroot +# Set node to production +ENV NODE_ENV=production # Copy over app WORKDIR /app -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/dist ./dist +COPY --from=build /app/node_modules ./node_modules +COPY --from=build /app/dist ./dist COPY ../templates /app/templates # Port and health check @@ -38,6 +26,5 @@ HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3000 # Non-privileged user USER app - -# Start up command -ENTRYPOINT ["node", "dist/main"] +# max old space the heap size, 120MB with 200MB limit in deployment. +CMD ["--max-old-space-size=120", "/app/dist/main"] diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 8410e517b..4b26b75c0 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import { MiddlewareConsumer, Module } from "@nestjs/common"; +import {MiddlewareConsumer, Module, RequestMethod} from "@nestjs/common"; import { TypeOrmModule } from "@nestjs/typeorm"; import { ConfigModule } from "@nestjs/config"; import { AutomapperModule } from "@automapper/nestjs"; @@ -135,7 +135,7 @@ if (process.env.POSTGRESQL_PASSWORD != null) { export class AppModule { // let's add a middleware on all routes configure(consumer: MiddlewareConsumer) { - consumer.apply(HTTPLoggerMiddleware).forRoutes("*"); + consumer.apply(HTTPLoggerMiddleware).exclude({ path: '', method: RequestMethod.ALL }).forRoutes("*"); consumer.apply(RequestTokenMiddleware).forRoutes("v1/code-table", "v1/case", "v1/configuration"); } } diff --git a/charts/app/templates/backend/templates/deployment.yaml b/charts/app/templates/backend/templates/deployment.yaml index 022cdddaa..7d13ae6a3 100644 --- a/charts/app/templates/backend/templates/deployment.yaml +++ b/charts/app/templates/backend/templates/deployment.yaml @@ -19,9 +19,6 @@ spec: metadata: annotations: rollme: {{ randAlphaNum 5 | quote }} - prometheus.io/scrape: 'true' - prometheus.io/port: '3000' - prometheus.io/path: '/api/metrics' labels: {{- include "backend.labels" . | nindent 8 }} spec: @@ -125,4 +122,4 @@ spec: - {{ .Release.Name }} topologyKey: "kubernetes.io/hostname" -{{- end }} \ No newline at end of file +{{- end }} diff --git a/charts/app/templates/webeoc/templates/deployment.yaml b/charts/app/templates/webeoc/templates/deployment.yaml index 489c657bf..b46a97e63 100644 --- a/charts/app/templates/webeoc/templates/deployment.yaml +++ b/charts/app/templates/webeoc/templates/deployment.yaml @@ -52,12 +52,8 @@ spec: containerPort: {{ .Values.webeoc.service.targetPort }} protocol: TCP readinessProbe: - exec: - command: - - /usr/bin/env - - bash - - -c - - ls + tcpSocket: + port: {{ .Values.webeoc.service.targetPort }} initialDelaySeconds: 5 periodSeconds: 2 timeoutSeconds: 2 @@ -66,12 +62,8 @@ spec: livenessProbe: successThreshold: 1 failureThreshold: 3 - exec: - command: - - /usr/bin/env - - bash - - -c - - ls + tcpSocket: + port: {{ .Values.webeoc.service.targetPort }} initialDelaySeconds: 15 periodSeconds: 30 timeoutSeconds: 5 diff --git a/frontend/Dockerfile b/frontend/Dockerfile index 2d8ec5ba4..b7535a94c 100644 --- a/frontend/Dockerfile +++ b/frontend/Dockerfile @@ -5,10 +5,9 @@ COPY . . RUN npm ci --omit=dev && \ npm run build -FROM caddy:2.7.6-alpine AS deploy -COPY --from=build /app/Caddyfile /etc/caddy/Caddyfile +FROM caddy:2.8.4-alpine AS deploy COPY --from=build /app/build /app/dist - +COPY Caddyfile /etc/caddy/Caddyfile EXPOSE 3000 3001 USER 1001 HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost/:3001/health || exit 1 diff --git a/webeoc/Dockerfile b/webeoc/Dockerfile index 6f23a62a7..705d1de74 100644 --- a/webeoc/Dockerfile +++ b/webeoc/Dockerfile @@ -1,39 +1,26 @@ -# https://catalog.redhat.com/software/containers/ubi8/nodejs-18-minimal/627d1c38e35da88581633bf1 -FROM registry.access.redhat.com/ubi8/nodejs-18-minimal:1-33.1679485315@sha256:74af9dc2b620022c77fcd712b811f64a03c1444ff1e9b9596a242b2edf3cf96f AS builder - +# Build +FROM node:22-slim AS build # Install packages, build and keep only prod packages USER root WORKDIR /app COPY *.json ./ COPY ./src /app/src -# Install dependencies -RUN npm ci --omit=dev --ignore-scripts - -# Run build -RUN npm run build +RUN npm ci --omit=dev --ignore-scripts && \ + npm run build # Deployment container -FROM registry.access.redhat.com/ubi8/ubi-micro:8.7-6@sha256:af0a83c2fb7db1b63a5655c85f3f37d32b114443b8969fd8a40d47429cd87016 - -# Set node to production -ENV NODE_ENV production - -# Node packages and dependencies -COPY --from=builder /usr/bin/node /usr/bin/ -COPY --from=builder /usr/lib64/libz.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlidec.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlienc.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libcrypto.so.1.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libssl.so.1.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libstdc++.so.6 /usr/lib64/ -COPY --from=builder /usr/lib64/libgcc_s.so.1 /usr/lib64/ -COPY --from=builder /usr/lib64/libbrotlicommon.so.1 /usr/lib64/ +# Deploy using minimal Distroless image +FROM gcr.io/distroless/nodejs22-debian12:nonroot +# Set node to production +ENV NODE_EN=production + + # Copy over app WORKDIR /app -COPY --from=builder /app/node_modules ./node_modules -COPY --from=builder /app/dist ./dist +COPY --from=build /app/node_modules ./node_modules +COPY --from=build /app/dist ./dist # Port and health check EXPOSE 3002 @@ -42,5 +29,5 @@ HEALTHCHECK --interval=30s --timeout=3s CMD curl -f http://localhost:3002/health # Non-privileged user USER app -# Start up command -ENTRYPOINT ["node", "dist/main"] +# max old space the heap size, 80MB with 150MB limit in deployment. +CMD ["--max-old-space-size=80", "/app/dist/main"] diff --git a/webeoc/src/main.ts b/webeoc/src/main.ts index 680faf612..82e5b3622 100644 --- a/webeoc/src/main.ts +++ b/webeoc/src/main.ts @@ -11,6 +11,7 @@ async function bootstrap() { const server = express(); server.disable("x-powered-by"); server.get("/health", (req, res) => res.status(200).send("ok")); + server.listen(3002); const app = await NestFactory.create(AppModule, new ExpressAdapter(server)); await app.listen(3002); } From b4f59cdefed7faf4b6acd63b60b3c60f3fc027e4 Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Tue, 8 Oct 2024 23:55:21 -0700 Subject: [PATCH 09/25] fix: Config.js error while developing locally (#699) --- frontend/public/static/js/config.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 frontend/public/static/js/config.js diff --git a/frontend/public/static/js/config.js b/frontend/public/static/js/config.js new file mode 100644 index 000000000..ff771c9a8 --- /dev/null +++ b/frontend/public/static/js/config.js @@ -0,0 +1 @@ +// Dummy file for local development. In production, this file is dynamically generated by the webserver. \ No newline at end of file From 70f8b02e2bba436c58489b448457dfa2c6e3c2e9 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Fri, 11 Oct 2024 11:49:17 -0700 Subject: [PATCH 10/25] fix: Clear CDOGS templates with every run (#700) --- migrations/migrations/R__reset-templates.sql | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 migrations/migrations/R__reset-templates.sql diff --git a/migrations/migrations/R__reset-templates.sql b/migrations/migrations/R__reset-templates.sql new file mode 100644 index 000000000..d0aa25ead --- /dev/null +++ b/migrations/migrations/R__reset-templates.sql @@ -0,0 +1,14 @@ +--------------------- +-- Resets the CDOGS template hashes on every migration to ensure we always upload a new one +-- +-- The last line of the comment is where the magic happens, it will refresh the date - +-- even if no changes are made. +-- +-- Last Run on: ${flyway:timestamp} +---------------------- + +UPDATE "configuration" +SET + configuration_value = '' +WHERE + configuration_code IN ('ERSTMPLATE', 'HWCTMPLATE'); \ No newline at end of file From b8aae06e3ad26b123f89d0f8c2fc7a7efafb7356 Mon Sep 17 00:00:00 2001 From: gregorylavery <100631366+gregorylavery@users.noreply.github.com> Date: Fri, 11 Oct 2024 17:16:29 -0700 Subject: [PATCH 11/25] fix: Ce 1127 (#694) Co-authored-by: afwilcox --- .../v1/staging_complaint/staging_complaint.service.ts | 10 ++++++++-- ...R__0.20.0_edit_complaint_using_webeoc_complaint.sql | 7 ------- .../R__update-insert-complaint-from-staging.sql | 2 +- 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/backend/src/v1/staging_complaint/staging_complaint.service.ts b/backend/src/v1/staging_complaint/staging_complaint.service.ts index ac04b89bd..94512355d 100644 --- a/backend/src/v1/staging_complaint/staging_complaint.service.ts +++ b/backend/src/v1/staging_complaint/staging_complaint.service.ts @@ -102,8 +102,14 @@ export class StagingComplaintService { // Given two WebEOCComplaint objects, compare them and return true if they're the same. This function // ignores some attributes (specifically the back_number_of* attributes) _compareWebEOCComplaints = (complaint1: WebEOCComplaint, complaint2: WebEOCComplaint): boolean => { - // Attributes to ignore - const attributesToIgnore = ["back_number_of_days", "back_number_of_hours", "back_number_of_minutes", "entrydate"]; + // Attributes to ignore, if these are changed we don't consider it an edit + const attributesToIgnore = [ + "back_number_of_days", + "back_number_of_hours", + "back_number_of_minutes", + "entrydate", + "status", + ]; // Omit the attributes to ignore const complaint1Filtered = omit(complaint1, attributesToIgnore); diff --git a/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql b/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql index e26f626a3..b4b3f5e34 100644 --- a/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql +++ b/migrations/migrations/R__0.20.0_edit_complaint_using_webeoc_complaint.sql @@ -251,13 +251,6 @@ BEGIN WHERE complaint_identifier = _complaint_identifier; update_edit_ind = true; end if; - - if (_edit_complaint_status_code <> current_complaint_record.complaint_status_code) then - UPDATE complaint - SET complaint_status_code = _edit_complaint_status_code - WHERE complaint_identifier = _complaint_identifier; - update_edit_ind = true; - end if; -- the update caused an edit, set the audit fields if (update_edit_ind) then diff --git a/migrations/migrations/R__update-insert-complaint-from-staging.sql b/migrations/migrations/R__update-insert-complaint-from-staging.sql index 0b4e8f389..f4a052918 100644 --- a/migrations/migrations/R__update-insert-complaint-from-staging.sql +++ b/migrations/migrations/R__update-insert-complaint-from-staging.sql @@ -342,7 +342,7 @@ OR REPLACE FUNCTION public.insert_complaint_from_staging (_complaint_identifier IF _violation_code = 'WASTE' OR _violation_code = 'PESTICDE' THEN UPDATE PUBLIC.complaint - SET owned_by_agency_code = 'EPO' + SET owned_by_agency_code = 'EPO', complaint_status_code = 'OPEN' WHERE complaint_identifier = _complaint_identifier; END IF; From fde5a568afe239250f0a2cf70315fad23d87a6eb Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Oct 2024 09:04:13 -0700 Subject: [PATCH 12/25] chore(deps): update dependency @types/jest to v29.5.13 (#704) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: afwilcox --- webeoc/package-lock.json | 9 +++++---- webeoc/package.json | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/webeoc/package-lock.json b/webeoc/package-lock.json index 332145716..ad3f2265c 100644 --- a/webeoc/package-lock.json +++ b/webeoc/package-lock.json @@ -28,7 +28,7 @@ "@nestjs/schematics": "^10.1.4", "@nestjs/testing": "^10.4.4", "@types/express": "^4.17.13", - "@types/jest": "29.5.12", + "@types/jest": "29.5.13", "@types/node": "18.15.11", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", @@ -2010,10 +2010,11 @@ } }, "node_modules/@types/jest": { - "version": "29.5.12", - "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.12.tgz", - "integrity": "sha512-eDC8bTvT/QhYdxJAulQikueigY5AsdBRH2yDKW3yveW7svY3+DzN84/2NUgkw10RTiJbWqZrTtoGVdYlvFJdLw==", + "version": "29.5.13", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.13.tgz", + "integrity": "sha512-wd+MVEZCHt23V0/L642O5APvspWply/rGY5BcW4SUETo2UzPU3Z26qr8jC2qxpimI2jjx9h7+2cj2FwIr01bXg==", "dev": true, + "license": "MIT", "dependencies": { "expect": "^29.0.0", "pretty-format": "^29.0.0" diff --git a/webeoc/package.json b/webeoc/package.json index bf5b3726d..71e04677c 100644 --- a/webeoc/package.json +++ b/webeoc/package.json @@ -39,7 +39,7 @@ "@nestjs/schematics": "^10.1.4", "@nestjs/testing": "^10.4.4", "@types/express": "^4.17.13", - "@types/jest": "29.5.12", + "@types/jest": "29.5.13", "@types/node": "18.15.11", "@types/supertest": "^2.0.11", "@typescript-eslint/eslint-plugin": "^5.0.0", From a788f68485864f8d1420eff51dda33c2976f3fd9 Mon Sep 17 00:00:00 2001 From: dmitri-korin-bcps <108112696+dmitri-korin-bcps@users.noreply.github.com> Date: Tue, 15 Oct 2024 13:17:53 -0700 Subject: [PATCH 13/25] feat: CE-550- modal-improvements-V2 (#703) --- .../details/complaint-details-create.tsx | 2 +- .../details/complaint-details-edit.tsx | 2 +- .../authorization-outcome-form.tsx | 2 +- .../ceeb/ceeb-decision/decision-form.tsx | 22 ++-- .../outcomes/hwcr-complaint-assessment.tsx | 2 +- .../hwcr-equipment/equipment-form.tsx | 2 +- .../complaints/outcomes/hwcr-file-review.tsx | 2 +- .../outcomes/hwcr-outcome-by-animal-v2.tsx | 4 +- .../outcomes/hwcr-prevention-education.tsx | 2 +- .../oucome-by-animal/edit-outcome.tsx | 2 +- .../outcomes/outcome-attachments.tsx | 2 +- .../complaints/outcomes/supplemental-note.tsx | 2 +- .../supplemental-notes-input.tsx | 2 +- .../modal/instances/assign-officer-modal.tsx | 118 +++++++++--------- .../modal/instances/cancel-confirm-modal.tsx | 8 +- .../modal/instances/change-status-modal.tsx | 47 +++---- .../instances/delete-confirm-modal-v2.tsx | 6 +- .../modal/instances/delete-confirm-modal.tsx | 4 +- .../modal/instances/delete-note-modal.tsx | 2 +- .../standalone-cancel-confirm-modal.tsx | 8 +- frontend/src/assets/sass/layout.scss | 97 +++----------- frontend/src/assets/sass/misc.scss | 54 ++++++-- frontend/src/assets/sass/modals.scss | 15 ++- 23 files changed, 183 insertions(+), 224 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/details/complaint-details-create.tsx b/frontend/src/app/components/containers/complaints/details/complaint-details-create.tsx index 535b8a83f..1cb99f544 100644 --- a/frontend/src/app/components/containers/complaints/details/complaint-details-create.tsx +++ b/frontend/src/app/components/containers/complaints/details/complaint-details-create.tsx @@ -542,7 +542,7 @@ export const CreateComplaint: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed, }, diff --git a/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx b/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx index 312913c0b..e80e01560 100644 --- a/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx +++ b/frontend/src/app/components/containers/complaints/details/complaint-details-edit.tsx @@ -279,7 +279,7 @@ export const ComplaintDetailsEdit: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: resetErrorMessages, }, diff --git a/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome-form.tsx b/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome-form.tsx index c8b742216..164e620dc 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome-form.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome-form.tsx @@ -105,7 +105,7 @@ export const AuthoizationOutcomeForm: FC = ({ id, type, value, leadIdenti modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: () => { //-- reset the form to its original state diff --git a/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx b/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx index 2b9c8a06f..cd7f7b86e 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/ceeb/ceeb-decision/decision-form.tsx @@ -116,10 +116,12 @@ export const DecisionForm: FC = ({ useEffect(() => { if (sector && schedule) { - let options = scheduleSectorType.filter((item) => item.schedule === schedule).map(item => { - const record: Option = { label: item.longDescription, value: item.sector }; - return record - }); + let options = scheduleSectorType + .filter((item) => item.schedule === schedule) + .map((item) => { + const record: Option = { label: item.longDescription, value: item.sector }; + return record; + }); setSectorList(options); } // eslint-disable-next-line react-hooks/exhaustive-deps @@ -196,10 +198,12 @@ export const DecisionForm: FC = ({ }; const handleScheduleChange = (schedule: string) => { - let options = scheduleSectorType.filter((item) => item.schedule === schedule).map(item => { - const record: Option = { label: item.longDescription, value: item.sector }; - return record - }); + let options = scheduleSectorType + .filter((item) => item.schedule === schedule) + .map((item) => { + const record: Option = { label: item.longDescription, value: item.sector }; + return record; + }); const model = { ...data, sector: "", schedule: schedule }; setData(model); setSectorList(options); @@ -218,7 +222,7 @@ export const DecisionForm: FC = ({ modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: () => { //-- reset the form to its original state diff --git a/frontend/src/app/components/containers/complaints/outcomes/hwcr-complaint-assessment.tsx b/frontend/src/app/components/containers/complaints/outcomes/hwcr-complaint-assessment.tsx index 03748df68..e3c616124 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/hwcr-complaint-assessment.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/hwcr-complaint-assessment.tsx @@ -216,7 +216,7 @@ export const HWCRComplaintAssessment: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed, }, diff --git a/frontend/src/app/components/containers/complaints/outcomes/hwcr-equipment/equipment-form.tsx b/frontend/src/app/components/containers/complaints/outcomes/hwcr-equipment/equipment-form.tsx index aa9a79b2b..ad1dea843 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/hwcr-equipment/equipment-form.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/hwcr-equipment/equipment-form.tsx @@ -294,7 +294,7 @@ export const EquipmentForm: FC = ({ equipment, assignedOffic modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed, }, diff --git a/frontend/src/app/components/containers/complaints/outcomes/hwcr-file-review.tsx b/frontend/src/app/components/containers/complaints/outcomes/hwcr-file-review.tsx index 58afb4ecc..5b85dd86c 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/hwcr-file-review.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/hwcr-file-review.tsx @@ -109,7 +109,7 @@ export const HWCRFileReview: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: () => { setReviewRequired(isReviewRequired); diff --git a/frontend/src/app/components/containers/complaints/outcomes/hwcr-outcome-by-animal-v2.tsx b/frontend/src/app/components/containers/complaints/outcomes/hwcr-outcome-by-animal-v2.tsx index 9dac4f757..7bef0eb9e 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/hwcr-outcome-by-animal-v2.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/hwcr-outcome-by-animal-v2.tsx @@ -71,7 +71,7 @@ export const HWCROutcomeByAnimalv2: FC = () => { data: { caseFileId: id, outcomeId, //-- this is the id of the animal outcome thats being deleted - title: "Delete Animal Outcome", + title: "Delete animal outcome", description: "All the data in this section will be lost.", ok: "Yes, delete animal outcome", cancel: "No, go back", @@ -116,7 +116,7 @@ export const HWCROutcomeByAnimalv2: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: () => { setShowForm(false); diff --git a/frontend/src/app/components/containers/complaints/outcomes/hwcr-prevention-education.tsx b/frontend/src/app/components/containers/complaints/outcomes/hwcr-prevention-education.tsx index 685e05c4f..02e06d64b 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/hwcr-prevention-education.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/hwcr-prevention-education.tsx @@ -164,7 +164,7 @@ export const HWCRComplaintPrevention: FC = () => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed, }, diff --git a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx index 2b9d9a0b2..ada3518c4 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/oucome-by-animal/edit-outcome.tsx @@ -369,7 +369,7 @@ export const EditOutcome: FC = ({ id, index, outcome, assignedOfficer: of return ( <> = ({ showAddButton = false }) => { modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed, }, diff --git a/frontend/src/app/components/containers/complaints/outcomes/supplemental-note.tsx b/frontend/src/app/components/containers/complaints/outcomes/supplemental-note.tsx index 81dfec26c..f6f673b63 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/supplemental-note.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/supplemental-note.tsx @@ -31,7 +31,7 @@ export const SupplementalNote: FC = () => { modalSize: "md", modalType: DELETE_NOTE, data: { - title: "Delete Supplemental Note", + title: "Delete supplemental note", description: "All the data in this section will be lost.", caseIdentifier: id, ok: "Yes, delete note", diff --git a/frontend/src/app/components/containers/complaints/outcomes/supplemental-notes/supplemental-notes-input.tsx b/frontend/src/app/components/containers/complaints/outcomes/supplemental-notes/supplemental-notes-input.tsx index de8c6080f..ebf592e3d 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/supplemental-notes/supplemental-notes-input.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/supplemental-notes/supplemental-notes-input.tsx @@ -56,7 +56,7 @@ export const SupplementalNotesInput: FC = ({ id, complaintType, notes, cu modalSize: "md", modalType: CANCEL_CONFIRM, data: { - title: "Cancel Changes?", + title: "Cancel changes?", description: "Your changes will be lost.", cancelConfirmed: () => { setCurrentNotes(notes); diff --git a/frontend/src/app/components/modal/instances/assign-officer-modal.tsx b/frontend/src/app/components/modal/instances/assign-officer-modal.tsx index 02722896b..af77a19b0 100644 --- a/frontend/src/app/components/modal/instances/assign-officer-modal.tsx +++ b/frontend/src/app/components/modal/instances/assign-officer-modal.tsx @@ -1,5 +1,5 @@ import { ChangeEvent, FC, useState } from "react"; -import { Modal, Button } from "react-bootstrap"; +import { Modal, Button, CloseButton, ListGroup, ListGroupItem, Card } from "react-bootstrap"; import { useAppDispatch, useAppSelector } from "../../../hooks/hooks"; import { profileDisplayName, @@ -121,26 +121,21 @@ export const AssignOfficerModal: FC = ({ close, submit, // don't display the current user in the list since we already have the current user at the top of the modal if (authUserId === undefined || !compareUuidToString(authUserId, idir)) { return ( -
handleAssigneeClick(personId)} > -
-
-
-
-
-
+
+
{displayName}
{showExperimentalFeature &&
Officer
}
-
-
+ ); } else { return <>; @@ -161,66 +156,67 @@ export const AssignOfficerModal: FC = ({ close, submit, return ( <> {title && ( - - {title} + + {title} )} -
-
-
-
-
-
-
+ +
+
+
{displayName}
{showExperimentalFeature &&
Officer
}
-
+
-
-
-
Method complaint was received
-
+
{complaintMethodReceivedCode?.longDescription}
diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index 6633bad60..52d478ee7 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -293,6 +293,10 @@ VALUES('16dc87d5-2034-4d9a-bbf4-3ec0f927d3e8'::uuid, 'ENV', NULL, NULL, 'TestAcc ON CONFLICT DO NOTHING; INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('375bac7f-390a-4b32-91da-1ed9da71c1e3'::uuid, 'ENV', NULL, NULL, 'TestAcct 2', 'nr-compliance-enforcement', '2023-06-29 22:16:16.754', 'nr-compliance-enforcement', '2023-06-29 22:16:16.754') +ON CONFLICT DO NOTHING; +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('5a724b5e-aa64-439d-a76d-3aa7320409a0'::uuid, 'Scarlett', NULL, NULL, 'Truong', 'FLYWAY', '2024-01-10 22:16:16.754', 'FLYWAY', '2024-01-10 22:16:16.754') ON CONFLICT DO NOTHING; INSERT INTO public.person @@ -437,6 +441,10 @@ INSERT INTO public.officer VALUES('fc91b041-7f1b-46e9-8c07-0813bb656a7f'::uuid, 'ENCETST1', 'nr-compliance-enforcement', '2023-06-29 22:16:16.754', 'nr-compliance-enforcement', '2023-06-29 22:20:48.186', '16dc87d5-2034-4d9a-bbf4-3ec0f927d3e8'::uuid, '79fe321b-7716-413f-b878-c5fd6100317d'::uuid, '0cf857a2-28a3-4867-af0f-d59449243057'::uuid) ON CONFLICT DO NOTHING; INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, auth_user_guid) +VALUES('ac64c6e6-8233-4cee-807b-5bb2b4ddb15b'::uuid, 'ENCETST2', 'nr-compliance-enforcement', '2023-06-29 22:16:16.754', 'nr-compliance-enforcement', '2023-06-29 22:20:48.186', '375bac7f-390a-4b32-91da-1ed9da71c1e3'::uuid, '6d1bb908-0f03-4873-af49-916713583c7e'::uuid) +ON CONFLICT DO NOTHING; +INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid) VALUES('a534a1e0-bebc-499d-ba4b-eb5ed0726f26'::uuid, 'STRUONG', 'FLYWAY', '2024-01-10 22:16:16.754', 'FLYWAY', '2024-01-10 22:20:48.186', '5a724b5e-aa64-439d-a76d-3aa7320409a0'::uuid, '3f474308-68da-450a-b1ab-fb8a5b7a27ce'::uuid) ON CONFLICT DO NOTHING; From d86e33e75de136477d319838bebfb7225c21590e Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Wed, 16 Oct 2024 13:02:31 -0700 Subject: [PATCH 15/25] fix: CE 1124 (#705) --- .github/workflows/pr-version-bump.yml | 2 +- .github/workflows/release-branch-creation.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-version-bump.yml b/.github/workflows/pr-version-bump.yml index 159455008..2bbf6a12f 100644 --- a/.github/workflows/pr-version-bump.yml +++ b/.github/workflows/pr-version-bump.yml @@ -20,7 +20,7 @@ jobs: id: get_latest_tag run: | git fetch origin main --tags - latest_tag=$(git describe --tags --abbrev=0 origin/main) + latest_tag=$(git tag --list --sort=-v:refname --merged | head -n 1) echo "::set-output name=latest_tag::$latest_tag" echo "Latest tag: $latest_tag" diff --git a/.github/workflows/release-branch-creation.yml b/.github/workflows/release-branch-creation.yml index 687cde518..d162d6259 100644 --- a/.github/workflows/release-branch-creation.yml +++ b/.github/workflows/release-branch-creation.yml @@ -20,7 +20,7 @@ jobs: id: latest_tag run: | git fetch --tags - latest_tag=$(git tag --sort=-creatordate | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) + latest_tag=$(git tag --list --sort=-v:refname --merged | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) if [ -z "$latest_tag" ]; then echo "No previous tags found, starting with v0.1.0" latest_tag="v0.0.0" From 24a3c76ac08147f6f6c15b653a7ef7e793a6b052 Mon Sep 17 00:00:00 2001 From: dmitri-korin-bcps <108112696+dmitri-korin-bcps@users.noreply.github.com> Date: Wed, 16 Oct 2024 16:38:01 -0700 Subject: [PATCH 16/25] fix: CE-1143-apply-scroll-bar-to-assign-modal (#710) Co-authored-by: afwilcox --- .../ceeb/authorization-outcome/authorization-outcome.tsx | 2 +- .../components/modal/instances/assign-officer-modal.tsx | 2 +- frontend/src/assets/sass/layout.scss | 7 +++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome.tsx b/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome.tsx index 1143fd016..0033b6d52 100644 --- a/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome.tsx +++ b/frontend/src/app/components/containers/complaints/outcomes/ceeb/authorization-outcome/authorization-outcome.tsx @@ -47,7 +47,7 @@ export const AuthoizationOutcome: FC = () => { modalSize: "md", modalType: DELETE_CONFIRM, data: { - title: "Delete Authorization?", + title: "Delete authorization?", description: "Your changes will be lost.", confirmText: "delete authorization", deleteConfirmed: () => { diff --git a/frontend/src/app/components/modal/instances/assign-officer-modal.tsx b/frontend/src/app/components/modal/instances/assign-officer-modal.tsx index af77a19b0..365e38e66 100644 --- a/frontend/src/app/components/modal/instances/assign-officer-modal.tsx +++ b/frontend/src/app/components/modal/instances/assign-officer-modal.tsx @@ -215,7 +215,7 @@ export const AssignOfficerModal: FC = ({ close, submit,

{renderHeading()}

- {renderOfficers()} + {renderOfficers()}
diff --git a/frontend/src/assets/sass/layout.scss b/frontend/src/assets/sass/layout.scss index da034b3e0..f99ccbded 100644 --- a/frontend/src/assets/sass/layout.scss +++ b/frontend/src/assets/sass/layout.scss @@ -374,6 +374,13 @@ button.modal-buttons { background-color: $gray-100; } +.modal-scroll { + min-height: 70px; + max-height: 264px; + overflow-y: scroll; + overflow-x: hidden; +} + .self-assign { margin-bottom: 10px; &:hover { From 02d58eb4a4866c85f6c98176d371209a46d3f40f Mon Sep 17 00:00:00 2001 From: jon-funk Date: Wed, 16 Oct 2024 17:25:14 -0700 Subject: [PATCH 17/25] fix: CE-917 enable autoscaling for test (#702) Co-authored-by: Barrett Falk Co-authored-by: afwilcox --- .github/workflows/merge-main.yml | 5 +++++ .github/workflows/merge-release.yml | 9 +++++++++ charts/app/values.yaml | 10 +++++----- 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/.github/workflows/merge-main.yml b/.github/workflows/merge-main.yml index 9fce4d334..2bacb333d 100644 --- a/.github/workflows/merge-main.yml +++ b/.github/workflows/merge-main.yml @@ -79,9 +79,14 @@ jobs: tag: ${{ needs.vars.outputs.pr }} params: --set backend.deploymentStrategy=RollingUpdate --set frontend.deploymentStrategy=RollingUpdate + --set webeoc.deploymentStrategy=RollingUpdate --set global.autoscaling=true --set frontend.pdb.enabled=true --set backend.pdb.enabled=true + --set webeoc.pdb.enabled=true + --set nats.config.cluster.replicas=3 + --set nats.config.cluster.enabled=true + promote: name: Promote Images needs: [deploy-prod, vars] diff --git a/.github/workflows/merge-release.yml b/.github/workflows/merge-release.yml index 7ff5274e8..0b6628fa0 100644 --- a/.github/workflows/merge-release.yml +++ b/.github/workflows/merge-release.yml @@ -47,6 +47,15 @@ jobs: with: environment: test tag: ${{ needs.vars.outputs.pr }} + params: --set backend.deploymentStrategy=RollingUpdate + --set frontend.deploymentStrategy=RollingUpdate + --set webeoc.deploymentStrategy=RollingUpdate + --set global.autoscaling=true + --set frontend.pdb.enabled=true + --set backend.pdb.enabled=true + --set webeoc.pdb.enabled=true + --set nats.config.cluster.replicas=3 + --set nats.config.cluster.enabled=true promote: name: Promote Images diff --git a/charts/app/values.yaml b/charts/app/values.yaml index 944a7ec0f..51f51d673 100644 --- a/charts/app/values.yaml +++ b/charts/app/values.yaml @@ -361,7 +361,6 @@ backup: nats: enabled: true config: - replicaCount: 1 resources: requests: cpu: 100m @@ -377,8 +376,9 @@ nats: memoryStore: enabled: true maxSize: 250Mi - cluster: - enabled: true + cluster: + enabled: false + replicas: 1 natsBox: enabled: false persistence: @@ -407,9 +407,9 @@ webeoc: #-- enable or disable autoscaling. enabled: true #-- the minimum number of replicas. - minReplicas: 1 + minReplicas: 2 #-- the maximum number of replicas. - maxReplicas: 2 + maxReplicas: 3 #-- the target cpu utilization percentage, is from request cpu and NOT LIMIT CPU. targetCPUUtilizationPercentage: 80 service: From 9df80c54b2126445d1f257a6696e3df4cb610c45 Mon Sep 17 00:00:00 2001 From: jon-funk Date: Wed, 16 Oct 2024 18:40:50 -0700 Subject: [PATCH 18/25] fix: CE-1078 persist secret content changes between rollouts (#698) Co-authored-by: afwilcox --- .github/workflows/pr-close.yml | 9 +++++++++ .github/workflows/pr-open.yml | 1 - charts/app/Chart.lock | 7 +++++-- charts/app/templates/_helpers.tpl | 1 + migrations/migrations/R__Create-Test-Data.sql | 10 ++++++++++ .../test-only-migrations/R__Test-Data-Creation.sql | 2 ++ 6 files changed, 27 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr-close.yml b/.github/workflows/pr-close.yml index ebd159daf..06ba7d866 100644 --- a/.github/workflows/pr-close.yml +++ b/.github/workflows/pr-close.yml @@ -19,3 +19,12 @@ jobs: with: cleanup: helm packages: backend frontend migrations + + cleanup-labeled: + name: Cleanup Labeled Resources + uses: bcgov/quickstart-openshift-helpers/.github/workflows/.pr-close.yml@v0.5.0 + secrets: + oc_namespace: ${{ secrets.OC_NAMESPACE }} + oc_token: ${{ secrets.OC_TOKEN }} + with: + cleanup: label \ No newline at end of file diff --git a/.github/workflows/pr-open.yml b/.github/workflows/pr-open.yml index 697c49aa4..2a0676faf 100644 --- a/.github/workflows/pr-open.yml +++ b/.github/workflows/pr-open.yml @@ -37,7 +37,6 @@ jobs: oc_token: ${{ secrets.OC_TOKEN }} with: triggers: ('backend/' 'frontend/' 'webeoc/' 'migrations/') - params: --set global.secrets.persist=false tests: name: Tests diff --git a/charts/app/Chart.lock b/charts/app/Chart.lock index 6135759c8..70bf9a3c6 100644 --- a/charts/app/Chart.lock +++ b/charts/app/Chart.lock @@ -2,5 +2,8 @@ dependencies: - name: postgresql repository: https://charts.bitnami.com/bitnami version: 15.5.13 -digest: sha256:e29db8b50c7ad4e611c43b4590506d2172ac278b08f015fe0240ba123f2166ec -generated: "2024-07-03T12:48:59.269045601Z" +- name: nats + repository: https://nats-io.github.io/k8s/helm/charts/ + version: 1.1.12 +digest: sha256:daadb6fa80ea04bc755dfeae1b823ce70b60f7bc3326ab9c40b3768bb2d5d9aa +generated: "2024-10-08T14:08:20.367635823-07:00" diff --git a/charts/app/templates/_helpers.tpl b/charts/app/templates/_helpers.tpl index 9462c22c8..75ab465dc 100644 --- a/charts/app/templates/_helpers.tpl +++ b/charts/app/templates/_helpers.tpl @@ -43,5 +43,6 @@ Selector labels {{- define "selectorLabels" -}} app.kubernetes.io/name: {{ include "fullname" . }} app.kubernetes.io/instance: {{ .Release.Name }} +app: {{ .Release.Name }} {{- end }} diff --git a/migrations/migrations/R__Create-Test-Data.sql b/migrations/migrations/R__Create-Test-Data.sql index 6568b672b..b57a39b51 100644 --- a/migrations/migrations/R__Create-Test-Data.sql +++ b/migrations/migrations/R__Create-Test-Data.sql @@ -1953,6 +1953,16 @@ VALUES 'f896cbb2d5254e54a4ad581dc80681d1'::uuid ) ON CONFLICT DO NOTHING; +-- Fix keycloak name +UPDATE + public.officer +SET + user_id = 'JONFUNK' +WHERE + ( + officer_guid = 'b17ee2c1-a26b-4911-ac6f-810b8fdfaab3' + AND user_id = 'JFUNK' + ); INSERT INTO public.officer ( diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index 52d478ee7..2ee8b34c2 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -476,6 +476,8 @@ INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) VALUES('b17ee2c1-a26b-4911-ac6f-810b8fdfaab3'::uuid, 'JFUNK', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '97f3cee5-6f4a-410f-810f-d431595fccee'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, 'f896cbb2d5254e54a4ad581dc80681d1'::uuid) ON CONFLICT DO NOTHING; +-- Fix keycloak name +UPDATE public.officer SET user_id = 'JONFUNK' WHERE (officer_guid = 'b17ee2c1-a26b-4911-ac6f-810b8fdfaab3' AND user_id = 'JFUNK'); INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) VALUES('06ff894b-3895-4d32-8a4a-1fcc0be23e47'::uuid, 'RRONDEAU', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '0667495f-61a5-4d3b-b756-1ee58cb38e23'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '77c6040d69b74757903f1cba37404db4'::uuid) From 4de895ea0c6059f1046f64f51a04dc33ef5b133b Mon Sep 17 00:00:00 2001 From: Josh Gamache Date: Wed, 16 Oct 2024 14:37:18 -0600 Subject: [PATCH 19/25] chore: add Josh to dev & test users --- migrations/migrations/R__Create-Test-Data.sql | 52 +++++++++++++++++++ .../R__Test-Data-Creation.sql | 9 ++++ 2 files changed, 61 insertions(+) diff --git a/migrations/migrations/R__Create-Test-Data.sql b/migrations/migrations/R__Create-Test-Data.sql index b57a39b51..60256026f 100644 --- a/migrations/migrations/R__Create-Test-Data.sql +++ b/migrations/migrations/R__Create-Test-Data.sql @@ -1348,6 +1348,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.person ( + person_guid, + first_name, + middle_name_1, + middle_name_2, + last_name, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp + ) +VALUES + ( + '0c002922-d315-4fda-8fc5-3793dac12be8'::uuid, + 'Joshua', + NULL, + NULL, + 'Gamache', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:16:16.754' + ) ON CONFLICT +DO NOTHING; + -- Peace Pilot Users: Fort St. John -- INSERT INTO public.person ( @@ -2086,6 +2112,32 @@ VALUES ) ON CONFLICT DO NOTHING; +INSERT INTO + public.officer ( + officer_guid, + user_id, + create_user_id, + create_utc_timestamp, + update_user_id, + update_utc_timestamp, + person_guid, + office_guid, + auth_user_guid + ) +VALUES + ( + '236fb546-fae1-47fd-b4c7-d108c0030ee2'::uuid, + 'JGAMACHE', + 'FLYWAY', + '2024-01-22 22:16:16.754', + 'FLYWAY', + '2024-01-22 22:20:48.186', + '0c002922-d315-4fda-8fc5-3793dac12be8'::uuid, + 'c3d8519c-73cb-48a1-8058-358883d5ef4f'::uuid, + '13D3F179-F4CE-4464-A981-141061FD4E58'::uuid + ) ON CONFLICT +DO NOTHING; + INSERT INTO public.officer ( officer_guid, diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index 2ee8b34c2..4b33a05fc 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -335,6 +335,10 @@ INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, 'Mike', NULL, NULL, 'Vesprini', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') ON CONFLICT DO NOTHING; +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('0c002922-d315-4fda-8fc5-3793dac12be8'::uuid, 'Joshua', NULL, NULL, 'Gamache', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') +ON CONFLICT DO NOTHING; ------------------------- -- INSERT OFFICER RECORDS @@ -486,6 +490,10 @@ INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) VALUES('44123934-a2cf-4eae-88af-f682f7548f89'::uuid, 'MVESPRIN', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '141ebe0c-84c5-487d-8676-caee5de53b36'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '01a5ad69-0675-4359-a0a7-909f55e2c67a'::uuid) ON CONFLICT DO NOTHING; +INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid, auth_user_guid) +VALUES('236fb546-fae1-47fd-b4c7-d108c0030ee2'::uuid, 'JGAMACHE', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', '0c002922-d315-4fda-8fc5-3793dac12be8'::uuid, '4a5a94b1-bd47-4611-a577-861d97089903'::uuid, '13D3F179-F4CE-4464-A981-141061FD4E58'::uuid) +ON CONFLICT DO NOTHING; -------------------------------- --- Scatter our team throughout the province for testing @@ -508,6 +516,7 @@ UPDATE public.officer SET office_guid = '79fe321b-7716-413f-b878-c5fd6100317d' W UPDATE public.officer SET office_guid = '9fc7327b-b206-4a5c-88f1-2875a456eb49' WHERE user_id='JFUNK'; UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='RRONDEAU'; UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='MVESPRIN'; +UPDATE public.officer SET office_guid = '4a5a94b1-bd47-4611-a577-861d97089903' WHERE user_id='JGAMACHE'; ------------------------- -- INSERT COMPLAINT RECORDS From 20d34a36d343eb9f0ec1289e6145b264bbb65ff2 Mon Sep 17 00:00:00 2001 From: Mike Vesprini <11034827+mikevespi@users.noreply.github.com> Date: Thu, 17 Oct 2024 12:50:47 -0700 Subject: [PATCH 20/25] feat: CE-1045 add action taken filter for ceeb (#708) Co-authored-by: afwilcox --- backend/src/app.module.ts | 8 ++- .../complaints/complaint-filter-parameters.ts | 1 + .../src/v1/complaint/complaint.controller.ts | 11 ++-- backend/src/v1/complaint/complaint.service.ts | 49 ++++++++++++++-- .../cypress/e2e/complaint-search.v2.cy.ts | 58 +++++++++++++++++++ .../complaints/complaint-filter-bar.tsx | 10 ++++ .../complaints/complaint-filter.tsx | 40 +++++++++++-- .../containers/complaints/complaint-list.tsx | 3 +- .../containers/complaints/complaint-map.tsx | 2 + .../providers/complaint-filter-provider.tsx | 1 + frontend/src/app/store/reducers/complaints.ts | 4 ++ .../app/types/complaints/complaint-filters.ts | 1 + .../complaint-filters/complaint-filters.ts | 2 + 13 files changed, 171 insertions(+), 19 deletions(-) diff --git a/backend/src/app.module.ts b/backend/src/app.module.ts index 4b26b75c0..ffe9880f0 100644 --- a/backend/src/app.module.ts +++ b/backend/src/app.module.ts @@ -1,5 +1,5 @@ import "dotenv/config"; -import {MiddlewareConsumer, Module, RequestMethod} from "@nestjs/common"; +import { MiddlewareConsumer, Module, RequestMethod } from "@nestjs/common"; import { TypeOrmModule } from "@nestjs/typeorm"; import { ConfigModule } from "@nestjs/config"; import { AutomapperModule } from "@automapper/nestjs"; @@ -135,7 +135,9 @@ if (process.env.POSTGRESQL_PASSWORD != null) { export class AppModule { // let's add a middleware on all routes configure(consumer: MiddlewareConsumer) { - consumer.apply(HTTPLoggerMiddleware).exclude({ path: '', method: RequestMethod.ALL }).forRoutes("*"); - consumer.apply(RequestTokenMiddleware).forRoutes("v1/code-table", "v1/case", "v1/configuration"); + consumer.apply(HTTPLoggerMiddleware).exclude({ path: "", method: RequestMethod.ALL }).forRoutes("*"); + consumer + .apply(RequestTokenMiddleware) + .forRoutes("v1/code-table", "v1/case", "v1/configuration", "v1/complaint/search", "v1/complaint/map/search"); } } diff --git a/backend/src/types/models/complaints/complaint-filter-parameters.ts b/backend/src/types/models/complaints/complaint-filter-parameters.ts index c61ef73bb..d35f18387 100644 --- a/backend/src/types/models/complaints/complaint-filter-parameters.ts +++ b/backend/src/types/models/complaints/complaint-filter-parameters.ts @@ -11,4 +11,5 @@ export interface ComplaintFilterParameters { status?: string; girTypeCode?: string; complaintMethod?: string; + actionTaken?: string; } diff --git a/backend/src/v1/complaint/complaint.controller.ts b/backend/src/v1/complaint/complaint.controller.ts index 6a8663afd..20a53a4f3 100644 --- a/backend/src/v1/complaint/complaint.controller.ts +++ b/backend/src/v1/complaint/complaint.controller.ts @@ -3,6 +3,7 @@ import { ComplaintService } from "./complaint.service"; import { Role } from "../../enum/role.enum"; import { Roles } from "../../auth/decorators/roles.decorator"; import { JwtRoleGuard } from "../../auth/jwtrole.guard"; +import { Token } from "../../auth/decorators/token.decorator"; import { ApiTags } from "@nestjs/swagger"; import { COMPLAINT_TYPE } from "../../types/models/complaints/complaint-type"; import { WildlifeComplaintDto } from "../../types/models/complaints/wildlife-complaint"; @@ -45,22 +46,24 @@ export class ComplaintController { @Param("complaintType") complaintType: COMPLAINT_TYPE, @Query() model: ComplaintSearchParameters, @Request() req, + @Token() token, ) { - const hasCEEBRole = hasRole(req, Role.CEEB); - return this.service.mapSearch(complaintType, model, hasCEEBRole); + return this.service.mapSearch(complaintType, model, hasCEEBRole, token); } @Get("/search/:complaintType") @Roles(Role.COS_OFFICER, Role.CEEB) - search( + async search( @Param("complaintType") complaintType: COMPLAINT_TYPE, @Query() model: ComplaintSearchParameters, @Request() req, + @Token() token, ) { const hasCEEBRole = hasRole(req, Role.CEEB); - return this.service.search(complaintType, model, hasCEEBRole); + const result = await this.service.search(complaintType, model, hasCEEBRole, token); + return result; } @Patch("/update-status-by-id/:id") diff --git a/backend/src/v1/complaint/complaint.service.ts b/backend/src/v1/complaint/complaint.service.ts index 3f44293e7..585bf193e 100644 --- a/backend/src/v1/complaint/complaint.service.ts +++ b/backend/src/v1/complaint/complaint.service.ts @@ -4,6 +4,7 @@ import { InjectRepository } from "@nestjs/typeorm"; import { Brackets, DataSource, QueryRunner, Repository, SelectQueryBuilder } from "typeorm"; import { InjectMapper } from "@automapper/nestjs"; import { Mapper } from "@automapper/core"; +import { get } from "../../external_api/case_management"; import { applyAllegationComplaintMap, @@ -737,6 +738,25 @@ export class ComplaintService { return Promise.resolve(results); }; + private _getComplaintsByActionTaken = async (token: string, actionTaken: string): Promise => { + const { data, errors } = await get(token, { + query: `{getLeadsByActionTaken (actionCode: "${actionTaken}")}`, + }); + if (errors) { + this.logger.error("GraphQL errors:", errors); + throw new Error("GraphQL errors occurred"); + } + /** + * If no leads in the case manangement database have had the selected action taken, `getLeadsByActionTaken` + * returns an empty array, and WHERE...IN () does not accept an empty set, it throws an error. In our use + * case, if `getLeadsByActionTaken` returns an empty array, we do not want the entire search to error, it + * should simply return an empty result set. To handle this, if `getLeadsByActionTaken` returns an empty + * array, we populate the array with a value that would never match on a complaint_identifier: -1. + */ + const complaintIdentifiers = data.getLeadsByActionTaken.length > 0 ? data.getLeadsByActionTaken : ["-1"]; + return complaintIdentifiers; + }; + findAllByType = async ( complaintType: COMPLAINT_TYPE, ): Promise | Array> => { @@ -843,6 +863,7 @@ export class ComplaintService { complaintType: COMPLAINT_TYPE, model: ComplaintSearchParameters, hasCEEBRole: boolean, + token?: string, ): Promise => { try { let results: SearchResults = { totalCount: 0, complaints: [] }; @@ -871,6 +892,15 @@ export class ComplaintService { builder.andWhere("violation_code.agency_code = :agency", { agency: "EPO" }); } + // -- filter by complaint identifiers returned by case management if actionTaken filter is present + if (hasCEEBRole && filters.actionTaken) { + const complaintIdentifiers = await this._getComplaintsByActionTaken(token, filters.actionTaken); + + builder.andWhere("complaint.complaint_identifier IN(:...complaint_identifiers)", { + complaint_identifiers: complaintIdentifiers, + }); + } + //-- apply search if (query) { builder = this._applySearch(builder, complaintType, query); @@ -946,6 +976,7 @@ export class ComplaintService { complaintType: COMPLAINT_TYPE, model: ComplaintSearchParameters, hasCEEBRole: boolean, + token?: string, ): Promise => { const { orderBy, sortBy, page, pageSize, query, ...filters } = model; @@ -985,9 +1016,6 @@ export class ComplaintService { complaintBuilder.andWhere("ST_X(complaint.location_geometry_point) <> 0"); complaintBuilder.andWhere("ST_Y(complaint.location_geometry_point) <> 0"); - //-- run query - const mappedComplaints = await complaintBuilder.getMany(); - //-- get unmapable complaints let unMappedBuilder = this._generateQueryBuilder(complaintType); @@ -1008,7 +1036,6 @@ export class ComplaintService { }); } - //-- added this for consistency with search method //-- return Waste and Pestivide complaints for CEEB users if (hasCEEBRole && complaintType === "ERS") { @@ -1019,7 +1046,19 @@ export class ComplaintService { unMappedBuilder.andWhere("ST_X(complaint.location_geometry_point) = 0"); unMappedBuilder.andWhere("ST_Y(complaint.location_geometry_point) = 0"); - //-- run query + // -- filter by complaint identifiers returned by case management if actionTaken filter is present + if (hasCEEBRole && filters.actionTaken) { + const complaintIdentifiers = await this._getComplaintsByActionTaken(token, filters.actionTaken); + complaintBuilder.andWhere("complaint.complaint_identifier IN(:...complaint_identifiers)", { + complaint_identifiers: complaintIdentifiers, + }); + unMappedBuilder.andWhere("complaint.complaint_identifier IN(:...complaint_identifiers)", { + complaint_identifiers: complaintIdentifiers, + }); + } + + //-- run queries + const mappedComplaints = await complaintBuilder.getMany(); const unmappedComplaints = await unMappedBuilder.getCount(); results = { ...results, unmappedComplaints }; diff --git a/frontend/cypress/e2e/complaint-search.v2.cy.ts b/frontend/cypress/e2e/complaint-search.v2.cy.ts index 3e65b789d..d21cedfb2 100644 --- a/frontend/cypress/e2e/complaint-search.v2.cy.ts +++ b/frontend/cypress/e2e/complaint-search.v2.cy.ts @@ -1,3 +1,5 @@ +import Roles from "../../src/app/types/app/roles"; +import COMPLAINT_TYPES from "../../src/app/types/app/complaint-types"; /* Tests to verify complaint list specification functionality */ @@ -146,3 +148,59 @@ describe("Complaint Search Functionality", () => { }); }); }); + +/** + * Test that CEEB specific search filters work + */ +describe("Verify CEEB specific search filters work", () => { + beforeEach(function () { + cy.viewport("macbook-16"); + cy.kcLogout().kcLogin(Roles.CEEB); + }); + + function needsDecision() { + let needsDecision = false; + cy.get("#ceeb-decision").then((decisionWrapper) => { + // If the action taken input is on the page, a decision needs to be made + if (decisionWrapper.find("#outcome-decision-action-taken").length > 0) { + needsDecision = true; + } + }); + return needsDecision; + } + + it.only("allows filtering of complaints by Action Taken", function () { + // Navigate to the complaint list + const complaintWithActionTakenID = "23-030990"; + const actionTaken = "Forward to lead agency"; + + // Check if complaintWithActionTakenID already has a decision. + cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS, complaintWithActionTakenID, true); + // If the action taken input is available then the complaint does not yet have a decision made on it. + // Set an action taken so that the filter will have results to return. + if (needsDecision()) { + cy.selectItemById("outcome-decision-schedule-sector", "Other"); + cy.selectItemById("outcome-decision-sector-category", "None"); + cy.selectItemById("outcome-decision-discharge", "Pesticides"); + cy.selectItemById("outcome-decision-action-taken", actionTaken); + cy.selectItemById("outcome-decision-lead-agency", "Other"); + cy.enterDateTimeInDatePicker("outcome-decision-outcome-date", "01"); + // If the complaint is not assigned to anyone, assign it to self + if (cy.get("#comp-details-assigned-officer-name-text-id").contains("Not Assigned")) { + cy.get("#details-screen-assign-button").should("exist").click(); + cy.get("#self_assign_button").should("exist").click(); + } + cy.get(".modal").should("not.exist"); // Ensure that the quick assign modal has closed + cy.get("#ceeb-decision > .card-body > .comp-details-form-buttons > #outcome-decision-save-button").click(); + cy.contains("div", "Decision added").should("exist"); + } + + // Return to the complaints view + cy.get("#complaints-link").click(); + + // Filter by action taken + cy.get("#comp-filter-btn").should("exist").click({ force: true }); + cy.selectItemById("action-taken-select-id", actionTaken); + cy.get(`#${complaintWithActionTakenID}`).should("exist"); + }); +}); diff --git a/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx b/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx index f0ad8dd28..e1a6a9ffd 100644 --- a/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx +++ b/frontend/src/app/components/containers/complaints/complaint-filter-bar.tsx @@ -41,6 +41,7 @@ export const ComplaintFilterBar: FC = ({ violationType, girType, complaintMethod, + actionTaken, } = state; const dateRangeLabel = (): string | undefined => { @@ -220,6 +221,15 @@ export const ComplaintFilterBar: FC = ({ clear={removeFilter} /> )} + + {hasFilter("actionTaken") && ( + + )}
); diff --git a/frontend/src/app/components/containers/complaints/complaint-filter.tsx b/frontend/src/app/components/containers/complaints/complaint-filter.tsx index cbc1cc817..da2156b95 100644 --- a/frontend/src/app/components/containers/complaints/complaint-filter.tsx +++ b/frontend/src/app/components/containers/complaints/complaint-filter.tsx @@ -13,6 +13,7 @@ import { selectGirTypeCodeDropdown, selectComplaintReceivedMethodDropdown, } from "../../../store/reducers/code-table"; +import { selectDecisionTypeDropdown } from "../../../store/reducers/code-table-selectors"; import { selectOfficersByAgencyDropdown } from "../../../store/reducers/officer"; import COMPLAINT_TYPES from "../../../types/app/complaint-types"; import DatePicker from "react-datepicker"; @@ -20,8 +21,9 @@ import { CompSelect } from "../../common/comp-select"; import { ComplaintFilterContext } from "../../../providers/complaint-filter-provider"; import { ComplaintFilterPayload, updateFilter } from "../../../store/reducers/complaint-filters"; import Option from "../../../types/app/option"; -import { getUserAgency } from "../../../service/user-service"; import { listActiveFilters } from "../../../store/reducers/app"; +import UserService from "../../../service/user-service"; +import Roles from "../../../types/app/roles"; type Props = { type: string; @@ -42,11 +44,12 @@ export const ComplaintFilter: FC = ({ type }) => { endDate, girType, complaintMethod, + actionTaken, }, dispatch, } = useContext(ComplaintFilterContext); - const agency = getUserAgency(); + const agency = UserService.getUserAgency(); let officersByAgency = useAppSelector(selectOfficersByAgencyDropdown(agency)); if (officersByAgency && officersByAgency[0]?.value !== "Unassigned") { officersByAgency.unshift({ value: "Unassigned", label: "Unassigned" }); @@ -62,6 +65,7 @@ export const ComplaintFilter: FC = ({ type }) => { const communities = useAppSelector(selectCascadedCommunity(region?.value, zone?.value, community?.value)); const complaintMethods = useAppSelector(selectComplaintReceivedMethodDropdown); + const decisionTypeOptions = useAppSelector(selectDecisionTypeDropdown); const activeFilters = useAppSelector(listActiveFilters()); @@ -224,8 +228,9 @@ export const ComplaintFilter: FC = ({ type }) => {
)} + {UserService.hasRole(Roles.CEEB) && ( +
+ +
+ { + setFilter("actionTaken", option); + }} + classNames={{ + menu: () => "top-layer-select", + }} + options={decisionTypeOptions} + placeholder="Select" + enableValidation={false} + value={actionTaken} + isClearable={true} + /> +
+
+ )}
); }; diff --git a/frontend/src/app/components/containers/complaints/complaint-list.tsx b/frontend/src/app/components/containers/complaints/complaint-list.tsx index 7a5fbec05..187770ed6 100644 --- a/frontend/src/app/components/containers/complaints/complaint-list.tsx +++ b/frontend/src/app/components/containers/complaints/complaint-list.tsx @@ -52,6 +52,7 @@ export const generateComplaintRequestPayload = ( violationType, girType, complaintMethod, + actionTaken, } = filters; const common = { @@ -80,6 +81,7 @@ export const generateComplaintRequestPayload = ( ...common, violationFilter: violationType, complaintMethodFilter: complaintMethod, + actionTakenFilter: actionTaken, } as ComplaintRequestPayload; case COMPLAINT_TYPES.HWCR: default: @@ -114,7 +116,6 @@ export const ComplaintList: FC = ({ type, searchQuery }) => { if (searchQuery) { payload = { ...payload, query: searchQuery }; } - dispatch(getComplaints(type, payload)); // eslint-disable-next-line react-hooks/exhaustive-deps }, [filters, sortKey, sortDirection, page, pageSize]); diff --git a/frontend/src/app/components/containers/complaints/complaint-map.tsx b/frontend/src/app/components/containers/complaints/complaint-map.tsx index 4ad79b41d..d599e8ea9 100644 --- a/frontend/src/app/components/containers/complaints/complaint-map.tsx +++ b/frontend/src/app/components/containers/complaints/complaint-map.tsx @@ -36,6 +36,7 @@ export const generateMapComplaintRequestPayload = ( natureOfComplaint, violationType, complaintMethod, + actionTaken, } = filters; const common = { @@ -48,6 +49,7 @@ export const generateMapComplaintRequestPayload = ( startDateFilter: startDate, endDateFilter: endDate, complaintStatusFilter: status, + actionTakenFilter: actionTaken, }; switch (complaintType) { diff --git a/frontend/src/app/providers/complaint-filter-provider.tsx b/frontend/src/app/providers/complaint-filter-provider.tsx index 61bfd985e..b38aa4c16 100644 --- a/frontend/src/app/providers/complaint-filter-provider.tsx +++ b/frontend/src/app/providers/complaint-filter-provider.tsx @@ -26,6 +26,7 @@ let initialState: ComplaintFilters = { violationType: null, filters: [], complaintMethod: null, + actionTaken: null, }; const ComplaintFilterContext = createContext({ diff --git a/frontend/src/app/store/reducers/complaints.ts b/frontend/src/app/store/reducers/complaints.ts index 5c2460777..b761d1a7a 100644 --- a/frontend/src/app/store/reducers/complaints.ts +++ b/frontend/src/app/store/reducers/complaints.ts @@ -277,6 +277,7 @@ export const getComplaints = girTypeFilter, complaintStatusFilter, complaintMethodFilter, + actionTakenFilter, page, pageSize, query, @@ -300,6 +301,7 @@ export const getComplaints = girTypeCode: girTypeFilter?.value, status: complaintStatusFilter?.value, complaintMethod: complaintMethodFilter?.value, + actionTaken: actionTakenFilter?.value, page: page, pageSize: pageSize, query: query, @@ -331,6 +333,7 @@ export const getMappedComplaints = violationFilter, complaintStatusFilter, complaintMethodFilter, + actionTakenFilter, page, pageSize, query, @@ -353,6 +356,7 @@ export const getMappedComplaints = violationCode: violationFilter?.value, status: complaintStatusFilter?.value, complaintMethod: complaintMethodFilter?.value, + actionTaken: actionTakenFilter?.value, page: page, pageSize: pageSize, query: query, diff --git a/frontend/src/app/types/complaints/complaint-filters.ts b/frontend/src/app/types/complaints/complaint-filters.ts index 40e84c81d..21c182f2c 100644 --- a/frontend/src/app/types/complaints/complaint-filters.ts +++ b/frontend/src/app/types/complaints/complaint-filters.ts @@ -15,6 +15,7 @@ export interface ComplaintFilters { endDateFilter?: Date; complaintStatusFilter?: Option; complaintMethodFilter?: Option; + actionTakenFilter?: Option; page?: number; pageSize?: number; query?: string; diff --git a/frontend/src/app/types/complaints/complaint-filters/complaint-filters.ts b/frontend/src/app/types/complaints/complaint-filters/complaint-filters.ts index 6e8975c90..614098d0a 100644 --- a/frontend/src/app/types/complaints/complaint-filters/complaint-filters.ts +++ b/frontend/src/app/types/complaints/complaint-filters/complaint-filters.ts @@ -20,5 +20,7 @@ export type ComplaintFilters = { complaintMethod: DropdownOption | null; + actionTaken?: DropdownOption | null; + filters: Array; }; From 10fa97d8c4616860900447ea9de522fc1cca3b26 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Thu, 17 Oct 2024 13:16:44 -0700 Subject: [PATCH 21/25] chore: also add Suha --- migrations/test-only-migrations/R__Test-Data-Creation.sql | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/migrations/test-only-migrations/R__Test-Data-Creation.sql b/migrations/test-only-migrations/R__Test-Data-Creation.sql index 4b33a05fc..78973b096 100644 --- a/migrations/test-only-migrations/R__Test-Data-Creation.sql +++ b/migrations/test-only-migrations/R__Test-Data-Creation.sql @@ -305,6 +305,10 @@ VALUES('74bb4bdd-5944-4a78-a20c-c5b494decc2a'::uuid, 'Dragos', NULL, NULL, 'Vuia ON CONFLICT DO NOTHING; INSERT INTO public.person (person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) +VALUES('fd3654be-21f2-4fc9-ae6a-39615b732a1a'::uuid, 'Suha', NULL, NULL, 'Fatima', 'FLYWAY', '2024-01-10 22:16:16.754', 'FLYWAY', '2024-01-10 22:16:16.754') +ON CONFLICT DO NOTHING; +INSERT INTO public.person +(person_guid, first_name, middle_name_1, middle_name_2, last_name, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp) VALUES('f67e52f5-ac3f-48e0-ad64-cab1eae51a18'::uuid, 'Dmitri', NULL, NULL, 'Korin', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:16:16.754') ON CONFLICT DO NOTHING; INSERT INTO public.person @@ -457,6 +461,10 @@ INSERT INTO public.officer VALUES('3fc8a9db-e085-4461-bce2-b05462b79794'::uuid, 'DVUIA', 'FLYWAY', '2024-01-10 22:16:16.754', 'FLYWAY', '2024-01-10 22:20:48.186', '74bb4bdd-5944-4a78-a20c-c5b494decc2a'::uuid, '3f474308-68da-450a-b1ab-fb8a5b7a27ce'::uuid) ON CONFLICT DO NOTHING; INSERT INTO public.officer +(officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, auth_user_guid) +VALUES('60e7403e-9933-4eff-89ae-508c0c827130'::uuid, 'SFATIMA', 'FLYWAY', '2024-01-10 22:16:16.754', 'FLYWAY', '2024-01-10 22:20:48.186', 'fd3654be-21f2-4fc9-ae6a-39615b732a1a'::uuid, 'cafc87f3-738c-49bd-9bfb-33d7f01d50b9'::uuid) +ON CONFLICT DO NOTHING; +INSERT INTO public.officer (officer_guid, user_id, create_user_id, create_utc_timestamp, update_user_id, update_utc_timestamp, person_guid, office_guid) VALUES('56582c3c-6819-43c8-8d89-8e43823500c3'::uuid, 'DKORIN', 'FLYWAY', '2024-01-22 22:16:16.754', 'FLYWAY', '2024-01-22 22:20:48.186', 'f67e52f5-ac3f-48e0-ad64-cab1eae51a18'::uuid, '79fe321b-7716-413f-b878-c5fd6100317d'::uuid) ON CONFLICT DO NOTHING; From a338648b31a9be58c5287b4b593ae43c6de7800a Mon Sep 17 00:00:00 2001 From: Ryan Rondeau Date: Thu, 17 Oct 2024 14:39:34 -0700 Subject: [PATCH 22/25] fix: CE 1124 (#711) --- .github/workflows/pr-version-bump.yml | 6 +++++- .github/workflows/release-branch-creation.yml | 6 +++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pr-version-bump.yml b/.github/workflows/pr-version-bump.yml index 2bbf6a12f..507c508e2 100644 --- a/.github/workflows/pr-version-bump.yml +++ b/.github/workflows/pr-version-bump.yml @@ -12,6 +12,10 @@ jobs: if: ${{ github.event.pull_request.merged == true }} steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + fetch-tags: true - name: Fetch all tags run: git fetch --tags --force @@ -19,7 +23,7 @@ jobs: - name: Fetch tags from main id: get_latest_tag run: | - git fetch origin main --tags + git fetch origin main --tags --force latest_tag=$(git tag --list --sort=-v:refname --merged | head -n 1) echo "::set-output name=latest_tag::$latest_tag" echo "Latest tag: $latest_tag" diff --git a/.github/workflows/release-branch-creation.yml b/.github/workflows/release-branch-creation.yml index d162d6259..dc1e58e9f 100644 --- a/.github/workflows/release-branch-creation.yml +++ b/.github/workflows/release-branch-creation.yml @@ -11,6 +11,10 @@ jobs: if: startsWith(github.ref, 'refs/heads/release/') && !contains(github.ref, '/') steps: - uses: actions/checkout@v4 + with: + ref: ${{ github.ref }} + fetch-depth: 0 + fetch-tags: true - name: Install npm run: sudo apt-get install -y npm @@ -19,7 +23,7 @@ jobs: - name: Fetch latest tag id: latest_tag run: | - git fetch --tags + git fetch --tags --force latest_tag=$(git tag --list --sort=-v:refname --merged | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -n 1) if [ -z "$latest_tag" ]; then echo "No previous tags found, starting with v0.1.0" From f8eec6c6d0acc176e4b07d040e2da140baff21cc Mon Sep 17 00:00:00 2001 From: afwilcox Date: Fri, 18 Oct 2024 08:14:34 -0700 Subject: [PATCH 23/25] fix: add spinner to cypress and increase timeout --- frontend/cypress.config.ts | 2 +- frontend/cypress/e2e/complaint-search.v2.cy.ts | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index 871a2c546..64f64a75a 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -7,7 +7,7 @@ const { isFileExist } = require("cy-verify-downloads"); const { removeDirectory } = require("cypress-delete-downloads-folder"); export default defineConfig({ - defaultCommandTimeout: 20000, + defaultCommandTimeout: 40000, e2e: { baseUrl: "http://localhost:3000", experimentalStudio: true, diff --git a/frontend/cypress/e2e/complaint-search.v2.cy.ts b/frontend/cypress/e2e/complaint-search.v2.cy.ts index d21cedfb2..2007de70a 100644 --- a/frontend/cypress/e2e/complaint-search.v2.cy.ts +++ b/frontend/cypress/e2e/complaint-search.v2.cy.ts @@ -201,6 +201,7 @@ describe("Verify CEEB specific search filters work", () => { // Filter by action taken cy.get("#comp-filter-btn").should("exist").click({ force: true }); cy.selectItemById("action-taken-select-id", actionTaken); + cy.waitForSpinner(); cy.get(`#${complaintWithActionTakenID}`).should("exist"); }); }); From f659b50b44855ccb5cb2e392ce3b9029db13bb61 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Fri, 18 Oct 2024 10:33:33 -0700 Subject: [PATCH 24/25] fix: split cypress tests, remove filters --- .../cypress/e2e/complaint-filters-ceeb.cy.ts | 63 +++++++++++++++++++ .../cypress/e2e/complaint-search.v2.cy.ts | 57 ----------------- 2 files changed, 63 insertions(+), 57 deletions(-) create mode 100644 frontend/cypress/e2e/complaint-filters-ceeb.cy.ts diff --git a/frontend/cypress/e2e/complaint-filters-ceeb.cy.ts b/frontend/cypress/e2e/complaint-filters-ceeb.cy.ts new file mode 100644 index 000000000..111c08f78 --- /dev/null +++ b/frontend/cypress/e2e/complaint-filters-ceeb.cy.ts @@ -0,0 +1,63 @@ +import Roles from "../../src/app/types/app/roles"; +import COMPLAINT_TYPES from "../../src/app/types/app/complaint-types"; + +/** + * Test that CEEB specific search filters work + */ +describe("Verify CEEB specific search filters work", () => { + beforeEach(function () { + cy.viewport("macbook-16"); + cy.kcLogout().kcLogin(Roles.CEEB); + }); + + function needsDecision() { + let needsDecision = false; + cy.get("#ceeb-decision").then((decisionWrapper) => { + // If the action taken input is on the page, a decision needs to be made + if (decisionWrapper.find("#outcome-decision-action-taken").length > 0) { + needsDecision = true; + } + }); + return needsDecision; + } + + it.only("allows filtering of complaints by Action Taken", function () { + // Navigate to the complaint list + const complaintWithActionTakenID = "23-030990"; + const actionTaken = "Forward to lead agency"; + + // Check if complaintWithActionTakenID already has a decision. + cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS, complaintWithActionTakenID, true); + // If the action taken input is available then the complaint does not yet have a decision made on it. + // Set an action taken so that the filter will have results to return. + if (needsDecision()) { + cy.selectItemById("outcome-decision-schedule-sector", "Other"); + cy.selectItemById("outcome-decision-sector-category", "None"); + cy.selectItemById("outcome-decision-discharge", "Pesticides"); + cy.selectItemById("outcome-decision-action-taken", actionTaken); + cy.selectItemById("outcome-decision-lead-agency", "Other"); + cy.enterDateTimeInDatePicker("outcome-decision-outcome-date", "01"); + // If the complaint is not assigned to anyone, assign it to self + if (cy.get("#comp-details-assigned-officer-name-text-id").contains("Not Assigned")) { + cy.get("#details-screen-assign-button").should("exist").click(); + cy.get("#self_assign_button").should("exist").click(); + } + cy.get(".modal").should("not.exist"); // Ensure that the quick assign modal has closed + cy.get("#ceeb-decision > .card-body > .comp-details-form-buttons > #outcome-decision-save-button").click(); + cy.contains("div", "Decision added").should("exist"); + } + + // Return to the complaints view + cy.get("#complaints-link").click(); + + // Clear filters + cy.get("#comp-status-filter").click({ force: true }); + cy.get("#comp-officer-filter").click({ force: true }); + + // Filter by action taken + cy.get("#comp-filter-btn").should("exist").click({ force: true }); + cy.selectItemById("action-taken-select-id", actionTaken); + cy.waitForSpinner(); + cy.get(`#${complaintWithActionTakenID}`).should("exist"); + }); +}); diff --git a/frontend/cypress/e2e/complaint-search.v2.cy.ts b/frontend/cypress/e2e/complaint-search.v2.cy.ts index 2007de70a..14680c640 100644 --- a/frontend/cypress/e2e/complaint-search.v2.cy.ts +++ b/frontend/cypress/e2e/complaint-search.v2.cy.ts @@ -148,60 +148,3 @@ describe("Complaint Search Functionality", () => { }); }); }); - -/** - * Test that CEEB specific search filters work - */ -describe("Verify CEEB specific search filters work", () => { - beforeEach(function () { - cy.viewport("macbook-16"); - cy.kcLogout().kcLogin(Roles.CEEB); - }); - - function needsDecision() { - let needsDecision = false; - cy.get("#ceeb-decision").then((decisionWrapper) => { - // If the action taken input is on the page, a decision needs to be made - if (decisionWrapper.find("#outcome-decision-action-taken").length > 0) { - needsDecision = true; - } - }); - return needsDecision; - } - - it.only("allows filtering of complaints by Action Taken", function () { - // Navigate to the complaint list - const complaintWithActionTakenID = "23-030990"; - const actionTaken = "Forward to lead agency"; - - // Check if complaintWithActionTakenID already has a decision. - cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS, complaintWithActionTakenID, true); - // If the action taken input is available then the complaint does not yet have a decision made on it. - // Set an action taken so that the filter will have results to return. - if (needsDecision()) { - cy.selectItemById("outcome-decision-schedule-sector", "Other"); - cy.selectItemById("outcome-decision-sector-category", "None"); - cy.selectItemById("outcome-decision-discharge", "Pesticides"); - cy.selectItemById("outcome-decision-action-taken", actionTaken); - cy.selectItemById("outcome-decision-lead-agency", "Other"); - cy.enterDateTimeInDatePicker("outcome-decision-outcome-date", "01"); - // If the complaint is not assigned to anyone, assign it to self - if (cy.get("#comp-details-assigned-officer-name-text-id").contains("Not Assigned")) { - cy.get("#details-screen-assign-button").should("exist").click(); - cy.get("#self_assign_button").should("exist").click(); - } - cy.get(".modal").should("not.exist"); // Ensure that the quick assign modal has closed - cy.get("#ceeb-decision > .card-body > .comp-details-form-buttons > #outcome-decision-save-button").click(); - cy.contains("div", "Decision added").should("exist"); - } - - // Return to the complaints view - cy.get("#complaints-link").click(); - - // Filter by action taken - cy.get("#comp-filter-btn").should("exist").click({ force: true }); - cy.selectItemById("action-taken-select-id", actionTaken); - cy.waitForSpinner(); - cy.get(`#${complaintWithActionTakenID}`).should("exist"); - }); -}); From 000f5bd4e722c69015a8f8f499948799bf56d77b Mon Sep 17 00:00:00 2001 From: afwilcox Date: Mon, 21 Oct 2024 10:43:35 -0700 Subject: [PATCH 25/25] fix: Remove CEEB tests from complaint search --- .../cypress/e2e/complaint-search.v2.cy.ts | 56 ------------------- 1 file changed, 56 deletions(-) diff --git a/frontend/cypress/e2e/complaint-search.v2.cy.ts b/frontend/cypress/e2e/complaint-search.v2.cy.ts index d21cedfb2..14680c640 100644 --- a/frontend/cypress/e2e/complaint-search.v2.cy.ts +++ b/frontend/cypress/e2e/complaint-search.v2.cy.ts @@ -148,59 +148,3 @@ describe("Complaint Search Functionality", () => { }); }); }); - -/** - * Test that CEEB specific search filters work - */ -describe("Verify CEEB specific search filters work", () => { - beforeEach(function () { - cy.viewport("macbook-16"); - cy.kcLogout().kcLogin(Roles.CEEB); - }); - - function needsDecision() { - let needsDecision = false; - cy.get("#ceeb-decision").then((decisionWrapper) => { - // If the action taken input is on the page, a decision needs to be made - if (decisionWrapper.find("#outcome-decision-action-taken").length > 0) { - needsDecision = true; - } - }); - return needsDecision; - } - - it.only("allows filtering of complaints by Action Taken", function () { - // Navigate to the complaint list - const complaintWithActionTakenID = "23-030990"; - const actionTaken = "Forward to lead agency"; - - // Check if complaintWithActionTakenID already has a decision. - cy.navigateToDetailsScreen(COMPLAINT_TYPES.ERS, complaintWithActionTakenID, true); - // If the action taken input is available then the complaint does not yet have a decision made on it. - // Set an action taken so that the filter will have results to return. - if (needsDecision()) { - cy.selectItemById("outcome-decision-schedule-sector", "Other"); - cy.selectItemById("outcome-decision-sector-category", "None"); - cy.selectItemById("outcome-decision-discharge", "Pesticides"); - cy.selectItemById("outcome-decision-action-taken", actionTaken); - cy.selectItemById("outcome-decision-lead-agency", "Other"); - cy.enterDateTimeInDatePicker("outcome-decision-outcome-date", "01"); - // If the complaint is not assigned to anyone, assign it to self - if (cy.get("#comp-details-assigned-officer-name-text-id").contains("Not Assigned")) { - cy.get("#details-screen-assign-button").should("exist").click(); - cy.get("#self_assign_button").should("exist").click(); - } - cy.get(".modal").should("not.exist"); // Ensure that the quick assign modal has closed - cy.get("#ceeb-decision > .card-body > .comp-details-form-buttons > #outcome-decision-save-button").click(); - cy.contains("div", "Decision added").should("exist"); - } - - // Return to the complaints view - cy.get("#complaints-link").click(); - - // Filter by action taken - cy.get("#comp-filter-btn").should("exist").click({ force: true }); - cy.selectItemById("action-taken-select-id", actionTaken); - cy.get(`#${complaintWithActionTakenID}`).should("exist"); - }); -});