diff --git a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature index 47bacdbe8a..869b837615 100644 --- a/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature +++ b/cypress/e2e/EnrollmentAddEventPage/EnrollmentAddEventPageForm/EnrollmentAddEventPageForm.feature @@ -50,7 +50,6 @@ Feature: User interacts with the Enrollment New Event Workspace Scenario: User should be asked to create new event after completing a stage and choose to cancel Given you land on the enrollment new event page by having typed #/enrollmentEventNew?enrollmentId=zRfAPUpjoG3&orgUnitId=DiszpKrYNg8&programId=M3xtLkYBlKI&stageId=CWaAcQYKVpq&teiId=S3JjTA4QMNe - And the data store is clean Then you see the following Enrollment: New Event And you see the widget header Foci investigation & classification And you type 2022-01-01 in the input number 0 diff --git a/cypress/e2e/EnrollmentPage/BreakingTheGlass/BreakingTheGlass.feature b/cypress/e2e/EnrollmentPage/BreakingTheGlass/BreakingTheGlass.feature index 8f20612a24..40ed7aac7c 100644 --- a/cypress/e2e/EnrollmentPage/BreakingTheGlass/BreakingTheGlass.feature +++ b/cypress/e2e/EnrollmentPage/BreakingTheGlass/BreakingTheGlass.feature @@ -4,7 +4,6 @@ Feature: Breaking the glass page @skip Scenario: User with search scope access tries to access an enrollment in a protected program Given the tei created by this test is cleared from the database - And the data store is clean And you create a new tei in Child programme from Ngelehun CHC And you change program to WHO RMNCH Tracker And you enroll the tei from Njandama MCHP diff --git a/cypress/e2e/MainPage/MainPage.feature b/cypress/e2e/MainPage/MainPage.feature index cb10b479fb..8f29db3697 100644 --- a/cypress/e2e/MainPage/MainPage.feature +++ b/cypress/e2e/MainPage/MainPage.feature @@ -35,15 +35,6 @@ Feature: User interacts with Main page Then the current url is /#/?orgUnitId=DiszpKrYNg8&programId=uy2gU8kT1jF&selectedTemplateId=uy2gU8kT1jF-default And the TEI working list is displayed - Scenario: The admin user can optout from using the new Enrollment Dashboard - Given you open the main page with Ngelehun and child programme context - And the data store is clean - And you see the opt out component for Child Programme - When you opt out to use the new enrollment Dashboard for Child Programme - Then you see the opt in component for Child Programme - When you opt in to use the new enrollment Dashboard for Child Programme - Then you see the opt out component for Child Programme - @v<41 Scenario: The icon is rendered as an svg Given you are in the main page with no selections made diff --git a/cypress/e2e/NewPage/NewPage.feature b/cypress/e2e/NewPage/NewPage.feature index b6a7907dee..29b5ffc199 100644 --- a/cypress/e2e/NewPage/NewPage.feature +++ b/cypress/e2e/NewPage/NewPage.feature @@ -7,7 +7,6 @@ Feature: User creates a new entries from the registration page @v>=41 Scenario: New person in Tracker Program > Filling the Allergies with multiple options Given you are in the WHO RMNCH program registration page - And the data store is clean When you fill in multiple Allergies options Then you can see the multiple selections in the form And you fill the WHO RMNCH program registration form with its required unique values @@ -103,14 +102,12 @@ Feature: User creates a new entries from the registration page Scenario: New person > Submitting the form with unique name navigates you to the user dashboard Given you are in the Person registration page - And the data store is clean When you fill in a unique first name And you click the save person submit button Then you are navigated to the enrollment dashboard page without enrollment Scenario: New person > Submitting the form from the duplicates modal navigates you to the user dashboard Given you are in the Person registration page - And the data store is clean When you fill in the first name with value that has duplicates And you click the save person submit button And you see the possible duplicates modal @@ -152,7 +149,6 @@ Feature: User creates a new entries from the registration page Scenario: New person in Tracker Program > Submitting the form with unique values navigates you to the user dashboard Given you are in the WHO RMNCH program registration page - And the data store is clean When you fill the WHO RMNCH program registration form with its required unique values And you click the save person submit button Then you see the enrollment event Edit page @@ -166,7 +162,6 @@ Feature: User creates a new entries from the registration page Scenario: New person in Tracker Program > Submitting the form from the duplicates modal navigates you to the user dashboard Given you are in the WHO RMNCH program registration page - And the data store is clean When you fill the WHO RMNCH program registration form with its required values And you click the save person submit button And you see the possible duplicates modal @@ -192,7 +187,6 @@ Feature: User creates a new entries from the registration page Scenario: Go to enrollment event when Open data entry form after enrollment is checked Given you are in the Malaria case diagnosis, treatment and investigation program registration page - And the data store is clean And you fill the Malaria case diagnosis registration form with values And you click the save malaria entity submit button Then you see the enrollment event Edit page diff --git a/cypress/e2e/SearchPage/SearchPage.feature b/cypress/e2e/SearchPage/SearchPage.feature index b1a2a58741..afc2f9e035 100644 --- a/cypress/e2e/SearchPage/SearchPage.feature +++ b/cypress/e2e/SearchPage/SearchPage.feature @@ -24,7 +24,6 @@ Feature: User interacts with Search page Scenario: Searching using unique identifier returns results Given you are on the default search page - And the data store is clean When you select the search domain WHO RMNCH Tracker And you fill in the unique identifier field with values that will return a tracked entity instance And you click find @@ -97,7 +96,6 @@ Feature: User interacts with Search page Scenario: Searching using attributes in Tracker Program navigates user to the dashboard view Given you are on the default search page - And the data store is clean When you select the search domain WHO RMNCH Tracker And you expand the attributes search area And you fill in the last name with values that will return results @@ -108,7 +106,6 @@ Feature: User interacts with Search page Scenario: Searching using attributes in TEType navigates user to dashboard view Given you are on the default search page - And the data store is clean When you select the search domain Person And you expand the attributes search area And you fill in the the form with first name value: Cla @@ -165,7 +162,6 @@ Feature: User interacts with Search page Scenario: Pressing enter should trigger search unique identifier returns results Given you are on the default search page - And the data store is clean When you select the search domain WHO RMNCH Tracker And you press enter after filling in the unique identifier field with values that will return a tracked entity instance Then you are navigated to the enrollment dashboard page diff --git a/cypress/support/step_definitions/common/baseSteps.js b/cypress/support/step_definitions/common/baseSteps.js index 42c19ad164..a4db6e4a30 100644 --- a/cypress/support/step_definitions/common/baseSteps.js +++ b/cypress/support/step_definitions/common/baseSteps.js @@ -181,33 +181,3 @@ When(/^the user selects the org unit (.*)$/, (orgUnit) => { cy.contains(orgUnit) .click(); }); - -When(/^you opt in to use the new enrollment Dashboard for (.*)$/, (program) => { - cy.get('[data-test="main-page-working-list"]').then(($wrapper) => { - if ($wrapper.find('[data-test="dhis2-uicore-button"]').length > 0) { - cy.contains('[data-test="dhis2-uicore-button"]', `Opt in for ${program}`).click(); - cy.contains('[data-test="opt-in-button"]', 'Yes, opt in').click(); - cy.contains('[data-test="opt-out-button"]', `Opt out for ${program}`); - } - }); -}); - -Then(/^you see the opt out component for (.*)$/, (program) => { - cy.contains('[data-test="opt-out-button"]', `Opt out for ${program}`); -}); - -When(/^you opt out to use the new enrollment Dashboard for (.*)$/, (program) => { - cy.intercept('PUT', '**/dataStore/capture/useNewDashboard').as('optOutEnrollmentDashboard'); - cy.contains('[data-test="opt-out-button"]', `Opt out for ${program}`).click(); - cy.wait('@optOutEnrollmentDashboard', { timeout: 30000 }); -}); - -Then(/^you see the opt in component for (.*)$/, (program) => { - cy.contains('[data-test="dhis2-uicore-button"]', `Opt in for ${program}`); -}); - -And('the data store is clean', () => { - cy.buildApiUrl('dataStore/capture/useNewDashboard') - .then(dataStoreUrl => - cy.request({ method: 'DELETE', url: dataStoreUrl, failOnStatusCode: false })); -}); diff --git a/docs/user/using-the-capture-app.md b/docs/user/using-the-capture-app.md index 651e9f7eb0..fab4c41175 100644 --- a/docs/user/using-the-capture-app.md +++ b/docs/user/using-the-capture-app.md @@ -821,20 +821,6 @@ For performance reasons the Capture app caches metadata in the client browser. W ## Enrollment dashboard -### Enabling the enrollment dashboard - -#### Opt in - -Enable the enrollment dashboard for a Tracker program for all the users. The dialog is visible for users with program write access. - -![](resources/images/enrollment-dash-opt-in.png) - -#### Opt out - -Disable the enrollment dashboard for a Tracker program for all the users. - -![](resources/images/enrollment-dash-opt-out.png) - ### Reaching the enrollment dashboard via url You reach the enrollment dashboard either by typing in the address bar of your browser or using the user interface of the capture app. diff --git a/i18n/en.pot b/i18n/en.pot index d299bcedcf..c098e29ad6 100644 --- a/i18n/en.pot +++ b/i18n/en.pot @@ -616,54 +616,6 @@ msgstr "Notice" msgid "Close the notice" msgstr "Close the notice" -msgid "Use new Enrollment dashboard for {{programName}}" -msgstr "Use new Enrollment dashboard for {{programName}}" - -msgid "Opt in for {{programName}}" -msgstr "Opt in for {{programName}}" - -msgid "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is " -"certain functionality from Tracker Capture that has not yet been added, " -"including relationship and referral functionality. The work on including " -"this Tracker functionality in Capture is ongoing and will be added in " -"upcoming app releases." -msgstr "" -"By clicking opt-in below, you will start using the new enrollment dashboard " -"in the Capture app for this Tracker program. At the moment, there is " -"certain functionality from Tracker Capture that has not yet been added, " -"including relationship and referral functionality. The work on including " -"this Tracker functionality in Capture is ongoing and will be added in " -"upcoming app releases." - -msgid "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." -msgstr "" -"The core team appreciates any feedback on this new functionality which is " -"currently being beta tested, please report any issues and feedback in the " -"DHIS2 JIRA project." - -msgid "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." -msgstr "" -"Click the button below to opt-in to the new enrollment dashboard " -"functionality in the Capture app (beta) for this Tracker program for all " -"users." - -msgid "Yes, opt in" -msgstr "Yes, opt in" - -msgid "Stop using new Enrollment dashboard for {{programName}}" -msgstr "Stop using new Enrollment dashboard for {{programName}}" - -msgid "Opt out for {{programName}}" -msgstr "Opt out for {{programName}}" - msgid "Enrollment with id \"{{enrollmentId}}\" does not exist" msgstr "Enrollment with id \"{{enrollmentId}}\" does not exist" diff --git a/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.constants.js b/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.constants.js deleted file mode 100644 index 435c2824ac..0000000000 --- a/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.constants.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow - -export const scopeHierarchyTypes = { - PROGRAM: 'PROGRAM', - TRACKED_ENTITY_TYPE: 'TRACKED_ENTITY_TYPE', -}; diff --git a/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.epics.js b/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.epics.js index 32f7d066e2..8b413b70a4 100644 --- a/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.epics.js +++ b/src/core_modules/capture-core/actions/navigateToEnrollmentOverview/navigateToEnrollmentOverview.epics.js @@ -4,58 +4,22 @@ import { ofType } from 'redux-observable'; import { switchMap } from 'rxjs/operators'; import { EMPTY } from 'rxjs'; import { actionTypes as NavigateToEnrollmentOverviewActionTypes } from './navigateToEnrollmentOverview.actions'; -import { buildUrlQueryString, getLocationQuery, shouldUseNewDashboard } from '../../utils/routing'; -import { scopeHierarchyTypes } from './navigateToEnrollmentOverview.constants'; +import { buildUrlQueryString } from '../../utils/routing'; -// TODO This will be removed when the link between capture and tracker capture is not relevant -const redirectToTracker = ({ teiId, orgUnitId, dependencies }) => { - const baseUrl = dependencies.absoluteApiPath; - const { search, pathname } = dependencies.history.location; - const { programId: queryProgramId, trackedEntityTypeId: queryTrackedEntityTypeId } = getLocationQuery(); - - const instanceBaseUrl = baseUrl.split('/api')[0]; - const scopeHierarchy = queryProgramId ? scopeHierarchyTypes.PROGRAM : scopeHierarchyTypes.TRACKED_ENTITY_TYPE; - const selectedScopeId = queryTrackedEntityTypeId || queryProgramId; - const scopeSearchParam = `${scopeHierarchy.toLowerCase()}=${selectedScopeId}`; - const base64Url = btoa(`/dhis-web-capture/#${pathname}${search}`); - setTimeout(() => { - window.location.href = `${instanceBaseUrl}/dhis-web-tracker-capture/#/dashboard?tei=${teiId}&ou=${orgUnitId}&${scopeSearchParam}&returnUrl=${base64Url}`; - }, 50); -}; - -const redirectToEnrollmentDashboard = ({ dependencies, teiId, programId, orgUnitId, enrollmentId }) => { - dependencies.history.push( - `/enrollment?${buildUrlQueryString({ - teiId, - programId, - orgUnitId, - enrollmentId, - })}`, - ); -}; - -export const navigateToEnrollmentOverviewEpic = (action$: InputObservable, store: ReduxStore, dependencies: any) => +export const navigateToEnrollmentOverviewEpic = (action$: InputObservable, store: ReduxStore, { history }: ApiUtils) => action$.pipe( ofType(NavigateToEnrollmentOverviewActionTypes.NAVIGATE_TO_ENROLLMENT_OVERVIEW), switchMap((action) => { const { teiId, programId, orgUnitId } = action.payload; const enrollmentId = programId && (action.payload?.enrollmentId || 'AUTO'); - const { dataStore, userDataStore } = store.value.useNewDashboard; - - if (dataStore || userDataStore) { - const shouldRedirectToEnrollmentDashboard = shouldUseNewDashboard({ - userDataStore, - dataStore, - programId, + history.push( + `/enrollment?${buildUrlQueryString({ teiId, - }); - if (shouldRedirectToEnrollmentDashboard) { - redirectToEnrollmentDashboard({ dependencies, teiId, programId, orgUnitId, enrollmentId }); - return EMPTY; - } - } - - redirectToTracker({ dependencies, store, teiId, orgUnitId }); + programId, + orgUnitId, + enrollmentId, + })}`, + ); return EMPTY; }), ); diff --git a/src/core_modules/capture-core/components/DataStore/DataStore.actions.js b/src/core_modules/capture-core/components/DataStore/DataStore.actions.js deleted file mode 100644 index a06c83561d..0000000000 --- a/src/core_modules/capture-core/components/DataStore/DataStore.actions.js +++ /dev/null @@ -1,6 +0,0 @@ -// @flow -import { actionCreator } from '../../actions/actions.utils'; -import { type UseNewDashboard, actionTypes as dataStoreActionTypes } from './DataStore.types'; - -export const saveDataStore = ({ dataStore, userDataStore }: UseNewDashboard) => - actionCreator(dataStoreActionTypes.SAVE_DATA_STORE)({ dataStore, userDataStore }); diff --git a/src/core_modules/capture-core/components/DataStore/DataStore.epics.js b/src/core_modules/capture-core/components/DataStore/DataStore.epics.js deleted file mode 100644 index 71c1cee90c..0000000000 --- a/src/core_modules/capture-core/components/DataStore/DataStore.epics.js +++ /dev/null @@ -1,61 +0,0 @@ -// @flow -import { ofType } from 'redux-observable'; -import { flatMap, catchError } from 'rxjs/operators'; -import { EMPTY } from 'rxjs'; -import { saveDataStore } from './DataStore.actions'; -import { type UseNewDashboard } from './DataStore.types'; -import { appStartActionTypes } from '../../../../components/AppStart'; -import { programCollection } from '../../metaDataMemoryStores'; - -const setNewDashboardByDefault = (key: string, dataStoreValues) => { - if (!dataStoreValues) { - return {}; - } - const programs = [...programCollection.keys()]; - const valuesWithDefault = programs.reduce((acc, program) => { - const dataStoreValue = dataStoreValues[program]; - acc[program] = dataStoreValue === undefined ? true : dataStoreValue; - return acc; - }, {}); - - return { [key]: valuesWithDefault }; -}; - -const getDataStoreFromApi = async querySingleResource => - querySingleResource({ - resource: 'dataStore/capture/useNewDashboard', - }); - -const getUserDataStoreFromApi = async querySingleResource => - querySingleResource({ - resource: 'userDataStore/capture/useNewDashboard', - }); - -export const fetchDataStoreEpic = (action$: InputObservable, _: ReduxStore, { querySingleResource }: ApiUtils) => - action$.pipe( - ofType(appStartActionTypes.APP_LOAD_SUCESS), - flatMap(async () => { - const apiDataStore: ?UseNewDashboard = await getDataStoreFromApi(querySingleResource) - .catch((error) => { - if (error.details.httpStatusCode === 404) { - return {}; - } - return undefined; - }); - - return saveDataStore(setNewDashboardByDefault('dataStore', apiDataStore)); - }), - catchError(() => EMPTY), - ); - -export const fetchUserDataStoreEpic = (action$: InputObservable, _: ReduxStore, { querySingleResource }: ApiUtils) => - action$.pipe( - ofType(appStartActionTypes.APP_LOAD_SUCESS), - flatMap(async () => { - const apiUserDataStore: UseNewDashboard = await getUserDataStoreFromApi(querySingleResource); - // $FlowFixMe - return saveDataStore(setNewDashboardByDefault('userDataStore', apiUserDataStore)); - }), - catchError(() => EMPTY), - ); - diff --git a/src/core_modules/capture-core/components/DataStore/DataStore.types.js b/src/core_modules/capture-core/components/DataStore/DataStore.types.js deleted file mode 100644 index ffa2641abb..0000000000 --- a/src/core_modules/capture-core/components/DataStore/DataStore.types.js +++ /dev/null @@ -1,9 +0,0 @@ -// @flow - -export const actionTypes = { - SAVE_DATA_STORE: 'useNewDashboard.SaveDataStore', -}; - -export type UseNewDashboard = {| - [key: string]: string, -|} diff --git a/src/core_modules/capture-core/components/DataStore/index.js b/src/core_modules/capture-core/components/DataStore/index.js deleted file mode 100644 index e6359f21f1..0000000000 --- a/src/core_modules/capture-core/components/DataStore/index.js +++ /dev/null @@ -1 +0,0 @@ -export { saveDataStore } from './DataStore.actions'; diff --git a/src/core_modules/capture-core/components/OptInOut/OptIn/OptIn.component.js b/src/core_modules/capture-core/components/OptInOut/OptIn/OptIn.component.js deleted file mode 100644 index 81a541bf82..0000000000 --- a/src/core_modules/capture-core/components/OptInOut/OptIn/OptIn.component.js +++ /dev/null @@ -1,71 +0,0 @@ -// @flow -import React, { useState, type ComponentType } from 'react'; -import { NoticeBox, Button, Modal, ModalTitle, ModalContent, ModalActions, ButtonStrip } from '@dhis2/ui'; -import i18n from '@dhis2/d2-i18n'; -import { withStyles } from '@material-ui/core'; -import type { PlainProps } from './optIn.types'; - -const styles = { - container: { - width: '80%', - margin: '0 auto', - }, -}; - -export const OptInPlain = ({ classes, programName, handleOptIn, loading }: PlainProps) => { - const [toggle, setToggle] = useState(false); - - const title = i18n.t('Use new Enrollment dashboard for {{programName}}', { - programName, - interpolation: { escapeValue: false }, - }); - const button = i18n.t('Opt in for {{programName}}', { - programName, - interpolation: { escapeValue: false }, - }); - - const modalContent = i18n.t('By clicking opt-in below, you will start using the new enrollment dashboard in the Capture app for this Tracker program. At the moment, there is certain functionality from Tracker Capture that has not yet been added, including relationship and referral functionality. The work on including this Tracker functionality in Capture is ongoing and will be added in upcoming app releases.'); - - const modalContentFeedback = i18n.t('The core team appreciates any feedback on this new functionality which is currently being beta tested, please report any issues and feedback in the DHIS2 JIRA project.'); - - return ( -
- {i18n.t('Click the button below to opt-in to the new enrollment dashboard functionality in the Capture app (beta) for this Tracker program for all users.')} -
- -{modalContent}
-{modalContentFeedback}
-- {i18n.t( - 'This program uses the new enrollment dashboard functionality ' + - 'in the Capture app (beta). Click this button to opt-out and direct ' + - 'all users to the Tracker capture app for this program.', - )} -
- -