Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into hv/fix/DHIS2-15621_…
Browse files Browse the repository at this point in the history
…RowViewIsBrokenUpInSection
  • Loading branch information
henrikmv committed Oct 18, 2023
2 parents c63f701 + 3433a91 commit ddd5a73
Show file tree
Hide file tree
Showing 17 changed files with 93 additions and 99 deletions.
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,24 @@
## [100.41.3](https://github.com/dhis2/capture-app/compare/v100.41.2...v100.41.3) (2023-10-16)


### Bug Fixes

* [DHIS2-15782] navigation with program stage filter ([#3431](https://github.com/dhis2/capture-app/issues/3431)) ([8f7a017](https://github.com/dhis2/capture-app/commit/8f7a017c5860104620c6b7fc8c20916b00037302))

## [100.41.2](https://github.com/dhis2/capture-app/compare/v100.41.1...v100.41.2) (2023-10-12)


### Bug Fixes

* [DHIS2-15827] remove effects of 'Prevent adding new events to stage' action from the form ([#3418](https://github.com/dhis2/capture-app/issues/3418)) ([f17d087](https://github.com/dhis2/capture-app/commit/f17d087f368cf4d6b26923fd5cf4fb15d7795ba2))

## [100.41.1](https://github.com/dhis2/capture-app/compare/v100.41.0...v100.41.1) (2023-10-09)


### Bug Fixes

* [DHIS2-15734] assign effect dynamic formId object key ([#3422](https://github.com/dhis2/capture-app/issues/3422)) ([85f242b](https://github.com/dhis2/capture-app/commit/85f242b2b0c6092b46e92f087e21e102a2e1e19d))

# [100.41.0](https://github.com/dhis2/capture-app/compare/v100.40.1...v100.41.0) (2023-10-03)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ Feature: Hidden program stage
Scenario: The user cannot add an event in a hidden program stage
Given you add an enrollment event that will result in a rule effect to hide a program stage
Then the New Postpartum care visit event button is disabled in the stages and events widget
And and an error is show in the Postpartum care visit stage
And the Postpartum care visit button is disabled in the enrollmentEventNew page
12 changes: 0 additions & 12 deletions cypress/integration/EnrollmentPage/HiddenProgramStage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,18 +45,6 @@ Then('the New Postpartum care visit event button is disabled in the stages and e
.should('be.disabled');
});

Then('and an error is show in the Postpartum care visit stage', () => {
cy.visit(
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA&stageId=bbKtnxRZKEP',
);
cy.contains('[data-test="dhis2-uicore-button"]', 'Complete')
.should('be.disabled');
cy.contains('[data-test="dhis2-uicore-button"]', 'Save without completing')
.should('be.disabled');
cy.contains('[data-test="dhis2-uicore-noticebox-content"]', 'You can\'t add any more Postpartum care visit events')
.should('exist');
});

Then('the Postpartum care visit button is disabled in the enrollmentEventNew page', () => {
cy.visit(
'/#/enrollmentEventNew?enrollmentId=fmhIsWXVDmS&orgUnitId=s7SLtx8wmRA&programId=WSGAb5XwJ3Y&teiId=uW8Y7AIcRKA',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,13 @@ And you select the events scheduled today
And you apply the current filter
Then you see the selected option in the scheduledAt filter

@v>=39
Scenario: The program stage working list configureation is kept when navigating
Given you open the main page with Ngelehun and WHO RMNCH Tracker context and configure a program stage working list
When you open an enrollment event from the working list
And you go back using the browser button
Then the program stage working list is loaded

@v>=40
Scenario: The user creates, updates and deletes a Program stage custom working list
Given you open the main page with Ngelehun and Malaria case diagnosis and Household investigation context
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -760,3 +760,42 @@ Then('the program stage custom working list filters are loaded', () => {
.should('have.length', 2);
});

Given('you open the main page with Ngelehun and WHO RMNCH Tracker context and configure a program stage working list', () => {
cy.visit('#/?programId=WSGAb5XwJ3Y&orgUnitId=DiszpKrYNg8');
cy.get('[data-test="template-selector-create-list"]')
.click();

cy.get('[data-test="tei-working-lists"]')
.within(() => {
cy.contains('More filters')
.click();
cy.contains('Program stage')
.click();
});

cy.get('[data-test="list-view-filter-contents"]')
.contains('Postpartum care visit')
.click();

cy.get('[data-test="list-view-filter-apply-button"]')
.click();
});

When('you open an enrollment event from the working list', () => {
cy.contains('Linda')
.click();
});

When('you go back using the browser button', () => {
cy.go('back');
});

Then('the program stage working list is loaded', () => {
cy.get('[data-test="tei-working-lists"]')
.find('[data-test="more-filters"]')
.should('have.length', 2);

cy.get('[data-test="tei-working-lists"]')
.contains('WHOMCH Hemoglobin value')
.should('exist');
});
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capture-app",
"homepage": ".",
"version": "100.41.0",
"version": "100.41.3",
"cacheVersion": "6",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "100.41.0",
"@dhis2/rules-engine-javascript": "100.41.3",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.1",
Expand Down
2 changes: 1 addition & 1 deletion packages/rules-engine/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dhis2/rules-engine-javascript",
"version": "100.41.0",
"version": "100.41.3",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import React, { type ComponentType } from 'react';
import i18n from '@dhis2/d2-i18n';
import { withStyles } from '@material-ui/core';
import { Button, spacersNum } from '@dhis2/ui';
import { ConditionalTooltip } from 'capture-core/components/ConditionalTooltip';
import { withCancelButton } from '../../DataEntry/withCancelButton';
import { addEventSaveTypes } from '../DataEntry/addEventSaveTypes';
import type { InputProps, Props } from './finishButtons.types';
Expand All @@ -18,40 +17,17 @@ const styles = {
},
};

const FinishButtonsPlain = ({ onSave, cancelButton, hiddenProgramStage, stageName, classes }: Props) => (
const FinishButtonsPlain = ({ onSave, cancelButton, classes }: Props) => (
<div className={classes.container}>
<div className={classes.button}>
<ConditionalTooltip
content={i18n.t("You can't add any more {{ programStageName }} events", {
programStageName: stageName,
interpolation: { escapeValue: false },
})}
enabled={hiddenProgramStage}
>
<Button
disabled={hiddenProgramStage}
onClick={() => onSave(addEventSaveTypes.COMPLETE)}
primary
>
{i18n.t('Complete')}
</Button>
</ConditionalTooltip>
<Button onClick={() => onSave(addEventSaveTypes.COMPLETE)} primary>
{i18n.t('Complete')}
</Button>
</div>
<div className={classes.button}>
<ConditionalTooltip
content={i18n.t("You can't add any more {{ programStageName }} events", {
programStageName: stageName,
interpolation: { escapeValue: false },
})}
enabled={hiddenProgramStage}
>
<Button
disabled={hiddenProgramStage}
onClick={() => onSave(addEventSaveTypes.SAVE_WITHOUT_COMPLETING)}
>
{i18n.t('Save without completing')}
</Button>
</ConditionalTooltip>
<Button onClick={() => onSave(addEventSaveTypes.SAVE_WITHOUT_COMPLETING)}>
{i18n.t('Save without completing')}
</Button>
</div>
{cancelButton}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ export type InputProps = {|
onSave: (saveType: $Keys<addEventSaveTypes>) => void,
onCancel: () => void,
id: string,
hiddenProgramStage: boolean,
stageName: string,
|};

export type Props = {|
onSave: (saveType: $Keys<addEventSaveTypes>) => void,
cancelButton: Element<any>,
hiddenProgramStage: boolean,
stageName: string,
...CssClasses,
|};
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { Widget } from '../../Widget';
import { DataEntry } from '../DataEntry';
import { FinishButtons } from '../FinishButtons';
import { SavingText } from '../SavingText';
import { ErrorText } from '../ErrorText';
import type { Props } from './validated.types';

const styles = () => ({
Expand All @@ -24,7 +23,6 @@ const ValidatedPlain = ({
onSave,
onCancel,
orgUnit,
hiddenProgramStage,
id,
...passOnProps
}: Props) => (
Expand All @@ -48,14 +46,8 @@ const ValidatedPlain = ({
onSave={onSave}
onCancel={onCancel}
id={id}
hiddenProgramStage={hiddenProgramStage}
stageName={stage.name}
/>
{hiddenProgramStage ? (
<ErrorText stageName={stage.name} />
) : (
<SavingText programName={programName} stageName={stage.name} orgUnitName={orgUnit.name} />
)}
<SavingText programName={programName} stageName={stage.name} orgUnitName={orgUnit.name} />
</div>
)}
</Widget>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// @flow
import React, { useCallback } from 'react';
import { useDispatch, useSelector } from 'react-redux';
import { useDispatch } from 'react-redux';
import { withAskToCreateNew, withSaveHandler } from '../../DataEntry';
import { useLifecycle } from './useLifecycle';
import { useClientFormattedRulesExecutionDependencies } from './useClientFormattedRulesExecutionDependencies';
Expand Down Expand Up @@ -29,11 +29,6 @@ export const Validated = ({
}: ContainerProps) => {
const dataEntryId = 'enrollmentEvent';
const itemId = 'newEvent';
const rulesEffectsHiddenProgram = useSelector(
({ rulesEffectsHiddenProgramStageDesc }) =>
rulesEffectsHiddenProgramStageDesc && rulesEffectsHiddenProgramStageDesc[`${dataEntryId}-${itemId}`],
);
const hiddenProgramStage = rulesEffectsHiddenProgram && rulesEffectsHiddenProgram[stage.id];

const rulesExecutionDependenciesClientFormatted =
useClientFormattedRulesExecutionDependencies(rulesExecutionDependencies, program);
Expand Down Expand Up @@ -132,7 +127,6 @@ export const Validated = ({
programName={program.name}
orgUnit={orgUnit}
rulesExecutionDependenciesClientFormatted={rulesExecutionDependenciesClientFormatted}
hiddenProgramStage={hiddenProgramStage}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,5 @@ export type Props = {|
formRef: (formInstance: any) => void,
dataEntryFieldRef: (instance: any, id: string) => void,
rulesExecutionDependenciesClientFormatted: RulesExecutionDependenciesClientFormatted,
hiddenProgramStage: boolean,
...CssClasses,
|};
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ export const TeiWorkingListsReduxProvider = ({
onDeleteTemplate,
onUpdateDefaultTemplate,
programStage,
currentTemplateId,
viewPreloaded,
...commonStateManagementProps
} = useWorkingListsCommonStateManagement(storeId, TEI_WORKING_LISTS_TYPE, program);
const dispatch = useDispatch();
Expand All @@ -47,9 +49,15 @@ export const TeiWorkingListsReduxProvider = ({
}, [dispatch, programId, storeId, selectedTemplateId]);

useEffect(() => {
selectedTemplateId && onSelectTemplate && onSelectTemplate(selectedTemplateId);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
// This hook should only fire when you navigate from the search page to the main page with a working list selected
if (selectedTemplateId &&
selectedTemplateId !== currentTemplateId &&
!viewPreloaded &&
onSelectTemplate
) {
onSelectTemplate(selectedTemplateId);
}
}, [selectedTemplateId, viewPreloaded, currentTemplateId, onSelectTemplate]);

const onSelectListRow = useCallback(({ id }) => {
const record = records[id];
Expand Down Expand Up @@ -92,6 +100,8 @@ export const TeiWorkingListsReduxProvider = ({
return (
<TeiWorkingListsSetup
{...commonStateManagementProps}
currentTemplateId={currentTemplateId}
viewPreloaded={viewPreloaded}
templateSharingType={templateSharingType}
onSelectListRow={onSelectListRow}
onLoadTemplates={onLoadTemplates}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ export const formsSectionsFieldsUIDesc = createReducerDescription({

return {
...state,
formId: {
[formId]: {
...state[formId],
...updatedFields,
},
Expand Down

0 comments on commit ddd5a73

Please sign in to comment.