-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: [DHIS2-15480] widget assignee (#3412)
- Loading branch information
1 parent
12a571a
commit d61efae
Showing
60 changed files
with
869 additions
and
512 deletions.
There are no files selected for viewing
52 changes: 52 additions & 0 deletions
52
cypress/e2e/WidgetsForEnrollmentPages/WidgetAssignee/index.js
This file contains 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,52 @@ | ||
import { When, Then } from '@badeball/cypress-cucumber-preprocessor'; | ||
|
||
When('you assign the user Geetha in the view mode', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-assignee-assign"]').click(); | ||
cy.get('[data-test="capture-ui-input"]').type('Geetha'); | ||
cy.contains('Geetha Alwan').click(); | ||
cy.get('[data-test="widget-assignee-save"]').click(); | ||
}); | ||
}); | ||
|
||
When('you assign the user Tracker demo User in the edit mode', () => { | ||
cy | ||
.get('[data-test="widget-enrollment-event"]') | ||
.find('[data-test="dhis2-uicore-button"]') | ||
.eq(1) | ||
.click(); | ||
|
||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-assignee-edit"]').click(); | ||
cy.get('[data-test="dhis2-uicore-chip-remove"]').click(); | ||
cy.get('[data-test="capture-ui-input"]').type('Tracker demo'); | ||
cy.contains('Tracker demo User').click(); | ||
cy.get('[data-test="widget-assignee-save"]').click(); | ||
}); | ||
}); | ||
|
||
When('you remove the assigned user', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-assignee-edit"]').click(); | ||
cy.get('[data-test="dhis2-uicore-chip-remove"]').click(); | ||
cy.get('[data-test="widget-assignee-save"]').click(); | ||
}); | ||
}); | ||
|
||
Then('the event has the user Geetha Alwan assigned', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-contents"]').contains('Geetha Alwan').should('exist'); | ||
}); | ||
}); | ||
|
||
Then('the event has the user Tracker demo User assigned', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-contents"]').contains('Tracker demo User').should('exist'); | ||
}); | ||
}); | ||
|
||
Then('the event has no assignd user', () => { | ||
cy.get('[data-test="widget-assignee"]').within(() => { | ||
cy.get('[data-test="widget-contents"]').contains('No one is assigned to this event').should('exist'); | ||
}); | ||
}); |
This file contains 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 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 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 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
1 change: 1 addition & 0 deletions
1
src/core_modules/capture-core/components/FormFields/UserField/index.js
This file contains 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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
// @flow | ||
export { UserField } from './UserField.component'; | ||
export { UserSearch } from './UserSearch.component'; | ||
export type { User as UserFormField } from './types'; |
This file contains 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
15 changes: 15 additions & 0 deletions
15
...ules/capture-core/components/Pages/EnrollmentEditEvent/EnrollmentEditEventPage.actions.js
This file contains 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,15 @@ | ||
// @flow | ||
|
||
import { actionCreator } from '../../../actions/actions.utils'; | ||
import type { UserFormField } from '../../FormFields/UserField'; | ||
|
||
export const actionTypes = { | ||
ASSIGNEE_SET: 'EnrollmentDomain.AssigneeSet', | ||
ASSIGNEE_SAVE_FAILED: 'EnrollmentDomain.AssigneeSaveFailed', | ||
}; | ||
|
||
export const setAssignee = (assignedUser?: ApiAssignedUser, assignee: UserFormField | null, eventId: string) => | ||
actionCreator(actionTypes.ASSIGNEE_SET)({ assignedUser, assignee, eventId }); | ||
|
||
export const rollbackAssignee = (assignedUser?: ApiAssignedUser, assignee: UserFormField | null, eventId: string) => | ||
actionCreator(actionTypes.ASSIGNEE_SAVE_FAILED)({ assignedUser, assignee, eventId }); |
Oops, something went wrong.