-
Notifications
You must be signed in to change notification settings - Fork 22
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
feat: [DHIS2-15480] widget assignee #3412
Conversation
🚀 Deployed on https://deploy-preview-3412--dhis2-capture.netlify.app |
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.
I see that I didn't write anything about self-contained, but would be great if we can make it a bit more contained and not use Redux in the Widget itself.
Widget interface suggestion
assignedUser?: { id: string, name: string },
writeAccess: boolean,
getSaveContext: () => Object,
onSave: (assignee) => void,
onSaveError: (prevAssignee) => void,
We can update the Redux store from the onSave and OnSaveError callbacks. Let's use mutate from app-runtime when saving (don't worry about offline support for now)
-
Let's only send the current event and not other events in the enrollment to the api (if you have multiple events in the same enrollment, they are all sent to the api when updating the assigned user it seems). But fixing the first point might also fix this one.
-
Make sure that after we update the event itself, the assigned user is still persisted/shown in the Widget (I saw some weird behaviour here, but couldn't instantly figure out what was going on. It also seemed to differ between v39 and v40)
I'm open for a chat about this!
Hi @JoakimSM, |
|
||
export type Props = {| | ||
assignee: UserFormField | null, | ||
programStage: ?ProgramStage, |
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.
can we just pass in enabled
instead of passing in the entire programStage? Easier to resume work here later
eventAccess: {| | ||
read: boolean, | ||
write: boolean, |
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.
In its current state I think it would be great if we don't pass in read-access. Can we just replace this with writeAccess
?
onClose={useCallback(() => setOpenStatus(false), [setOpenStatus])} | ||
open={open} | ||
> | ||
<div className={classes.wrapper}>{eventAccess?.write ? renderContent() : renderNoAccess()}</div> |
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.
We should show the assignee even if the user doesn't have write access. In read-only mode we should disable the edit button.
I also just realised we don't have any way of removing the assignment altogether. We will have to look into a way of doing this. We might just add an "x"-button for now (beside the edit button), but feel free to ask the designers for a proper design.
Hi @JoakimSM, |
Hey @simonadomnisoru, |
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.
Last code changes looks good and the widget is looking and functioning satisfactory, well done 🎉
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.
Tested successfully on 2.41,2.40.3,2.39.5 ,2.38.7 versions
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.
Tested successfully on 2.41,2.40.3,2.39.5 ,2.38.7 versions
# [100.51.0](v100.50.7...v100.51.0) (2024-01-25) ### Features * [DHIS2-15480] widget assignee ([#3412](#3412)) ([d61efae](d61efae))
🎉 This PR is included in version 100.51.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
DHIS2-15480
Tech summary