-
Notifications
You must be signed in to change notification settings - Fork 24
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-18018][DHIS2-17853] show related stages widget in view event page #3916
base: master
Are you sure you want to change the base?
Conversation
🚀 Deployed on https://deploy-preview-3916.capture.netlify.dhis2.org |
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.
Hi Simona,
I’ve reviewed this feature and identified a few findings that I hope you can take a look at. I wasn’t able to locate any design documents or overarching plans for this feature, so please let me know if I’ve misunderstood anything. Thanks!
|
||
return ( | ||
<div className={classes.link}> | ||
<Button secondary small onClick={onLink} disabled={disabled}> |
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.
NIT: There may be a design document on this, but this is perhaps a button that should typically be primary? 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.
There is no design document for this feature. I have implemented your suggestion. Thanks for the feedback!
const disabled = saveAttempted && Object.values(errorMessages).filter(Boolean).length !== 0; | ||
|
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.
The LinkButton stays enabled until clicked, even if required fields are empty. Can we remove the saveAttempted variable so it’s always disabled when required fields are incomplete?
const disabled = saveAttempted && Object.values(errorMessages).filter(Boolean).length !== 0; | |
const disabled = Object.values(errorMessages).some(Boolean); |
onUpdateEnrollmentSuccess({}); | ||
|
||
if (payload.linkMode === relatedStageActions.ENTER_DATA && payload.eventIdToRedirectTo) { | ||
onNavigateToEvent(payload.eventIdToRedirectTo); |
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.
When creating a relationship via Schedule or Link to existing event, there’s no confirmation or redirection. Is that the intended behavior?
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.
Yes, this is the intended behavior. When creating a relationship via Schedule
or Link to existing event
, the linked event will appear with a blue background above the currently open event.
Screen.Recording.2025-01-23.at.15.39.07.mov
|
||
export const WidgetRelatedStagesWorkspace: WidgetConfig = { | ||
Component: WidgetRelatedStages, | ||
shouldHideWidget: ({ currentPage }) => currentPage === EnrollmentPageKeys.EDIT_EVENT, |
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.
The widget is being displayed even though a relationship already exists. Attempting to create a new relationship results in a 409 error.
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 did a fix for the 409
error, but I couldn't reproduce the case where the widget is being displayed even though a relationship already exists. Could you please provide the steps? Thank you!
Quality Gate failedFailed conditions See analysis details on SonarQube Cloud Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE |
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 @simonadomnisoru!
I'm getting some strange behavior if the relationship is not bidirectional. It seems to not update/navigate correctly in my app. Could you take a look and see if you get the same conclusion in your env? Otherwise, this looks great!
@@ -26,6 +28,10 @@ export const DefaultPageLayout: PageLayoutConfig = { | |||
type: WidgetTypes.COMPONENT, | |||
name: 'EditEventWorkspace', | |||
}, | |||
{ | |||
type: WidgetTypes.COMPONENT, | |||
name: 'WidgetRelatedStagesWorkspace', |
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.
Should we change this name to just RelatedStagesWorkspace
? None of the other names contains widget
, so just trying to stay consistent. (Sorry, this was probably done ages ago)
DHIS2-18018
Tech summary:
WidgetRelatedStages
configurable in the enrollmentEventEditLayout page layout