-
Notifications
You must be signed in to change notification settings - Fork 0
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
[Fix] risk and iap fixes #39
Conversation
for users not in incident manager user group
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good, minor changes required @deeonwuli
src/webapp/pages/form-page/incident-action/mapIncidentActionToInitialFormState.ts
Show resolved
Hide resolved
sections[0]?.fields[3]?.type === "select" ? sections[0].fields[3].options : [], | ||
statusOptions: | ||
sections[0]?.fields[6]?.type === "select" ? sections[0].fields[6].options : [], | ||
searchAssignROField?.type === "select" ? searchAssignROField.options : [], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@deeonwuli now we have configurations in useAppContext which will give you the options for each form type. Please use that instead : configurations.selectableOptions.incidentActionPlanConfigurations
useEffect(() => { | ||
compositionRoot.userGroup.getByCode.execute(RTSL_ZEBRA_INCIDENTMANAGER).run( | ||
userGroup => { | ||
const isIncidentManager = currentUser.belongToUserGroup(userGroup.id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if my understanding is correct, this userGroup will be same throughout the app (wont be different for different evnt trackers) So can you move this code to GetConfigurationsUseCase so that it is called only once on app load? You can add isIncidentManager to AppContextState.currentUser and save the value there and it will be available throughout the code.
@@ -0,0 +1,3 @@ | |||
import { Ref } from "./Ref"; | |||
|
|||
export type UserGroup = Ref; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
src/webapp/pages/app/App.tsx
Outdated
@@ -38,7 +39,7 @@ function App(props: AppProps) { | |||
const orgUnits = await compositionRoot.orgUnits.getAll.execute().toPromise(); | |||
|
|||
const configurations = await compositionRoot.diseaseOutbreakEvent.getConfigurations | |||
.execute() | |||
.execute({ incidentManagerUserGroupCode: RTSL_ZEBRA_INCIDENTMANAGER }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to pass incidentManagerUserGroupCode from here ? It is defined in the repository, so it can be used directly in the getUserGroupByCode. We do not need to send it from presentation to domain to data layer again. It belongs in the data layer and can imported/exported directly between the 2 repos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
okay understood 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks good @deeonwuli
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two good to have minor comments, can be fixed in next release - not major enough to block the merge.
switch (formType) { | ||
case "incident-action-plan": | ||
return RTSL_ZEBRA_INCIDENT_ACTION_PLAN_PROGRAM_STAGE_ID; | ||
case "incident-response-actions": | ||
case "incident-response-action": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is quite confusing, change "incident-response-action" to "single-incident-response-action" .
Make the change in the next PR for v2, so that we are not blocking release for this code review comment.
eventTrackerDetails: eventTrackerDetails, | ||
entity: | ||
eventTrackerDetails.incidentActionPlan?.responseActions.find( | ||
responseAction => responseAction.id === responseActionId |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do not throw an error if the response action if not found. return "undefined" and in the presentation layer, if the formtype is SingleResponseActionConfigurableForm and entity is undefined, then show error in snackbar.
📌 References
📝 Implementation
select
fields📹 Screenshots/Screen capture
Screen.Recording.2024-11-13.at.19.44.30.mov
Screen.Recording.2024-11-26.at.11.00.39.mov
🔥 Notes to the tester
#8696j3edq