-
Notifications
You must be signed in to change notification settings - Fork 44
feat: [DHIS2-21875] Unify overflow menu between View Event page and Stages and Events widget #4657
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
Open
henrikmv
wants to merge
81
commits into
hv/chore/DHIS2-21941_SingleSourceChangelogValues
Choose a base branch
from
hv/feat/DHIS2-21875_unify-overflow-menus-event
base: hv/chore/DHIS2-21941_SingleSourceChangelogValues
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
6f142ee
feat: unify overflow menus for event
henrikmv 9c22533
feat: refactor EventOverflowMenu to compute visibility for menu items
henrikmv d3aacb1
fix: pass undefined to deleteEvent for improved error handling
henrikmv 9afd2b9
fix: delete event functionality
henrikmv 2a7b8ee
feat: update menu items icon
henrikmv 6403107
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv 5f5a4e8
feat: unify event status update methods and read only badge functiona…
henrikmv 72fbb17
feat: update translation strings and improve delete menu item label
henrikmv fe45f9e
feat: refactor event edit permissions and unify overflow menu item props
henrikmv 14ed6a3
feat: add handling for SKIPPED event status in enrollment edit page mode
henrikmv a7f2d5f
feat: unify overflow menu item properties and remove unused features
henrikmv 410438f
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv d53faf6
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv 5515457
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv 0319de3
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv b3cbbca
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv c6f8d86
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv b6bde1e
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv 9182f5a
feat: temp
henrikmv 439be80
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv b886dc0
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv fe28ff0
feat: temp clean up
henrikmv 51eedc4
feat: unify overflow menu actions in WidgetHeader component
henrikmv b4064f9
feat: include completedBy in enrollment event mutation
henrikmv 34e94aa
feat: align with parent branch
henrikmv 511f1bb
feat: implement useOptimisticEventStatus hook for event status manage…
henrikmv 9268bb4
feat: add folder for menu items
henrikmv 10a70bf
Merge remote-tracking branch 'origin/master' into hv/feat/DHIS2-21875…
henrikmv 960ec6e
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv b39ae0f
Merge remote-tracking branch 'origin/master' into hv/feat/DHIS2-21875…
henrikmv 48d10ca
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv 457fc0b
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv b358136
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv 0c08857
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv fbec05e
feat: unify event permissions handling
henrikmv edcb8cc
feat: temp
henrikmv 71d81aa
feat: temp
henrikmv fb3891e
feat: one menu item per action
henrikmv 68e1b91
feat: update event overflow menu
henrikmv fd2c74e
Merge remote-tracking branch 'origin/hv/chore/DHIS2-21941_SingleSourc…
henrikmv 7909a3b
Merge remote-tracking branch 'origin/hv/chore/DHIS2-21941_SingleSourc…
henrikmv a0e8f3b
feat: add event skipped handling read only
henrikmv e1583ab
feat: stay on view mode when unskip from view mode
henrikmv 994648f
feat: unify event page mode handling by including eventId in useEnrol…
henrikmv 7c9bef0
feat: replace direct query removal with utility function for event ch…
henrikmv e76df13
feat: read only badge upper right corner for skipped events
henrikmv 2865cfe
Merge remote-tracking branch 'origin/hv/chore/DHIS2-21941_SingleSourc…
henrikmv 432c107
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv c37fc0e
Merge branch 'hv/feat/DHIS2-21655_uncomplete-event-view-mode' into hv…
henrikmv ef425e3
Merge remote-tracking branch 'origin/hv/feat/DHIS2-21655_uncomplete-e…
henrikmv 392cbee
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 62b1238
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 1f17d1a
feat: unify event status updates and clean up type annotations in eve…
henrikmv 5dae898
feat: add ChangelogMenuItem to event overflow menus
henrikmv bd1d38e
feat: temp
henrikmv a88c266
feat: seperate modal and delete menu item
henrikmv 47a789b
feat: temp
henrikmv ae8732c
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 734ddf0
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv e8782aa
fix: unify event completion handling by replacing canUncompleteEvent …
henrikmv ff690ec
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 30ecc62
feat: enhance event edit permissions to include deletion capability a…
henrikmv 9b57345
feat: temp
henrikmv 943d9d8
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 64eaa97
feat: unify overflow menu components and enhance read-only message ha…
henrikmv 0dfc6a0
feat: add event status notice box and enhance event editing permissions
henrikmv 76fd90c
fix: clean up
henrikmv d9f31f6
fix: clean up link read only
henrikmv cb814af
fix: rename uncomplete toggle
henrikmv 5444f5e
fix: revert info box
henrikmv 9cdb315
feat: temp
henrikmv b60e557
feat: unify event completion toggle naming and clean up components
henrikmv 4487ae8
feat: temp
henrikmv fa50b4a
feat: unify event mutation access naming across components
henrikmv 249f226
feat: unify event permission checks and refactor related components
henrikmv 844ded8
Merge branch 'hv/chore/DHIS2-21941_SingleSourceChangelogValues' into …
henrikmv 2439b92
fix: (review) devin comments
henrikmv de3dda6
fix: (review) fix broken updatedat
henrikmv afa1811
Merge remote-tracking branch 'origin/hv/chore/DHIS2-21941_SingleSourc…
henrikmv 93e546e
feat: clean up
henrikmv 39d1231
Merge remote-tracking branch 'origin/hv/chore/DHIS2-21941_SingleSourc…
henrikmv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
107 changes: 107 additions & 0 deletions
107
src/core_modules/capture-core/components/EventOverflowMenu/EventOverflowMenu.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,107 @@ | ||
| import React from 'react'; | ||
| import { FlyoutMenu, MenuDivider } from '@dhis2/ui'; | ||
| import { statusTypes as eventStatuses } from 'capture-core/events/statusTypes'; | ||
| import { ChangelogMenuItem, SkipMenuItem, CompletionMenuItem, DeleteMenuItem } from './MenuItems'; | ||
|
|
||
| const isSkippableStatus = (status?: string) => | ||
| status === eventStatuses.SCHEDULE | ||
| || status === eventStatuses.SKIPPED | ||
| || status === eventStatuses.OVERDUE; | ||
|
|
||
| const isCompletableStatus = (status?: string) => | ||
| status === eventStatuses.ACTIVE || status === eventStatuses.COMPLETED; | ||
|
|
||
| type Props = { | ||
| eventId: string; | ||
| eventStatus?: string; | ||
| maxWidth?: string; | ||
| dataTest?: string; | ||
|
|
||
| onOpenChangelog: () => void; | ||
| onClose: () => void; | ||
|
|
||
| hideMutationActions?: boolean; | ||
| isEventBlockedByExpiry: boolean; | ||
| canToggleCompletion: boolean; | ||
| readOnlyMessage: string; | ||
|
|
||
| onSkipMutate: (newStatus: string) => void; | ||
| onSkipSuccess: (newStatus: string) => void; | ||
| onSkipError: () => void; | ||
|
|
||
| onCompletionMutate: (newStatus: string) => void; | ||
| onCompletionSuccess: (newStatus: string) => void; | ||
| onCompletionError: () => void; | ||
|
|
||
| askCompleteEnrollmentOnEventComplete?: boolean; | ||
| onAskCompleteEnrollment?: () => void; | ||
|
|
||
| onDeleteRequest: () => void; | ||
| }; | ||
|
|
||
| export const EventOverflowMenu = ({ | ||
| eventId, | ||
| eventStatus, | ||
| maxWidth, | ||
| dataTest = 'overflow-menu', | ||
| onOpenChangelog, | ||
| onClose, | ||
| hideMutationActions = false, | ||
| isEventBlockedByExpiry, | ||
| canToggleCompletion, | ||
| readOnlyMessage, | ||
| onSkipMutate, | ||
| onSkipSuccess, | ||
| onSkipError, | ||
| onCompletionMutate, | ||
| onCompletionSuccess, | ||
| onCompletionError, | ||
| askCompleteEnrollmentOnEventComplete, | ||
| onAskCompleteEnrollment, | ||
| onDeleteRequest, | ||
| }: Props) => ( | ||
| <FlyoutMenu dense maxWidth={maxWidth} dataTest={dataTest}> | ||
| <ChangelogMenuItem onOpenChangelog={onOpenChangelog} onClose={onClose} /> | ||
|
|
||
| {!hideMutationActions && ( | ||
| <> | ||
| <MenuDivider /> | ||
|
|
||
| {isSkippableStatus(eventStatus) && ( | ||
| <SkipMenuItem | ||
| eventId={eventId} | ||
| eventStatus={eventStatus} | ||
| onMutate={onSkipMutate} | ||
| onSuccess={onSkipSuccess} | ||
| onError={onSkipError} | ||
| onClose={onClose} | ||
| isEventBlockedByExpiry={isEventBlockedByExpiry} | ||
| readOnlyMessage={readOnlyMessage} | ||
| /> | ||
| )} | ||
|
|
||
| {isCompletableStatus(eventStatus) && ( | ||
| <CompletionMenuItem | ||
| eventId={eventId} | ||
| eventStatus={eventStatus} | ||
| onMutate={onCompletionMutate} | ||
| onSuccess={onCompletionSuccess} | ||
| onError={onCompletionError} | ||
| onClose={onClose} | ||
| canToggleCompletion={canToggleCompletion} | ||
| readOnlyMessage={readOnlyMessage} | ||
| askCompleteEnrollmentOnEventComplete={askCompleteEnrollmentOnEventComplete} | ||
| onAskCompleteEnrollment={onAskCompleteEnrollment} | ||
| /> | ||
| )} | ||
|
|
||
| <DeleteMenuItem | ||
| onDeleteRequest={onDeleteRequest} | ||
| onClose={onClose} | ||
| isEventBlockedByExpiry={isEventBlockedByExpiry} | ||
| readOnlyMessage={readOnlyMessage} | ||
| /> | ||
| </> | ||
| )} | ||
| </FlyoutMenu> | ||
| ); |
22 changes: 22 additions & 0 deletions
22
src/core_modules/capture-core/components/EventOverflowMenu/MenuItems/ChangelogMenuItem.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| import React from 'react'; | ||
| import i18n from '@dhis2/d2-i18n'; | ||
| import { MenuItem, IconClockHistory16 } from '@dhis2/ui'; | ||
|
|
||
| type Props = { | ||
| onOpenChangelog: () => void; | ||
| onClose: () => void; | ||
| }; | ||
|
|
||
| export const ChangelogMenuItem = ({ onOpenChangelog, onClose }: Props) => ( | ||
| <MenuItem | ||
| dense | ||
| icon={<IconClockHistory16 />} | ||
| label={i18n.t('View changelog')} | ||
| suffix={null} | ||
| dataTest="event-overflow-changelog" | ||
| onClick={() => { | ||
| onOpenChangelog(); | ||
| onClose(); | ||
| }} | ||
| /> | ||
| ); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
It looks like the Mark complete action in the Overflow menu isn't considering the
askCompleteEnrollmentOnEventCompleteflag right now. (Since it was added in PR #4649, perhaps this comment would have been better suited there 🤔 ). We can handle the flag in a follow-up ticket 😄 .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 not know about that feature. It has been implemented in #4649 now. Thanks!