Skip to content

Commit

Permalink
Merge pull request #5372 from bcgov/test-marshal-AH-FOIMOD-2646-dev
Browse files Browse the repository at this point in the history
Test Marshal <> Dev Merge August 20 2024
  • Loading branch information
Aman-Hundal authored Aug 20, 2024
2 parents addc651 + 7450f34 commit 150006c
Show file tree
Hide file tree
Showing 13 changed files with 119 additions and 23 deletions.
1 change: 1 addition & 0 deletions docker-compose-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ services:
- FOI_FFA_URL=${FOI_FFA_URL}
- REACT_APP_FOI_RECORD_FORMATS=${FOI_RECORD_FORMATS}
- REACT_APP_RECORD_PROCESSING_HRS=${RECORD_PROCESSING_HRS}
- REACT_APP_SESSION_SECURITY_KEY=${REACT_APP_SESSION_SECURITY_KEY}
volumes:
- ".:/app"
- "/app/node_modules"
Expand Down
1 change: 1 addition & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ services:
- REACT_APP_DISABLE_GATHERINGRECORDS_TAB=${DISABLE_GATHERINGRECORDS_TAB}
- REACT_APP_RECORD_DOWNLOAD_LIMIT=${RECORD_DOWNLOAD_LIMIT}
- REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT=${RECORD_DOWNLOAD_SIZE_LIMIT}
- REACT_APP_SESSION_SECURITY_KEY=${REACT_APP_SESSION_SECURITY_KEY}
volumes:
- ".:/app"
- "/app/node_modules"
Expand Down
2 changes: 2 additions & 0 deletions forms-flow-web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ ARG REACT_APP_DISABLE_REDACT_WEBLINK
ARG REACT_APP_DISABLE_GATHERINGRECORDS_TAB
ARG REACT_APP_RECORD_DOWNLOAD_LIMIT
ARG REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT
ARG REACT_APP_SESSION_SECURITY_KEY

ENV NODE_ENV ${NODE_ENV}
ENV GENERATE_SOURCEMAP ${GENERATE_SOURCEMAP}
Expand Down Expand Up @@ -66,6 +67,7 @@ ENV REACT_APP_FOI_RECORD_FORMATS ${REACT_APP_FOI_RECORD_FORMATS}
ENV REACT_APP_RECORD_PROCESSING_HRS ${REACT_APP_RECORD_PROCESSING_HRS}
ENV REACT_APP_DISABLE_REDACT_WEBLINK ${REACT_APP_DISABLE_REDACT_WEBLINK}
ENV REACT_APP_DISABLE_GATHERINGRECORDS_TAB ${REACT_APP_DISABLE_GATHERINGRECORDS_TAB}
ENV REACT_APP_SESSION_SECURITY_KEY ${REACT_APP_SESSION_SECURITY_KEY}

ENV REACT_APP_SOCKETIO_CONNECT_NONCE ${REACT_APP_SOCKETIO_CONNECT_NONCE}
ENV REACT_APP_RECORD_DOWNLOAD_LIMIT ${REACT_APP_RECORD_DOWNLOAD_LIMIT}
Expand Down
2 changes: 2 additions & 0 deletions forms-flow-web/Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ ARG REACT_APP_DISABLE_REDACT_WEBLINK
ARG REACT_APP_DISABLE_GATHERINGRECORDS_TAB
ARG REACT_APP_RECORD_DOWNLOAD_LIMIT
ARG REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT
ARG REACT_APP_SESSION_SECURITY_KEY

ENV NODE_ENV ${NODE_ENV}
ENV GENERATE_SOURCEMAP ${GENERATE_SOURCEMAP}
Expand Down Expand Up @@ -63,6 +64,7 @@ ENV REACT_APP_DISABLE_REDACT_WEBLINK ${REACT_APP_DISABLE_REDACT_WEBLINK}
ENV REACT_APP_DISABLE_GATHERINGRECORDS_TAB ${REACT_APP_DISABLE_GATHERINGRECORDS_TAB}
ENV REACT_APP_RECORD_DOWNLOAD_LIMIT ${REACT_APP_RECORD_DOWNLOAD_LIMIT}
ENV REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT ${REACT_APP_RECORD_DOWNLOAD_SIZE_LIMIT}
ENV REACT_APP_SESSION_SECURITY_KEY ${REACT_APP_SESSION_SECURITY_KEY}
# add `/app/node_modules/.bin` to $PATH
ENV PATH /forms-flow-web/app/node_modules/.bin:$PATH

