From 4525dfae99bbebec42107dc534fe6067a97b5f76 Mon Sep 17 00:00:00 2001 From: Scarlett <35635257+Scarlett-Truong@users.noreply.github.com> Date: Fri, 12 Jul 2024 09:54:15 -0700 Subject: [PATCH 1/4] fix: CE-875 ERS filter for dumping broken (#516) --- backend/db/test-only-migrations/V23.0.0__CE-875.sql | 5 +++++ .../middleware/maps/automapper-entity-to-dto-maps.ts | 4 ++++ .../list-items/allegation-complaint-list-item.tsx | 10 +--------- .../list-items/wildlife-complaint-list-item.tsx | 10 +--------- frontend/src/app/types/app/complaints/complaint.ts | 1 + 5 files changed, 12 insertions(+), 18 deletions(-) create mode 100644 backend/db/test-only-migrations/V23.0.0__CE-875.sql diff --git a/backend/db/test-only-migrations/V23.0.0__CE-875.sql b/backend/db/test-only-migrations/V23.0.0__CE-875.sql new file mode 100644 index 000000000..e9f364e6f --- /dev/null +++ b/backend/db/test-only-migrations/V23.0.0__CE-875.sql @@ -0,0 +1,5 @@ +update complaint +set + geo_organization_unit_code = 'QUEENCHA' +where + geo_organization_unit_code = 'DJNG'; \ No newline at end of file diff --git a/backend/src/middleware/maps/automapper-entity-to-dto-maps.ts b/backend/src/middleware/maps/automapper-entity-to-dto-maps.ts index 25d867d93..3eece8d0f 100644 --- a/backend/src/middleware/maps/automapper-entity-to-dto-maps.ts +++ b/backend/src/middleware/maps/automapper-entity-to-dto-maps.ts @@ -45,6 +45,10 @@ const cosGeoOrgUnitToOrganizationDtoMap = (mapper: Mapper) => { (destination) => destination.area, mapFrom((source) => source.area_code), ), + forMember( + (destination) => destination.areaName, + mapFrom((source) => source.area_name), + ), forMember( (destination) => destination.officeLocation, mapFrom((source) => source.office_location_code), diff --git a/frontend/src/app/components/containers/complaints/list-items/allegation-complaint-list-item.tsx b/frontend/src/app/components/containers/complaints/list-items/allegation-complaint-list-item.tsx index 41c5d147c..00e094ae0 100644 --- a/frontend/src/app/components/containers/complaints/list-items/allegation-complaint-list-item.tsx +++ b/frontend/src/app/components/containers/complaints/list-items/allegation-complaint-list-item.tsx @@ -15,7 +15,6 @@ type Props = { }; export const AllegationComplaintListItem: FC = ({ type, complaint }) => { - const areaCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.AREA_CODES)); const statusCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.COMPLAINT_STATUS)); const violationCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.VIOLATIONS)); @@ -35,14 +34,9 @@ export const AllegationComplaintListItem: FC = ({ type, complaint }) => { locationDetail, locationSummary, delegates, - organization: { area: locationCode, zone }, + organization: { areaName: location, zone }, } = complaint; - const getLocationName = (input: string): string => { - const code = areaCodes.find((item) => item.area === input); - return code.areaName; - }; - const getStatusDescription = (input: string): string => { const code = statusCodes.find((item) => item.complaintStatus === input); return code.longDescription; @@ -88,8 +82,6 @@ export const AllegationComplaintListItem: FC = ({ type, complaint }) => { const reportedOnDateTime = formatDateTime(reportedOn.toString()); const updatedOnDateTime = formatDateTime(updatedOn.toString()); - const location = getLocationName(locationCode); - const statusButtonClass = `badge ${applyStatusClass(status)}`; const inProgressFlag = isInProgress ? "In Progress" : ""; diff --git a/frontend/src/app/components/containers/complaints/list-items/wildlife-complaint-list-item.tsx b/frontend/src/app/components/containers/complaints/list-items/wildlife-complaint-list-item.tsx index 324a99cb4..b15db4a36 100644 --- a/frontend/src/app/components/containers/complaints/list-items/wildlife-complaint-list-item.tsx +++ b/frontend/src/app/components/containers/complaints/list-items/wildlife-complaint-list-item.tsx @@ -14,7 +14,6 @@ type Props = { }; export const WildlifeComplaintListItem: FC = ({ type, complaint }) => { - const areaCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.AREA_CODES)); const statusCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.COMPLAINT_STATUS)); const natureOfComplaints = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.NATURE_OF_COMPLAINT)); const speciesCodes = useAppSelector(selectCodeTable(CODE_TABLE_TYPES.SPECIES)); @@ -35,14 +34,9 @@ export const WildlifeComplaintListItem: FC = ({ type, complaint }) => { locationDetail, locationSummary, delegates, - organization: { area: locationCode, zone }, + organization: { areaName: location, zone }, } = complaint; - const getLocationName = (input: string): string => { - const code = areaCodes.find((item) => item.area === input); - return code.areaName; - }; - const getStatusDescription = (input: string): string => { const code = statusCodes.find((item) => item.complaintStatus === input); return code.longDescription; @@ -93,8 +87,6 @@ export const WildlifeComplaintListItem: FC = ({ type, complaint }) => { const natureCode = getNatureOfComplaint(natureOfComplaint); const species = getSpecies(speciesCode); - const location = getLocationName(locationCode); - const statusButtonClass = `badge ${applyStatusClass(status)}`; const toggleExpand = () => { diff --git a/frontend/src/app/types/app/complaints/complaint.ts b/frontend/src/app/types/app/complaints/complaint.ts index f5e3a9ae3..739ca7a0d 100644 --- a/frontend/src/app/types/app/complaints/complaint.ts +++ b/frontend/src/app/types/app/complaints/complaint.ts @@ -23,6 +23,7 @@ export interface Complaint { updatedBy: string; organization: { area: string; + areaName?: string; zone: string; region: string; officeLocation?: string; From fe0233386330d8da2528dc4938614b24265863e0 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Fri, 12 Jul 2024 10:00:34 -0700 Subject: [PATCH 2/4] chore: Retry Cypress tests twice after failure (#515) --- frontend/cypress.config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/frontend/cypress.config.ts b/frontend/cypress.config.ts index b36228d46..e585f0dc4 100644 --- a/frontend/cypress.config.ts +++ b/frontend/cypress.config.ts @@ -33,4 +33,5 @@ export default defineConfig({ keycloak_login_url: "https://logontest7.gov.bc.ca", }, }, + retries: 2, }); From 91f8cc6386c0a54cc48d9d978a963b3b647cbdf6 Mon Sep 17 00:00:00 2001 From: jeznorth Date: Fri, 12 Jul 2024 10:51:36 -0700 Subject: [PATCH 3/4] CE-868 - Update Map Popup Layout (#512) Co-authored-by: afwilcox --- .../cypress/e2e/complaints-on-map-view.cy.ts | 5 +- .../mapping/complaint-summary-popup.tsx | 148 ++++++------------ frontend/src/assets/sass/maps.scss | 69 ++++++-- 3 files changed, 103 insertions(+), 119 deletions(-) diff --git a/frontend/cypress/e2e/complaints-on-map-view.cy.ts b/frontend/cypress/e2e/complaints-on-map-view.cy.ts index 78b3d38f5..035ce7306 100644 --- a/frontend/cypress/e2e/complaints-on-map-view.cy.ts +++ b/frontend/cypress/e2e/complaints-on-map-view.cy.ts @@ -126,11 +126,8 @@ describe("Complaints on map tests", () => { cy.get(".leaflet-popup").should("exist"); if ("#hwcr-tab".includes(complaintTypes[index])) { - cy.get("div.hwcr-conflict-type").should("exist"); - cy.get("div.hwcr-conflict-type").should("have.text", "Human Wildlife Conflict"); cy.get("#popup-community-label").should("exist"); - cy.get("#popup-community-label").should("have.text", "CommunityKelowna"); - cy.get("div.hwcr-conflict-type").should("not.have.text", "Human Wildlife Conflicts"); + cy.get("#popup-community-label").should("have.text", "Kelowna"); } // click the "view details" button to navigate to the complaint diff --git a/frontend/src/app/components/mapping/complaint-summary-popup.tsx b/frontend/src/app/components/mapping/complaint-summary-popup.tsx index 5ccb0a7ed..0170d2906 100644 --- a/frontend/src/app/components/mapping/complaint-summary-popup.tsx +++ b/frontend/src/app/components/mapping/complaint-summary-popup.tsx @@ -2,19 +2,10 @@ import { FC } from "react"; import { selectComplaintDetails, selectComplaintHeader } from "../../store/reducers/complaints"; import { useAppSelector } from "../../hooks/hooks"; import { ComplaintDetails } from "../../types/complaints/details/complaint-details"; -import { - applyStatusClass, - formatDate, - formatTime, - getAvatarInitials, - getFirstInitialAndLastName, -} from "../../common/methods"; -import COMPLAINT_TYPES, { complaintTypeToName } from "../../types/app/complaint-types"; -import { Button } from "react-bootstrap"; -import { Link } from "react-router-dom"; +import { applyStatusClass, formatDate, getFirstInitialAndLastName } from "../../common/methods"; +import COMPLAINT_TYPES from "../../types/app/complaint-types"; +import { Badge, Button } from "react-bootstrap"; import { Popup } from "react-leaflet"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faExclamationCircle } from "@fortawesome/free-solid-svg-icons"; interface Props { complaint_identifier: string; @@ -22,8 +13,9 @@ interface Props { } export const ComplaintSummaryPopup: FC = ({ complaint_identifier, complaintType }) => { - const { officerAssigned, natureOfComplaint, species, violationType, loggedDate, lastUpdated, status } = - useAppSelector(selectComplaintHeader(complaintType)); + const { officerAssigned, natureOfComplaint, species, violationType, loggedDate, status } = useAppSelector( + selectComplaintHeader(complaintType), + ); const { violationInProgress, location, area } = useAppSelector( selectComplaintDetails(complaintType), @@ -37,105 +29,61 @@ export const ComplaintSummaryPopup: FC = ({ complaint_identifier, complai return ( -
-
-
-
-
{complaint_identifier}
-
-
- - {officerAssigned} - -
-
-
- -
-
-
- {complaintTypeToName(complaintType, true)} -
- {renderHWCRSection ? ( -
{species}
- ) : ( - violationInProgress && ( -
- - {inProgressInd} -
- ) - )} -
- {status} -
-
-
+
+
+
+

{complaint_identifier}

+ + {status} +
-
{renderHWCRSection ? natureOfComplaint : violationType}
-
-
+
+ {renderHWCRSection ? (
- - - {formatDate(loggedDate)} - - {formatTime(loggedDate)} -
- -
- -
{location}
+ {species}{natureOfComplaint}
+ ) : (
- - {lastUpdated && ( - <> - - {formatDate(lastUpdated)} - - {formatTime(lastUpdated)} - - )} - {!lastUpdated && <>Not Available} + {violationType} • {inProgressInd}
-
+ )}
- +
+
+
+
Date Logged
+
{formatDate(loggedDate)}
+
+
+
Officer Assigned
+
{getFirstInitialAndLastName(officerAssigned)}
+
+
+
Community
+ +
+
+
Location
+
{location}
+
+
- +
); diff --git a/frontend/src/assets/sass/maps.scss b/frontend/src/assets/sass/maps.scss index 20400e361..22145670b 100644 --- a/frontend/src/assets/sass/maps.scss +++ b/frontend/src/assets/sass/maps.scss @@ -115,31 +115,70 @@ visibility: visible; } -/** Leaflet style updates **/ - +// MAP POPUP .leaflet-popup-tip { display: none; /* Hide the default tip (pointer) */ } .leaflet-popup-content-wrapper { - display: flex; - justify-content: center; - padding: 0px; + width: 360px; +} + +.leaflet-popup-content { + width: auto !important; + margin: 12px; + font-size: 1rem; } -.leaflet-popup-not-assigned { - margin-top: 5px; +.comp-map-popup-header { + margin-bottom: 12px; + padding-bottom: 12px; + border-bottom: 1px solid $gray-300; } -.leaflet-popup-content { +.comp-map-popup-header-title { display: flex; - align-items: center; - justify-content: center; - width: auto !important; - max-width: 100%; - margin: 24px !important; + flex-direction: row; + align-items: flex-start; + gap: 8px; + margin-bottom: 4px; + + h2 { + margin: 0; + font-size: 1.5rem; + font-weight: 700; + } + + .badge { + margin-top: 2px; + line-height: normal; + } } -.leaflet-popup-close-button { - display: none; +.comp-map-popup-details { + font-size: 0.875rem; + + dl div { + display: flex; + flex-direction: row; + gap: 8px; + + + div { + margin-top: 4px; + } + + dt { + flex: 0 0 auto; + width: 8rem; + font-weight: 400; + } + + dd { + margin-bottom: 0; + } + } + + .btn { + color: #fff; + } } From eb61a22fa64e6c45b9045b7803464209c1943b68 Mon Sep 17 00:00:00 2001 From: afwilcox Date: Tue, 16 Jul 2024 10:10:33 -0700 Subject: [PATCH 4/4] chore: Reduce Severity of Logging Message (#519) --- backend/src/v1/case_file/case_file.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/backend/src/v1/case_file/case_file.service.ts b/backend/src/v1/case_file/case_file.service.ts index 7c106f17b..74cc05b98 100644 --- a/backend/src/v1/case_file/case_file.service.ts +++ b/backend/src/v1/case_file/case_file.service.ts @@ -150,7 +150,7 @@ export class CaseFileService { const caseFileDto = data.getCaseFileByLeadId as CaseFileDto; return caseFileDto; } else { - this.logger.error(`Case with complaint Id ${complaint_id} not found.`); + this.logger.debug(`Case with complaint Id ${complaint_id} not found.`); return null; } };