Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sync test and test-rook #5340

Merged
merged 40 commits into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
9be1a11
Merge pull request #5276 from bcgov/dev
nkan-aot2 Jun 17, 2024
b5ffb39
Added F/E work and state for IAO users. WIP IAO User restrictions + M…
Aman-Hundal Jul 8, 2024
e5c4f00
Added migration script, and adjust FE code to follow new logic. WIP I…
Aman-Hundal Jul 9, 2024
8a5a087
Backend work completed to get lockrecords value from DB
Aman-Hundal Jul 9, 2024
669c6a0
adjusted section end point to consume lock records + adjusted FE init…
Aman-Hundal Jul 9, 2024
9d5c8d5
Merge pull request #5311 from bcgov/dev
aparna-aot Jul 10, 2024
ea57ee3
FE and backend logic for state changing for IAO users connected. WIP …
Aman-Hundal Jul 11, 2024
94a9b01
IAO Workflow for state lock records completed. WIP manual lock record…
Aman-Hundal Jul 11, 2024
25ef0c8
renamed lockrecords to userlockedrecords for DB/models
Aman-Hundal Jul 11, 2024
793f77c
controlling of lock records for IAO user completed. WIP ministry user
Aman-Hundal Jul 11, 2024
0e5d5ae
removed comment
Aman-Hundal Jul 11, 2024
475d11b
addjuste logic which resets requestobject user locked status to null
Aman-Hundal Jul 11, 2024
136fc8d
Ministry User work completed. WIP locking of features for IAO + Minis…
Aman-Hundal Jul 12, 2024
e1eea13
Ticket Completed. WIP code clean, and finalizing styling
Aman-Hundal Jul 12, 2024
f23d311
adjusted styling + logic for manual records log button. WIP styling
Aman-Hundal Jul 12, 2024
300faf7
renamed column for manual records lock in BE + adjusted styling for m…
Aman-Hundal Jul 12, 2024
97a96df
styling of records header grid
Aman-Hundal Jul 13, 2024
c378a34
Merge pull request #5313 from bcgov/dev-AH-FOIMOD-2880
Aman-Hundal Jul 16, 2024
183a3a6
Added logic to use error message from computing service response retr…
Aman-Hundal Jul 16, 2024
a1cd3c6
Added error handling messge for attachment as well
Aman-Hundal Jul 16, 2024
04a8ccf
small bug fix for string interpolation in python BE
Aman-Hundal Jul 16, 2024
6c0cb0d
Merge pull request #5320 from bcgov/dev-AH-FOIMOD-3232
Aman-Hundal Jul 16, 2024
cd27842
Revert "Ticket 2880 - Lock Records"
Aman-Hundal Jul 17, 2024
84dbce3
Merge pull request #5323 from bcgov/revert-5313-dev-AH-FOIMOD-2880
Aman-Hundal Jul 17, 2024
c9b01c6
Revert "Revert "Ticket 2880 - Lock Records""
Aman-Hundal Jul 17, 2024
9a8c5d6
Merge pull request #5324 from bcgov/revert-5323-revert-5313-dev-AH-FO…
Aman-Hundal Jul 17, 2024
b97127a
locked upload files for ministry and scanning if in locked states + a…
Aman-Hundal Jul 19, 2024
40e7a3a
Merge pull request #5328 from bcgov/dev-AH-FOIMOD-2880
Aman-Hundal Jul 19, 2024
dee7453
Merge pull request #5331 from bcgov/dev
Aman-Hundal Jul 22, 2024
51d4471
adjusted styling/disabling of Delete ability for records to fix obser…
Aman-Hundal Jul 23, 2024
65b9032
Merge pull request #5334 from bcgov/dev-AH-FOIMOD-2880
Aman-Hundal Jul 23, 2024
4980912
Merge pull request #5335 from bcgov/dev
Aman-Hundal Jul 23, 2024
104803b
adjusted code to fix observation 2 where userlockedrecordstatis value…
Aman-Hundal Jul 23, 2024
c0bf149
Adjusted foiminsitry request version update BE to records userrecordl…
Aman-Hundal Jul 23, 2024
d0b6f91
Merge pull request #5336 from bcgov/dev-AH-FOIMOD-2880
Aman-Hundal Jul 24, 2024
8c967e8
Merge pull request #5339 from bcgov/dev
Aman-Hundal Jul 24, 2024
643e086
Merge branch 'main' of github.com:bcgov/foi-flow into dev-rook-RQ-FOI…
richard-aot Jul 25, 2024
a3c04bc
fix migration conflicts
richard-aot Jul 25, 2024
e87aaea
resolve merge conflicts
richard-aot Jul 25, 2024
701653d
Merge branch 'test-rook' of github.com:bcgov/foi-flow into dev-rook-R…
richard-aot Jul 25, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion forms-flow-web/src/apiManager/services/FOI/foiRecordServices.js
Original file line number Diff line number Diff line change
Expand Up @@ -635,4 +635,28 @@ export const fetchPDFStitchedRecordForOIPCRedlineReview = (
done(error);
});
};
}
}

