From f242200b03c430262ee59b8e8c551ce8665de5ed Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Thu, 1 Aug 2024 11:37:55 -0700 Subject: [PATCH 01/12] Removed hard coding of session security key from constants to env varialbe / docker file variable. --- docker-compose-linux.yml | 1 + docker-compose.yml | 1 + forms-flow-web/Dockerfile | 2 ++ forms-flow-web/Dockerfile.local | 2 ++ forms-flow-web/docker-compose.yml | 1 + forms-flow-web/src/constants/constants.js | 2 +- 6 files changed, 8 insertions(+), 1 deletion(-) diff --git a/docker-compose-linux.yml b/docker-compose-linux.yml index 5042af55d..1e7d19852 100644 --- a/docker-compose-linux.yml +++ b/docker-compose-linux.yml @@ -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" diff --git a/docker-compose.yml b/docker-compose.yml index 7110f214c..b7c2798c4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -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" diff --git a/forms-flow-web/Dockerfile b/forms-flow-web/Dockerfile index 4697db0c5..b28550190 100644 --- a/forms-flow-web/Dockerfile +++ b/forms-flow-web/Dockerfile @@ -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 false @@ -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} diff --git a/forms-flow-web/Dockerfile.local b/forms-flow-web/Dockerfile.local index 8ee65d1be..4a7e37583 100644 --- a/forms-flow-web/Dockerfile.local +++ b/forms-flow-web/Dockerfile.local @@ -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} @@ -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 diff --git a/forms-flow-web/docker-compose.yml b/forms-flow-web/docker-compose.yml index 289c4bf54..f4c6fb1c3 100644 --- a/forms-flow-web/docker-compose.yml +++ b/forms-flow-web/docker-compose.yml @@ -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" diff --git a/forms-flow-web/src/constants/constants.js b/forms-flow-web/src/constants/constants.js index bfb7ecf06..6e7315101 100644 --- a/forms-flow-web/src/constants/constants.js +++ b/forms-flow-web/src/constants/constants.js @@ -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 = From 3eab56a1c80885cb47a9b79653af63993c985d1a Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Tue, 13 Aug 2024 10:49:48 -0700 Subject: [PATCH 02/12] bug fix: adding validation for required fields for editing --- .../FOI/customComponents/Records/MCFPersonal.js | 10 ++++++++-- .../components/FOI/customComponents/Records/index.js | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js index ba12bf232..d18f53f96 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js @@ -25,7 +25,7 @@ const MCFPersonal = ({ editTagModalOpen, setEditTagModalOpen, setNewDivision, - // tagValue, + comparePersonalAttributes, curPersonalAttributes, setNewPersonalAttributes, updatePersonalAttributes, @@ -74,6 +74,11 @@ const MCFPersonal = ({ const [fileTypeSearchValue, setFileTypeSearchValue] = useState(""); const [additionalFileTypes, setAdditionalFileTypes] = useState([]); const [showAdditionalFileTypes, setShowAdditionalFileTypes] = useState(false); + const [disableSave, setDisableSave] = useState(false); + + useEffect(() => { + setDisableSave(personalAttributes?.person === undefined || personalAttributes?.person === "" || personalAttributes?.filetype === undefined || personalAttributes?.filetype === "" || comparePersonalAttributes(personalAttributes, curPersonalAttributes)); + },[personalAttributes]) useEffect(() => { if(currentEditRecord?.attributes?.divisions[0]?.divisionid) { @@ -622,13 +627,14 @@ const MCFPersonal = ({ diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index e523f7b0e..e95e27dde 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -2769,7 +2769,7 @@ export const RecordsLog = ({ setEditTagModalOpen={setEditTagModalOpen} record={currentEditRecord} setNewDivision={setDivisionModalTagValue} - + comparePersonalAttributes={comparePersonalAttributes} curPersonalAttributes={curPersonalAttributes} setNewPersonalAttributes={setNewPersonalAttributes} updatePersonalAttributes={updatePersonalAttributes} From 5f3113bb5d34c8031a2e8473f3222fd455830cee Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Tue, 13 Aug 2024 11:36:08 -0700 Subject: [PATCH 03/12] bug fix: validate division update FOIMOD-3393 --- .../FOI/customComponents/Records/MCFPersonal.js | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js index d18f53f96..b7cd77788 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js @@ -76,9 +76,20 @@ const MCFPersonal = ({ 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 === "" || comparePersonalAttributes(personalAttributes, curPersonalAttributes)); - },[personalAttributes]) + setDisableSave( + personalAttributes?.person === undefined + || personalAttributes?.person === "" + || personalAttributes?.filetype === undefined + || personalAttributes?.filetype === "" + || (!isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes)) + || (isMinistryCoordinator && comparePersonalAttributes(personalAttributes, curPersonalAttributes) && compareDivision(currentEditRecord.attributes.divisions[0].divisionid, divisionModalTagValue)) + ); + },[personalAttributes, divisionModalTagValue]) useEffect(() => { if(currentEditRecord?.attributes?.divisions[0]?.divisionid) { From f8a36ace4a3b56c6379a5dee1235d8263afb64c3 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 14 Aug 2024 14:52:50 -0700 Subject: [PATCH 04/12] Fix observation 2 - FOIMOD-3300 --- .../src/components/FOI/customComponents/Records/index.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/index.js b/forms-flow-web/src/components/FOI/customComponents/Records/index.js index e95e27dde..115d11fd8 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/index.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/index.js @@ -2462,8 +2462,8 @@ export const RecordsLog = ({ {divisionFilters.map((division) => ( Date: Wed, 14 Aug 2024 15:24:59 -0700 Subject: [PATCH 05/12] Fix new observation 3 & 4 (applied 2nd approach) FOIMOD-3300 --- .../customComponents/FileUpload/FileUploadForMCFPersonal.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js index e2684629f..d0da38187 100644 --- a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js @@ -712,12 +712,11 @@ const FileUploadForMCFPersonal = ({ value="" multiple={multipleFiles} accept={mimeTypes} - disabled={modalFor === "add" && (!isPersonSelected || ((isMinistryCoordinator && tagValue == "")))} />
{(Object.entries(files).length === 0 && !multipleFiles) || multipleFiles ? - : null}
From 0391cd7ea399a32975237afdba782ef69e9e8c05 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Wed, 14 Aug 2024 15:28:50 -0700 Subject: [PATCH 06/12] Fix new observation 4 FOIMOD-3300 --- .../src/components/FOI/customComponents/Records/MCFPersonal.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js index b7cd77788..bdde66378 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js @@ -86,6 +86,8 @@ const MCFPersonal = ({ || 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)) ); From 971a54f24f044169a5138fb8e595ac2ab87d7916 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Thu, 15 Aug 2024 11:35:53 -0700 Subject: [PATCH 07/12] 1. New migration file for updating filetype and sections FOIMOD-3397 2. fix observation: enable drag & drop FOIMOD-3300 --- .../FileUpload/FileUploadForMCFPersonal.js | 10 ++--- .../06283c0685fb_update_cfd_personal_tags.py | 43 +++++++++++++++++++ 2 files changed, 46 insertions(+), 7 deletions(-) create mode 100644 request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py diff --git a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js index d0da38187..25d6c2a10 100644 --- a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js @@ -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]; diff --git a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py new file mode 100644 index 000000000..8277b3570 --- /dev/null +++ b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py @@ -0,0 +1,43 @@ +"""update CFD Personal tags + +Revision ID: 06283c0685fb +Revises: aa2691fa6c3c +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 = 'aa2691fa6c3c' +branch_labels = None +depends_on = None + + +def upgrade(): + filetypes = ["AD_C","AA","AH","AO","FH","CS","CYMH","DIV","FS","ICM","MAPLES","RE","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","CYSN","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('DELETE FROM public."ProgramAreaDivisions" 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('DELETE FROM public."ProgramAreaDivisions" 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('DELETE FROM public."ProgramAreaDivisions" WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'filetype\'') + op.execute('DELETE FROM public."ProgramAreaDivisions" WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'') \ No newline at end of file From 46bb82ae47cba3bb9fe924d4bfce2f0ee088936d Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Thu, 15 Aug 2024 12:10:34 -0700 Subject: [PATCH 08/12] Mark old filetype & section inactive instead of delete FOIMOD-3397 --- .../versions/06283c0685fb_update_cfd_personal_tags.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py index 8277b3570..8f010c4aa 100644 --- a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py +++ b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py @@ -20,7 +20,7 @@ def upgrade(): filetypes = ["AD_C","AA","AH","AO","FH","CS","CYMH","DIV","FS","ICM","MAPLES","RE","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","CYSN","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('DELETE FROM public."ProgramAreaDivisions" 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 = \'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\');') @@ -30,7 +30,7 @@ def upgrade(): 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('DELETE FROM public."ProgramAreaDivisions" WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'') + 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\');') @@ -39,5 +39,5 @@ def upgrade(): 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('DELETE FROM public."ProgramAreaDivisions" WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'filetype\'') - op.execute('DELETE FROM public."ProgramAreaDivisions" WHERE programareaid in (SELECT programareaid FROM public."ProgramAreas" WHERE iaocode =\'CFD\') AND type = \'section\' AND name != \'TBD\'') \ No newline at end of file + 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\'') \ No newline at end of file From e3532838aa4b70c52545da5e239c3004571d0ef0 Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Thu, 15 Aug 2024 15:00:47 -0700 Subject: [PATCH 09/12] 8 popular filetypes - FOIMOD-3397 --- .../FOI/customComponents/Attachments/AttachmentModal.js | 4 ++-- .../customComponents/FileUpload/FileUploadForMCFPersonal.js | 4 ++-- .../components/FOI/customComponents/Records/MCFPersonal.js | 6 +++--- .../versions/06283c0685fb_update_cfd_personal_tags.py | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js index 73e2dbbae..907436dfb 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Attachments/AttachmentModal.js @@ -670,7 +670,7 @@ export default function AttachmentModal({ MCFPopularSections - 1 )} otherTagList={MCFSections?.sections?.slice( - MCFPopularSections + MCFPopularSections - 1 )} handleTagChange={handleTagChange} tagValue={tagValue} @@ -712,7 +712,7 @@ export default function AttachmentModal({ MSDPopularSections - 1 )} otherTagList={MSDSections?.divisions[0]?.sections?.slice( - MSDPopularSections + MSDPopularSections - 1 )} handleTagChange={handleTagChange} tagValue={tagValue} diff --git a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js index 25d6c2a10..982b85b94 100644 --- a/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/FileUpload/FileUploadForMCFPersonal.js @@ -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); diff --git a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js index bdde66378..ef6734a60 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js +++ b/forms-flow-web/src/components/FOI/customComponents/Records/MCFPersonal.js @@ -103,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([]); @@ -136,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([]) diff --git a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py index 8f010c4aa..6aa2424e8 100644 --- a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py +++ b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py @@ -17,7 +17,7 @@ def upgrade(): - filetypes = ["AD_C","AA","AH","AO","FH","CS","CYMH","DIV","FS","ICM","MAPLES","RE","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","CYSN","CS UNREG","CT","CH","FS UNREG","RE UNREG","SN","Woodlands","Incident","Memo ","Service Request","FS Case","CS Case","SR Case","Complaint"] + 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\'') From d7e8eb48a13dbfdafdb6cf7130475adcda3a7bbf Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Mon, 19 Aug 2024 13:51:39 -0700 Subject: [PATCH 10/12] Update cfd personal section sorting orders FOIMOD-3413 --- ...b_update_cfd_personal_sections_sorting_.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 request-management-api/migrations/versions/1d60153653db_update_cfd_personal_sections_sorting_.py diff --git a/request-management-api/migrations/versions/1d60153653db_update_cfd_personal_sections_sorting_.py b/request-management-api/migrations/versions/1d60153653db_update_cfd_personal_sections_sorting_.py new file mode 100644 index 000000000..c296cbf22 --- /dev/null +++ b/request-management-api/migrations/versions/1d60153653db_update_cfd_personal_sections_sorting_.py @@ -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\'') \ No newline at end of file From 70dbe19dfbfa917b3700022eb0050fce4912c75b Mon Sep 17 00:00:00 2001 From: Richard Qi Date: Mon, 19 Aug 2024 16:13:50 -0700 Subject: [PATCH 11/12] Reduce popular section to 20 FOIMOD-3413 --- forms-flow-web/src/constants/FOI/enum.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/forms-flow-web/src/constants/FOI/enum.js b/forms-flow-web/src/constants/FOI/enum.js index 10eb7762e..ab836d501 100644 --- a/forms-flow-web/src/constants/FOI/enum.js +++ b/forms-flow-web/src/constants/FOI/enum.js @@ -172,7 +172,7 @@ const RequestTypes = Object.freeze({ personal: "personal" }); -const MCFPopularSections = 23 +const MCFPopularSections = 21 const MSDPopularSections = 11 const RecordsDownloadList = [ From 7450f34966e09eda973d81ae6a28f2b0f37bf9a6 Mon Sep 17 00:00:00 2001 From: Aman-Hundal Date: Tue, 20 Aug 2024 15:03:17 -0700 Subject: [PATCH 12/12] adjusted migraiton script to allow for test-marshal to update DB. After merged to test-marshal, another migration change will be done to align order with test branch --- .../versions/06283c0685fb_update_cfd_personal_tags.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py index 6aa2424e8..ac7da20c5 100644 --- a/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py +++ b/request-management-api/migrations/versions/06283c0685fb_update_cfd_personal_tags.py @@ -1,7 +1,7 @@ """update CFD Personal tags Revision ID: 06283c0685fb -Revises: aa2691fa6c3c +Revises: bbee01df3e8d Create Date: 2024-08-14 12:40:37.844463 """ @@ -11,7 +11,7 @@ # revision identifiers, used by Alembic. revision = '06283c0685fb' -down_revision = 'aa2691fa6c3c' +down_revision = 'bbee01df3e8d' branch_labels = None depends_on = None