-
Notifications
You must be signed in to change notification settings - Fork 23
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-15830] Add orgUnitId and programId to plugin context #3407
feat: [DHIS2-15830] Add orgUnitId and programId to plugin context #3407
Conversation
|
||
export const FormFieldPlugin = (props: ContainerProps) => { | ||
const { pluginSource, fieldsMetadata, formId, onUpdateField, pluginContext } = props; | ||
const metadataByPluginId = useMemo(() => Object.fromEntries(fieldsMetadata), [fieldsMetadata]); | ||
const configuredPluginIds = useMemo(() => Object.keys(metadataByPluginId), [metadataByPluginId]); | ||
const { programId, orgUnitId } = useLocationQuery(); |
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.
Hey,
What about cases where programId
is missing from URL parameters (such as on /viewEvent
or /enrollmentEventEdit
pages)? Should we take it from somewhere else in these cases? 🤔
Thanks!
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.
That's a good point. Also, I didn't think this quite through I guess. Instead of sending in programId, we should perhaps send in the contextId, i.e. either programId or TETid? Also, they configure the plugin by this contextId, so it should be familiar. WDYT?
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 they need to know if the plugin is injected within a program or a TET context? If not, then a generic contextId
makes sense to me.
🚀 Deployed on https://deploy-preview-3407--dhis2-capture.netlify.app |
🎉 This PR is included in version 100.40.0 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Tech summary:
We need to pass in ProgramId and orgUnitId as part of the context for the form field plugin.