export const updateUserLockedRecords = (data, requestId, ministryId, ...rest) => {
const done = fnDone(rest);
let apiUrl= replaceUrl(replaceUrl(
API.FOI_REQUEST_SECTION_API,
"<ministryid>",
ministryId),"<requestid>",requestId
);
return (dispatch) => {
httpPOSTRequest(`${apiUrl}/userrecordslockstatus`, data)
.then((res) => {
if (res.data) {
done(null, res.data);
} else {
dispatch(serviceActionError(res));
throw new Error(`Error while updating records lock status for the (request# ${requestId}, ministry# ${ministryId})`);
}
})
.catch((error) => {
dispatch(serviceActionError(error));
done(error);
});
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ const BottomButtonGroup = React.memo(
axisMessage,
attachmentsArray,
oipcData,
validLockRecordsState,
}) => {
/**
* Bottom Button Group of Review request Page
Expand Down Expand Up @@ -120,6 +121,11 @@ const BottomButtonGroup = React.memo(
setIsAddRequest(false);
}

//Logic to reset user lock records status to null (and have FE useEffect in FOIRequest.js/MinistryView.js logic takeover) if request is in unlocked request states
if (!validLockRecordsState(currentSelectedStatus)) {
saveRequestObject.userrecordslockstatus = null;
}

//add oipc Data to save request object and sync/validate isoipcreview attribute
if (requestState.toLowerCase() !== StateEnum.intakeinprogress.name.toLowerCase() && requestState.toLowerCase() !== StateEnum.unopened.name.toLowerCase()) {
saveRequestObject.oipcdetails = oipcData ? oipcData : [];
Expand Down
32 changes: 31 additions & 1 deletion forms-flow-web/src/components/FOI/FOIRequest/FOIRequest.js
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,8 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
const [isMCFPersonal, setIsMCFPersonal] = useState(bcgovcode.replaceAll('"', '') == "MCF" && requestDetails.requestType == FOI_COMPONENT_CONSTANTS.REQUEST_TYPE_PERSONAL);
const {oipcData, addOIPC, removeOIPC, updateOIPC, isOIPCReview, setIsOIPCReview, removeAllOIPCs} = useOIPCHook();
const [oipcDataInitial, setOipcDataInitial] = useState(oipcData);

const [lockRecordsTab, setLockRecordsTab] = useState(false);

//Update disableInput when requestState changes
useEffect(() => {
setDisableInput(requestState?.toLowerCase() === StateEnum.closed.name.toLowerCase() && !isOIPCReview);
Expand Down Expand Up @@ -344,6 +345,20 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
if (bcgovcode) dispatch(fetchFOIMinistryAssignedToList(bcgovcode));
}, [requestId, ministryId, comment, attachments]);

const validLockRecordsState = (currentState=requestDetails.currentState) => {
return (
currentState === StateEnum.harms.name ||
currentState === StateEnum.onhold.name ||
currentState === StateEnum.recordsreadyforreview.name ||
currentState === StateEnum.review.name ||
currentState === StateEnum.consult.name ||
currentState === StateEnum.peerreview.name ||
currentState === StateEnum.signoff.name ||
currentState === StateEnum.response.name ||
currentState === StateEnum.closed.name
);
}

useEffect(() => {
const requestDetailsValue = requestDetails;
setSaveRequestObject(requestDetailsValue);
Expand Down Expand Up @@ -386,6 +401,16 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
} else {
setIsOIPCReview(false);
}

//Adjust lockRecords value based on requestState if there is no manual user lockedrecords value present in requestDetails from DB
const updateRecordsTabAccess = () => {
if(requestDetails.userrecordslockstatus === null) {
return validLockRecordsState(requestDetails.currentState);
} else {
return requestDetails.userrecordslockstatus;
}
}
setLockRecordsTab(updateRecordsTabAccess());
}, [requestDetails]);

//useEffect to manage isoipcreview attribute for requestdetails state
Expand Down Expand Up @@ -1405,6 +1430,7 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
axisMessage={axisMessage}
attachmentsArray={requestAttachments}
oipcData={oipcData}
validLockRecordsState={validLockRecordsState}
/>
</>
</ConditionalComponent>
Expand Down Expand Up @@ -1649,6 +1675,10 @@ const FOIRequest = React.memo(({ userDetail, openApplicantProfileModal }) => {
divisions={requestDetails.divisions}
recordsTabSelect={tabLinksStatuses.Records.active}
requestType={requestDetails?.requestType}
lockRecords={lockRecordsTab}
setLockRecordsTab={setLockRecordsTab}
validLockRecordsState={validLockRecordsState}
setSaveRequestObject={setSaveRequestObject}
handleSaveRequest={handleSaveRequest}
/>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const BottomButtonGroup = React.memo(
hasStatusRequestSaved,
attachmentsArray,
stateChanged,
validLockRecordsState,
}) => {
/**
* Bottom Button Group of Review request Page
Expand Down Expand Up @@ -109,6 +110,10 @@ const BottomButtonGroup = React.memo(
};

const saveMinistryRequest = async () => {
//Logic to reset user lock records status to null (and have FE useEffect in FOIRequest.js/MinistryView.js logic takeover) if request is in unlocked request states
if (!validLockRecordsState(currentSelectedStatus)) {
saveMinistryRequestObject.userrecordslockstatus = null;
}
dispatch(
saveMinistryRequestDetails(
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,20 @@ const MinistryReview = React.memo(({ userDetail }) => {

const userGroups = userDetail?.groups?.map(group => group.slice(1));
const isMinistry = isMinistryLogin(userGroups);

const validLockRecordsState = (currentState=requestDetails.currentState) => {
return (
currentState === StateEnum.harms.name ||
currentState === StateEnum.onhold.name ||
currentState === StateEnum.recordsreadyforreview.name ||
currentState === StateEnum.review.name ||
currentState === StateEnum.consult.name ||
currentState === StateEnum.peerreview.name ||
currentState === StateEnum.signoff.name ||
currentState === StateEnum.response.name ||
currentState === StateEnum.closed.name
);
}

useEffect(() => {
const requestDetailsValue = requestDetails;
Expand Down Expand Up @@ -280,6 +294,16 @@ const MinistryReview = React.memo(({ userDetail }) => {
setIsMCFPersonal(true);
}
}

//Adjust lockRecords value based on requestState if there is no manual user lockedrecords value present in requestDetails from DB
const updateRecordsTabAccess = () => {
if(requestDetails.userrecordslockstatus === null) {
return validLockRecordsState(requestDetails.currentState);
} else {
return requestDetails.userrecordslockstatus;
}
}
setLockRecordsTab(updateRecordsTabAccess());
}, [requestDetails, unSavedRequest]);

useEffect(() => {
Expand All @@ -295,6 +319,7 @@ const MinistryReview = React.memo(({ userDetail }) => {
}, [isMinistryRestricted, requestWatchers]);

const [recordsUploading, setRecordsUploading] = React.useState(false);
const [lockRecordsTab, setLockRecordsTab] = useState(false);
const [CFRUnsaved, setCFRUnsaved] = React.useState(false);
const hideBottomText = [
StateEnum.onhold.name.toLowerCase(),
Expand Down Expand Up @@ -806,6 +831,7 @@ const MinistryReview = React.memo(({ userDetail }) => {
handleSaveRequest={handleSaveRequest}
currentSelectedStatus={_currentrequestStatus}
hasStatusRequestSaved={hasStatusRequestSaved}
validLockRecordsState={validLockRecordsState}
/>
</>
)}
Expand Down Expand Up @@ -1054,6 +1080,8 @@ const MinistryReview = React.memo(({ userDetail }) => {
setRecordsUploading={setRecordsUploading}
recordsTabSelect={tabLinksStatuses.Records.active}
requestType={requestDetails?.requestType}
lockRecords={lockRecordsTab}
validLockRecordsState={validLockRecordsState}
handleSaveRequest={handleSaveRequest}
/>
</>
Expand Down
Loading
Loading