Skip to content

Commit

Permalink
Golden Eagle (#503)
Browse files Browse the repository at this point in the history
Co-authored-by: Mike <100624415+marqueone-ps@users.noreply.github.com>
Co-authored-by: Mike Sears <mike.2.sears@gov.bc.ca>
Co-authored-by: afwilcox <alecwilcox@gmail.com>
Co-authored-by: dmitri-korin-bcps <108112696+dmitri-korin-bcps@users.noreply.github.com>
  • Loading branch information
5 people authored Jul 9, 2024
1 parent c200c75 commit 667d259
Show file tree
Hide file tree
Showing 46 changed files with 125 additions and 61 deletions.
2 changes: 0 additions & 2 deletions .github/workflows/merge-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,6 @@ jobs:
parameters: -p KEYCLOAK_URL=${{ vars.KEYCLOAK_URL_TEST }}
-p COMS_URL=${{ vars.COMS_URL_TEST }}
-p COMS_BUCKET=${{ vars.COMS_BUCKET_TEST }}
-p SHOW_EXPERIMENTAL_FEATURES=${{ vars.SHOW_EXPERIMENTAL_FEATURES_TEST }}
-p ENVIRONMENT_NAME=${{ vars.ENVIRONMENT_NAME_TEST }}
overwrite: true
- name: init
Expand Down Expand Up @@ -291,7 +290,6 @@ jobs:
parameters: -p KEYCLOAK_URL=${{ vars.KEYCLOAK_URL_PROD }}
-p COMS_URL=${{ vars.COMS_URL_PROD }}
-p COMS_BUCKET=${{ vars.COMS_BUCKET_PROD }}
-p SHOW_EXPERIMENTAL_FEATURES=${{ vars.SHOW_EXPERIMENTAL_FEATURES_PROD }}
overwrite: true
- name: init
file: common/openshift.init.yml
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/pr-open.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,6 @@ jobs:
-p KEYCLOAK_URL=${{ vars.KEYCLOAK_URL_DEV}}
-p COMS_URL=${{vars.COMS_URL_DEV}}
-p COMS_BUCKET=${{vars.COMS_BUCKET_DEV}}
-p SHOW_EXPERIMENTAL_FEATURES=${{ vars.SHOW_EXPERIMENTAL_FEATURES_DEV }}
-p CPU_REQUEST=25m
-p CPU_LIMIT=50m
-p MEMORY_REQUEST=40Mi
Expand Down
12 changes: 12 additions & 0 deletions backend/db/migrations/R__Create-Test-Data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -902,10 +902,22 @@ UPDATE agency_code SET display_order = 9 WHERE agency_code = 'OTHER';
------------------------------
update public.geo_organization_unit_code set administrative_office_ind = true where geo_organization_unit_code='COSHQ';


-----------------------
-- Move Hudson's Hope to Fort St. John Office in North Peace
-- This is temporary and will likely need to be removed in the future
-----------------------

update geo_org_unit_structure set parent_geo_org_unit_code='FRTSTJN' where parent_geo_org_unit_code = 'CHTWD' and child_geo_org_unit_code = 'HUDSONSH';

--------------------------
-- New Changes above this line
-------------------------

UPDATE configuration
SET configuration_value = configuration_value::int + 1
WHERE configuration_code = 'CDTABLEVER';




1 change: 1 addition & 0 deletions backend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
"date-fns": "^3.6.0",
"date-fns-tz": "^3.1.3",
"dotenv": "^16.0.1",
"escape-html": "^1.0.3",
"form-data": "^4.0.0",
"geojson": "^0.5.0",
"jest-mock": "^29.6.1",
Expand Down
4 changes: 3 additions & 1 deletion backend/src/v1/complaint/complaint.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,8 @@ export class ComplaintService {
case "violation_code":
case "in_progress_ind":
return "allegation";
case "area_name":
return "cos_organization";
case "complaint_identifier":
default:
return "complaint";
Expand Down Expand Up @@ -594,7 +596,7 @@ export class ComplaintService {
const assigned = await this._getTotalAssignedComplaintsByOfficer(complaintType, officerId);

let record = {
name: `${first_name} ${last_name}`,
name: `${last_name}, ${first_name}`,
hwcrAssigned: complaintType === "HWCR" ? assigned : 0,
allegationAssigned: complaintType === "ERS" ? assigned : 0,
officerGuid: officerId,
Expand Down
5 changes: 2 additions & 3 deletions backend/src/v1/document/document.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { Roles } from "../../auth/decorators/roles.decorator";
import { Token } from "../../auth/decorators/token.decorator";
import { COMPLAINT_TYPE } from "../../types/models/complaints/complaint-type";
import { format } from "date-fns";
import { escape } from "escape-html";

@UseGuards(JwtRoleGuard)
@ApiTags("document")
Expand All @@ -27,8 +28,6 @@ export class DocumentController {
@Res() res: Response,
): Promise<void> {
try {
this.logger.debug("TIMEZONE: ", tz);

const fileName = `Complaint-${id}-${type}-${format(new Date(), "yyyy-MM-dd")}.pdf`;
const response = await this.service.exportComplaint(id, type, fileName, tz);

Expand All @@ -47,7 +46,7 @@ export class DocumentController {
res.end(buffer);
} catch (error) {
this.logger.error(`exception: unable to export document for complaint: ${id} - error: ${error}`);
res.status(500).send(`exception: unable to export document for complaint: ${id} - error: ${error}`);
res.status(500).send(`exception: unable to export document for complaint: ${escape(id)}`);
}
}
}
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/allegation-details-create.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ describe("Complaint Create Page spec - Create View", () => {
region: "West Coast",
status: "Closed",
statusIndex: 1,
assigned: "Olivia Benson",
assigned: "Benson, Olivia",
assignedIndex: 1,
violationInProgressIndex: 1,
violationInProgressString: "No",
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/allegation-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const editCallDetails = {
regionCode: "KTNY",
status: "Closed",
statusIndex: 1,
assigned: "Olivia Benson",
assigned: "Benson, Olivia",
assignedIndex: 1,
violationInProgressIndex: 1,
violationInProgressString: "No",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ describe("Complaint Change Assignee spec - Details View", () => {
// self assign the complaint
cy.get("#self_assign_button").click({ force: true });
cy.waitForSpinner();
cy.get("#comp-details-assigned-officer-name-text-id").contains("ENV TestAcct").should("exist");
cy.get("#comp-details-assigned-officer-name-text-id").contains("TestAcct, ENV").should("exist");
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Complaint Create Page spec - Enter Coordinates - Create View", () => {
speciesIndex: 3,
status: "Closed",
statusIndex: 1,
assigned: "Chris Nesmith",
assigned: "Nesmith, Chris",
assignedIndex: 1,
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-details-create.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ describe("Complaint Create Page spec - Create View", () => {
speciesIndex: 3,
status: "Closed",
statusIndex: 1,
assigned: "Chris Nesmith",
assigned: "Nesmith, Chris",
assignedIndex: 1,
};

Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-details-edit.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ describe("Complaint Edit Page spec - Edit View", () => {
speciesIndex: 3,
status: "Closed",
statusIndex: 1,
assigned: "Chris Nesmith",
assigned: "Nesmith, Chris",
assignedIndex: 1,
};

Expand Down
4 changes: 2 additions & 2 deletions frontend/cypress/e2e/hwcr-outcome-assessment.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ describe("HWCR Outcome Assessments", () => {
let sectionParams = {
section: "ASSESSMENT",
checkboxes: ["#ASSESSRISK"],
officer: "Olivia Benson",
officer: "Benson, Olivia",
date: "01",
actionRequired: "Yes",
toastText: "Assessment has been saved",
Expand Down Expand Up @@ -124,7 +124,7 @@ describe("HWCR Outcome Assessments", () => {
let sectionParams = {
section: "ASSESSMENT",
checkboxes: ["#ASSESSHIST"],
officer: "Jake Peralta",
officer: "Peralta, Jake",
date: "01",
actionRequired: "No",
justification: "No public safety concern",
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-outcome-equipment.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ describe("HWCR Outcome Equipment", () => {
if ($equipment.find("#equipment-save-button").length) {
let sectionParams = {
section: "EQUIPMENT",
officer: "Olivia Benson",
officer: "Benson, Olivia",
date: "01",
toastText: "Equipment has been updated",
equipmentType: "Bear snare",
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-outcome-notes.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ describe("HWCR Outcome Notes", () => {

//validate the officer
cy.get("#comp-notes-officer").should(($div) => {
expect($div).to.contain.text("ENV TestAcct");
expect($div).to.contain.text("TestAcct, ENV");
});

//validate the toast
Expand Down
4 changes: 2 additions & 2 deletions frontend/cypress/e2e/hwcr-outcome-prev-and-educ.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ describe("HWCR Outcome Prevention and Education", () => {
let params = {
section: "PREV&EDUC",
checkboxes: ["#PROVSFTYIN", "#CNTCTBYLAW"],
officer: "Olivia Benson",
officer: "Benson, Olivia",
date: "01",
toastText: "Prevention and education has been saved",
};
Expand Down Expand Up @@ -125,7 +125,7 @@ describe("HWCR Outcome Prevention and Education", () => {
let params = {
section: "PREV&EDUC",
checkboxes: ["#CNTCTBIOVT"],
officer: "Jake Peralta",
officer: "Peralta, Jake",
date: "01",
toastText: "Prevention and education has been updated",
};
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/hwcr-outcome-review.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ describe("HWCR File Review", () => {

//validate the officer appeared
cy.get("#file-review-officer-id").should(($div) => {
expect($div).to.contain.text("ENV C&E Test Acct 1");
expect($div).to.contain.text("OfficerC&E Test Acct 1, ENV");
});

cy.get("#file-review-save-button").click();
Expand Down
2 changes: 1 addition & 1 deletion frontend/cypress/e2e/zone-at-a-glance-office.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ describe("COMPENF-258 Zone at a Glance - View Office Stats", () => {
cy.get("#Clearwater\\ Office").should("exist"); //assumes cypress user's office is Clearwater
//Expand the Clearwater Box
cy.get(".comp-zag-office > div > img").eq(1).click(); //Assumes Clearwater is second office
cy.get("#officerNameENV\\ TestAcct").should("exist");
cy.get("#officerNameTestAcct\\,\\ ENV").should("exist");
/* ==== End Cypress Studio ==== */
});
});
7 changes: 5 additions & 2 deletions frontend/openshift.deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ parameters:
description: Caddy logging level DEBUG, INFO, WARN, ERROR, PANIC, and FATAL (https://github.com/caddyserver/caddy/blob/master/logging.go)
value: "info"
- name: SHOW_EXPERIMENTAL_FEATURES
description: Hides or shows experimental SHOW_EXPERIMENTAL_FEATURES
description: Hides or shows experimental features
value: "false"
- name: ENVIRONMENT_NAME
description: Used to show a banner in the dev and test environments
Expand Down Expand Up @@ -121,7 +121,10 @@ objects:
- name: LOG_LEVEL
value: ${LOG_LEVEL}
- name: SHOW_EXPERIMENTAL_FEATURES
value: ${SHOW_EXPERIMENTAL_FEATURES}
valueFrom:
secretKeyRef:
name: react-app
key: show-experimental-features
- name: ENVIRONMENT_NAME
value: ${ENVIRONMENT_NAME}
ports:
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/app/common/methods.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,11 @@ export const getFirstInitialAndLastName = (fullName: string): string => {
return words[0];
} else {
// Extract the first initial and last name
const firstInitial = words[0].charAt(0).toUpperCase();
const firstName = words[0];
const lastName = words[words.length - 1];

// Concatenate the first initial and last name with a space
return `${firstInitial}. ${lastName}`;
return `${lastName}, ${firstName}`;
}
};

Expand Down
2 changes: 2 additions & 0 deletions frontend/src/app/common/validation-date-picker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const ValidationDatePicker: FC<ValidationDatePickerProps> = ({
maxDate={maxDate}
minDate={minDate}
autoComplete="false"
monthsShown={2}
showPreviousMonths
/>
</div>
<div className={calculatedClass}>{errMsg}</div>
Expand Down
24 changes: 24 additions & 0 deletions frontend/src/app/components/common/comp-select.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ type Props = {
value?: Option | null;
onChange?: (selectedOption: Option | null) => void;
isDisabled?: boolean;
isClearable?: boolean;
};

export const CompSelect: FC<Props> = ({
Expand All @@ -30,6 +31,7 @@ export const CompSelect: FC<Props> = ({
classNamePrefix,
errorMessage,
isDisabled,
isClearable,
}) => {
let styles: StylesConfig = {};

Expand All @@ -46,6 +48,27 @@ export const CompSelect: FC<Props> = ({
...provided,
color: state.label === "None" || state.label === "Unassigned" ? "#a1a1a1" : "black",
}),
//custom style for clear btn to match with DatePicker's clear btn
clearIndicator: (defaultStyles: any) => {
return {
...defaultStyles,
background: "#216ba5",
borderRadius: "50%",
color: "#fff",
cursor: "pointer",
maxHeight: "20px",
maxWidth: "20px",
padding: "2px",
marginRight: "6px",
svg: {
width: "12px",
height: "12px",
},
"&:hover": {
color: "#fff",
},
};
},
};

//-- pass through the onChange event
Expand All @@ -71,6 +94,7 @@ export const CompSelect: FC<Props> = ({
isDisabled={isDisabled}
menuPlacement="auto"
menuPosition="fixed"
isClearable={isClearable ?? false}
/>
{enableValidation && <div className="error-message">{errorMessage}</div>}
</div>
Expand Down
Loading

0 comments on commit 667d259

Please sign in to comment.