Expand Down
1 change: 1 addition & 0 deletions forms-flow-web/docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ services:
- REACT_APP_FOI_FLOW_REPORTING_URL=${FOI_FLOW_REPORTING_URL}
- REACT_APP_AXIS_API_URL=${AXIS_API_URL}
- REACT_APP_SOCKETIO_CONNECT_NONCE=${SOCKETIO_CONNECT_NONCE}
- REACT_APP_SESSION_SECURITY_KEY=${REACT_APP_SESSION_SECURITY_KEY}
volumes:
- ".:/app"
- "/app/node_modules"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,7 @@ export default function AttachmentModal({
MCFPopularSections - 1
)}
otherTagList={MCFSections?.sections?.slice(
MCFPopularSections
MCFPopularSections - 1
)}
handleTagChange={handleTagChange}
tagValue={tagValue}
Expand Down Expand Up @@ -712,7 +712,7 @@ export default function AttachmentModal({
MSDPopularSections - 1
)}
otherTagList={MSDSections?.divisions[0]?.sections?.slice(
MSDPopularSections
MSDPopularSections - 1
)}
handleTagChange={handleTagChange}
tagValue={tagValue}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,8 +83,8 @@ const FileUploadForMCFPersonal = ({
isMinistryCoordinator?MCFPeople?.people.filter((p)=>{return p.name !== 'PERSON 1'}):MCFPeople?.people.filter((p)=>{return p.name !== 'APPLICANT'})
);
const [allVolumes, setAllVolumes] = useState(MCFVolumes?.volumes);
const [fileTypes, setFileTypes] = useState(MCFFiletypes?.filetypes.slice(0, 6));
const [otherFileTypes, setOtherFileTypes] = useState(MCFFiletypes?.filetypes.slice(6, MCFFiletypes?.filetypes.length));
const [fileTypes, setFileTypes] = useState(MCFFiletypes?.filetypes.slice(0, 8));
const [otherFileTypes, setOtherFileTypes] = useState(MCFFiletypes?.filetypes.slice(8, MCFFiletypes?.filetypes.length));
const [people, setPeople] = useState(allPeople.slice(0, 5));
const [volumes, setVolumes] = useState(allVolumes.slice(0, 5));
const [showAllPeople, setShowAllPeople] = useState(false);
Expand Down Expand Up @@ -212,13 +212,9 @@ const FileUploadForMCFPersonal = ({
const fileDrop = (e) => {
e.preventDefault();

if(modalFor === "add" && (!isPersonSelected || ((isMinistryCoordinator && tagValue == "")))) {
return
} else {
const newFiles = e.dataTransfer.files;
const totalNoOfFiles = Object.entries(files).length + newFiles.length;
validateFiles(newFiles, totalNoOfFiles);
}
const newFiles = e.dataTransfer.files;
const totalNoOfFiles = Object.entries(files).length + newFiles.length;
validateFiles(newFiles, totalNoOfFiles);
}
const removeFile = (fileName) => {
const _file = files[fileName];
Expand Down Expand Up @@ -712,12 +708,11 @@ const FileUploadForMCFPersonal = ({
value=""
multiple={multipleFiles}
accept={mimeTypes}
disabled={modalFor === "add" && (!isPersonSelected || ((isMinistryCoordinator && tagValue == "")))}
/>
</div>
<div className="file-upload-column file-upload-column-3">
{(Object.entries(files).length === 0 && !multipleFiles) || multipleFiles ?
<button className="btn-add-files" type="button" onClick={handleUploadBtnClick} disabled={modalFor === "add" && (!isPersonSelected || ((isMinistryCoordinator && tagValue == "")))}>
<button className="btn-add-files" type="button" onClick={handleUploadBtnClick}>
Add Files
</button> : null}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const MCFPersonal = ({
editTagModalOpen,
setEditTagModalOpen,
setNewDivision,
// tagValue,
comparePersonalAttributes,
curPersonalAttributes,
setNewPersonalAttributes,
updatePersonalAttributes,
Expand Down Expand Up @@ -74,6 +74,24 @@ const MCFPersonal = ({
const [fileTypeSearchValue, setFileTypeSearchValue] = useState("");
const [additionalFileTypes, setAdditionalFileTypes] = useState([]);
const [showAdditionalFileTypes, setShowAdditionalFileTypes] = useState(false);
const [disableSave, setDisableSave] = useState(false);

const compareDivision = (curDiv, newDiv) => {
return curDiv === newDiv;
}

useEffect(() => {
setDisableSave(
personalAttributes?.person === undefined
|| personalAttributes?.person === ""
|| personalAttributes?.filetype === undefined
|| personalAttributes?.filetype === ""
|| personalAttributes?.trackingid === undefined
|| personalAttributes?.trackingid === ""
|| (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes))
|| (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue))
);
},[personalAttributes, divisionModalTagValue])

useEffect(() => {
if(currentEditRecord?.attributes?.divisions[0]?.divisionid) {
Expand All @@ -85,7 +103,7 @@ const MCFPersonal = ({
if(MCFSections?.sections) {
if(MCFSections.sections.length > MCFPopularSections-1) {
setTagList(MCFSections.sections.slice(0, MCFPopularSections-1));
setOtherTagList(MCFSections.sections.slice(MCFPopularSections));
setOtherTagList(MCFSections.sections.slice(MCFPopularSections-1));
} else {
setTagList(MCFSections.sections);
setOtherTagList([]);
Expand Down Expand Up @@ -118,8 +136,8 @@ const MCFPersonal = ({
useEffect(() => {
if(MCFFiletypes?.filetypes) {
if(MCFFiletypes.filetypes?.length > 6) {
setFileTypes(MCFFiletypes.filetypes.slice(0, 6));
setOtherFileTypes(MCFFiletypes.filetypes.slice(6, MCFFiletypes.filetypes.length))
setFileTypes(MCFFiletypes.filetypes.slice(0, 8));
setOtherFileTypes(MCFFiletypes.filetypes.slice(8, MCFFiletypes.filetypes.length))
} else {
setFileTypes(MCFFiletypes.filetypes);
setOtherFileTypes([])
Expand Down Expand Up @@ -622,13 +640,14 @@ const MCFPersonal = ({
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes();reset();}}
disabled={disableSave}
>
Update for Individual
</button>
<button
className={`btn-bottom btn-save btn`}
onClick={() => {updatePersonalAttributes(true);reset();}}
disabled={isMinistryCoordinator}
disabled={disableSave || isMinistryCoordinator}
>
Update for All
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2503,8 +2503,8 @@ export const RecordsLog = ({
{divisionFilters.map((division) => (
<ClickableChip
item
id={`${division.divisionid}Filter`}
key={`${division.divisionid}-filter`}
// id={`${division.divisionid}Filter`}
// key={`${division.divisionid}-filter`}
label={division.divisionname.toUpperCase()}
sx={{
width: "fit-content",
Expand Down Expand Up @@ -2810,7 +2810,7 @@ export const RecordsLog = ({
setEditTagModalOpen={setEditTagModalOpen}
record={currentEditRecord}
setNewDivision={setDivisionModalTagValue}

comparePersonalAttributes={comparePersonalAttributes}
curPersonalAttributes={curPersonalAttributes}
setNewPersonalAttributes={setNewPersonalAttributes}
updatePersonalAttributes={updatePersonalAttributes}
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/constants/FOI/enum.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ const RequestTypes = Object.freeze({
personal: "personal"
});

const MCFPopularSections = 23
const MCFPopularSections = 21
const MSDPopularSections = 11

const RecordsDownloadList = [
Expand Down
2 changes: 1 addition & 1 deletion forms-flow-web/src/constants/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ export const KEYCLOAK_REALM =
export const KEYCLOAK_URL =(window._env_ && window._env_.REACT_APP_KEYCLOAK_URL) || process.env.REACT_APP_KEYCLOAK_URL;
export const KEYCLOAK_AUTH_URL = `${KEYCLOAK_URL}/auth`;
export const ANONYMOUS_USER = "anonymous";
export const SESSION_SECURITY_KEY = "u7x!A%D*G-KaNdRgUkXp2s5v8y/B?E(H";
export const SESSION_SECURITY_KEY = (window._env_ && window._env_.REACT_APP_SESSION_SECURITY_KEY) || process.env.REACT_APP_SESSION_SECURITY_KEY;
//6 hour in milliseconds
export const SESSION_LIFETIME = 21600000;
export const SOCKETIO_CONNECT_URL =
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
"""update CFD Personal tags
Revision ID: 06283c0685fb
Revises: bbee01df3e8d
Create Date: 2024-08-14 12:40:37.844463
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '06283c0685fb'
down_revision = 'bbee01df3e8d'
branch_labels = None
depends_on = None


def upgrade():
filetypes = ["CS","FS","ICM","CYMH","RE","CYSN","AD_C","DIV","AA","AH","AO","FH","MAPLES","SP","PABS","VAN-AA","VAN-CAS","VAN-CIC","VAN-CCAS","VIC-AA","YAG","Autism Case File","Assessment & Resource","AR ","AS","AM","AP","CC","Choices","CIC","CS UNREG","CT","CH","FS UNREG","RE UNREG","SN","Woodlands","Incident","Memo ","Service Request","FS Case","CS Case","SR Case","Complaint"]
ftsortorder = 1

op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'filetype\'')
for ftype in filetypes:
op.execute('INSERT INTO public."ProgramAreaDivisions"(programareaid, name, isactive, created_at, createdby, sortorder, issection, specifictopersonalrequests, type)\
VALUES ((SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\'), \''+ftype+'\', TRUE, NOW(), \'system\', '+ str(ftsortorder) +', FALSE, TRUE, \'filetype\');')
ftsortorder = ftsortorder+1


sections = ["Accountability","Activity Forms","Adoption","ADR","Agreements and Approvals","Caregiver Information","Case Conference","Case Notes","Case Snapshot","Change Card and Forms","Child and Birth Family Background","Child in Care Information","Collaborative Planning","Consents and Authorizations","Contracts","Correspondence","Cultural Planning","Documents","Education, Employment and Training","External Assessments","Family Group Mediation","File Summary","Financial","Incidents","Internal Assessments","Inside Back Cover","Inside Front Cover","Intake and Investigation","Legal","Maples","Mediation","Medical","Note Pad Screens","Out-of-Care Services","Personal History and Records","Physical File Summary","Placement Slips","Planning","Protocol and Incidents","Reconsideration","Running Record","Referrals","Relief Care Giver Documentation","Reports","Reviews","Services for Children Not in Care","Supervisor Orders","Young Offenders"]
secsortorder = 1

op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'')
for sec in sections:
op.execute('INSERT INTO public."ProgramAreaDivisions"(programareaid, name, isactive, created_at, createdby, sortorder, issection, specifictopersonalrequests, type)\
VALUES ((SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\'), \''+sec+'\', TRUE, NOW(), \'system\', '+ str(secsortorder) +', TRUE, TRUE, \'section\');')
secsortorder = secsortorder+1

op.execute('UPDATE public."ProgramAreaDivisions" SET sortorder = '+str(secsortorder)+' WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name = \'TBD\'')

def downgrade():
op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'filetype\'')
op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'')
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
"""Update CFD Personal Sections Sorting Order
Revision ID: 1d60153653db
Revises: 06283c0685fb
Create Date: 2024-08-19 09:36:01.403157
"""
from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision = '1d60153653db'
down_revision = '06283c0685fb'
branch_labels = None
depends_on = None


def upgrade():
sections = ["Activity Forms","Adoption","Case Notes","Change Card and Forms","Collaborative Planning","Correspondence","Cultural Planning","Education, Employment and Training","External Assessments","Family Group Mediation","Financial","Incidents","Internal Assessments","Inside Back Cover","Inside Front Cover","Intake and Investigation","Legal","Medical","Personal History and Records","Young Offenders","Accountability","ADR","Agreements and Approvals","Caregiver Information","Case Conference","Case Snapshot","Child and Birth Family Background","Child in Care Information","Consents and Authorizations","Contracts","Documents","File Summary","Maples","Mediation","Note Pad Screens","Out-of-Care Services","Physical File Summary","Placement Slips","Planning","Protocol and Incidents","Reconsideration","Running Record","Referrals","Relief Care Giver Documentation","Reports","Reviews","Services for Children Not in Care","Supervisor Orders"]
secsortorder = 1

op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'')
for sec in sections:
op.execute('INSERT INTO public."ProgramAreaDivisions"(programareaid, name, isactive, created_at, createdby, sortorder, issection, specifictopersonalrequests, type)\
VALUES ((SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\'), \''+sec+'\', TRUE, NOW(), \'system\', '+ str(secsortorder) +', TRUE, TRUE, \'section\');')
secsortorder = secsortorder+1

op.execute('UPDATE public."ProgramAreaDivisions" SET sortorder = '+str(secsortorder)+' WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name = \'TBD\'')

def downgrade():
op.execute('UPDATE public."ProgramAreaDivisions" SET isactive = FALSE WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'')

0 comments on commit 150006c

Please sign in to comment.