Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master' into DHIS2-15462-use-dhi…
Browse files Browse the repository at this point in the history
…s2-ui-calendarinput-component-in-forms
  • Loading branch information
alaa-yahia committed Nov 20, 2024
2 parents e3614c3 + f7bed52 commit d039205
Show file tree
Hide file tree
Showing 26 changed files with 443 additions and 119 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## [101.16.3](https://github.com/dhis2/capture-app/compare/v101.16.2...v101.16.3) (2024-11-20)


### Bug Fixes

* [DHIS2-18444] stabilize possible duplicate modal cypress test ([#3886](https://github.com/dhis2/capture-app/issues/3886)) ([5b5b477](https://github.com/dhis2/capture-app/commit/5b5b477ed3a26c7eb04c4966802769fe973e1631))

## [101.16.2](https://github.com/dhis2/capture-app/compare/v101.16.1...v101.16.2) (2024-11-19)


### Bug Fixes

* [DHIS2-16994] Image and File DE and TEA not Displayed in Changelog ([#3837](https://github.com/dhis2/capture-app/issues/3837)) ([9327210](https://github.com/dhis2/capture-app/commit/932721045126e02379f56a85af4f6586b836b4c0))

## [101.16.1](https://github.com/dhis2/capture-app/compare/v101.16.0...v101.16.1) (2024-11-17)


Expand Down
12 changes: 6 additions & 6 deletions cypress/e2e/NewPage/NewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,15 +469,15 @@ And('you fill the WHO RMNCH program registration form with its required unique v
});

And('you fill the WHO RMNCH program registration form with its required values', () => {
cy.get('input[type="text"]')
.eq(2)
.type('Ava');

cy.get('input[type="text"]')
cy.get('[data-test="capture-ui-input"]')
.eq(3)
.type('Didriksson');

cy.get('input[type="text"]')
cy.get('[data-test="capture-ui-input"]')
.eq(2)
.type('Ava');

cy.get('[data-test="capture-ui-input"]')
.eq(9)
.type('1985-10-01')
.blur();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ Feature: User facing tests for bulk actions on Tracked Entity working lists
When you confirm 3 active enrollments successfully
Then the bulk complete enrollments modal should close

#DHIS2-18447
@skip
Scenario: the user should be able to bulk complete enrollments without completing events
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select row number 1
Expand All @@ -61,6 +63,8 @@ Feature: User facing tests for bulk actions on Tracked Entity working lists
When you confirm 1 active enrollment without completing events successfully
Then the bulk complete enrollments modal should close

#DHIS2-18447
@skip
Scenario: the user should be able to bulk delete enrollments
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select the first 3 rows
Expand All @@ -69,6 +73,8 @@ Feature: User facing tests for bulk actions on Tracked Entity working lists
When you confirm deleting 3 enrollments
Then the bulk delete enrollments modal should close

#DHIS2-18447
@skip
Scenario: the user should be able to bulk delete only active enrollments
Given you open the main page with Ngelehun and Malaria Case diagnosis context
And you select the first 3 rows
Expand Down
10 changes: 8 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ msgstr ""
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1)\n"
"POT-Creation-Date: 2024-11-04T18:45:47.626Z\n"
"PO-Revision-Date: 2024-11-04T18:45:47.626Z\n"
"POT-Creation-Date: 2024-11-07T11:57:59.094Z\n"
"PO-Revision-Date: 2024-11-07T11:57:59.094Z\n"

msgid "Choose one or more dates..."
msgstr "Choose one or more dates..."
Expand Down Expand Up @@ -1547,6 +1547,12 @@ msgstr "Change"
msgid "Value"
msgstr "Value"

msgid "File"
msgstr "File"

msgid "Image"
msgstr "Image"

msgid "New {{trackedEntityTypeName}} relationship"
msgstr "New {{trackedEntityTypeName}} relationship"

Expand Down
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": "101.16.1",
"version": "101.16.3",
"cacheVersion": "7",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "101.16.1",
"@dhis2/rules-engine-javascript": "101.16.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": "101.16.1",
"version": "101.16.3",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ const getStyles = () => ({
type Props = {
showEditEvent: ?boolean,
eventId: string,
eventData: Object,
onOpenEditEvent: (orgUnit: Object, programCategory: ?ProgramCategory) => void,
programStage: ProgramStage,
eventAccess: { read: boolean, write: boolean },
Expand All @@ -76,6 +77,7 @@ const EventDetailsSectionPlain = (props: Props) => {
const {
classes,
eventId,
eventData,
onOpenEditEvent,
showEditEvent,
programStage,
Expand Down Expand Up @@ -200,6 +202,7 @@ const EventDetailsSectionPlain = (props: Props) => {
<EventChangelogWrapper
isOpen
setIsOpen={setChangeLogIsOpen}
eventData={eventData}
eventId={eventId}
formFoundation={programStage.stageForm}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import type { ProgramCategory } from '../../../WidgetEventSchedule/CategoryOptio
const mapStateToProps = (state: ReduxState) => ({
showEditEvent: state.viewEventPage.eventDetailsSection && state.viewEventPage.eventDetailsSection.showEditEvent,
eventId: state.viewEventPage.eventId,
eventData: state.viewEventPage.loadedValues?.eventContainer?.values || {},
programId: state.currentSelections.programId,
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { dataElementTypes } from '../../../metaData';
import type { Props } from './EventChangelogWrapper.types';
import { WidgetEventChangelog } from '../../WidgetsChangelog';

export const EventChangelogWrapper = ({ formFoundation, eventId, ...passOnProps }: Props) => {
export const EventChangelogWrapper = ({ formFoundation, eventId, eventData, ...passOnProps }: Props) => {
const dataItemDefinitions = useMemo(() => {
const elements = formFoundation.getElements();
const contextLabels = formFoundation.getLabels();
Expand Down Expand Up @@ -52,6 +52,7 @@ export const EventChangelogWrapper = ({ formFoundation, eventId, ...passOnProps
<WidgetEventChangelog
{...passOnProps}
eventId={eventId}
eventData={eventData}
dataItemDefinitions={dataItemDefinitions}
/>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ type PassOnProps = {|
export type Props = {
...PassOnProps,
formFoundation: RenderFoundation,
eventData: Object,
};
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ export const WidgetEventEditPlain = ({
isOpen
setIsOpen={setChangeLogIsOpen}
eventId={loadedValues.eventContainer.id}
eventData={loadedValues.eventContainer.values}
formFoundation={formFoundation}
/>
)}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import { TrackedEntityChangelogWrapper } from './TrackedEntityChangelogWrapper';

export const OverflowMenuComponent = ({
trackedEntity,
trackedEntityData,
trackedEntityTypeName,
canWriteData,
canCascadeDeleteTei,
Expand Down Expand Up @@ -68,6 +69,7 @@ export const OverflowMenuComponent = ({
programAPI={programAPI}
isOpen={changelogIsOpen}
setIsOpen={setChangelogIsOpen}
trackedEntityData={trackedEntityData}
/>
)}
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ export const OverflowMenu = ({
trackedEntityTypeName,
canWriteData,
trackedEntity,
trackedEntityData,
onDeleteSuccess,
displayChangelog,
teiId,
Expand All @@ -21,6 +22,7 @@ export const OverflowMenu = ({
canWriteData={canWriteData}
canCascadeDeleteTei={hasAuthority}
trackedEntity={trackedEntity}
trackedEntityData={trackedEntityData}
onDeleteSuccess={onDeleteSuccess}
displayChangelog={displayChangelog}
teiId={teiId}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
export type Props = {|
trackedEntity: { trackedEntity: string },
trackedEntityTypeName: string,
trackedEntityData: Object,
canWriteData: boolean,
onDeleteSuccess?: () => void,
displayChangelog: boolean,
Expand All @@ -13,6 +14,7 @@ export type Props = {|
export type PlainProps = {|
trackedEntity: { trackedEntity: string },
trackedEntityTypeName: string,
trackedEntityData: Object,
canWriteData: boolean,
canCascadeDeleteTei: boolean,
onDeleteSuccess?: () => void,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,14 @@ import { useFormFoundation } from '../../DataEntry/hooks';
import { WidgetTrackedEntityChangelog } from '../../../WidgetsChangelog';
import type { Props } from './TrackedEntityChangelogWrapper.types';

export const TrackedEntityChangelogWrapper = ({ programAPI, teiId, setIsOpen, ...passOnProps }: Props) => {
export const TrackedEntityChangelogWrapper = ({ programAPI, teiId, setIsOpen, trackedEntityData, ...passOnProps }: Props) => {
const formFoundation: RenderFoundation = useFormFoundation(programAPI);

const transformedTrackedEntityData = trackedEntityData.reduce((acc, item) => {
acc[item.attribute] = item.value;
return acc;
}, {});

const dataItemDefinitions = useMemo(() => {
if (!Object.keys(formFoundation)?.length) return {};
const elements = formFoundation.getElements();
Expand Down Expand Up @@ -58,6 +63,7 @@ export const TrackedEntityChangelogWrapper = ({ programAPI, teiId, setIsOpen, ..
close={() => setIsOpen(false)}
programId={programAPI.id}
dataItemDefinitions={dataItemDefinitions}
trackedEntityData={transformedTrackedEntityData}
/>
);
};
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ type PassOnProps = {|
teiId: string,
isOpen: boolean,
setIsOpen: (boolean | boolean => boolean) => void,
trackedEntityData: Object,
|}

export type Props = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ const WidgetProfilePlain = ({
trackedEntity={trackedEntity}
onDeleteSuccess={onDeleteSuccess}
displayChangelog={displayChangelog}
trackedEntityData={clientAttributesWithSubvalues}
teiId={teiId}
programAPI={program}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,23 @@ import { Changelog, CHANGELOG_ENTITY_TYPES } from '../common/Changelog';

type Props = {
eventId: string,
eventData: Object,
dataItemDefinitions: ItemDefinitions,
isOpen: boolean,
setIsOpen: (boolean | boolean => boolean) => void,
}

export const WidgetEventChangelog = ({
eventId,
eventData,
setIsOpen,
...passOnProps
}: Props) => (
<Changelog
{...passOnProps}
close={() => setIsOpen(false)}
entityId={eventId}
entityData={eventData}
entityType={CHANGELOG_ENTITY_TYPES.EVENT}
/>
);
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@ type Props = {
dataItemDefinitions: ItemDefinitions,
isOpen: boolean,
close: () => void,
trackedEntityData: Object,
}

export const WidgetTrackedEntityChangelog = ({
teiId,
programId,
close,
trackedEntityData,
...passOnProps
}: Props) => (
<Changelog
{...passOnProps}
close={close}
entityData={trackedEntityData}
entityId={teiId}
programId={programId}
entityType={CHANGELOG_ENTITY_TYPES.TRACKED_ENTITY}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,33 +1,37 @@
// @flow
import React from 'react';
import { Modal } from '@dhis2/ui';
import { useChangelogData } from '../hooks';
import { useChangelogData, useListDataValues } from '../hooks';
import { ChangelogComponent } from './Changelog.component';
import { CHANGELOG_ENTITY_TYPES } from './index';
import { LoadingMaskElementCenter } from '../../../LoadingMasks';
import type { ItemDefinitions } from './Changelog.types';

type Props = {
entityId: string,
entityData: Object,
entityType: $Values<typeof CHANGELOG_ENTITY_TYPES>,
isOpen: boolean,
close: () => void,
dataItemDefinitions: ItemDefinitions,
programId?: string,
}
};

export const Changelog = ({
entityId,
entityData,
entityType,
programId,
isOpen,
close,
dataItemDefinitions,
}: Props) => {
const {
records,
rawRecords,
pager,
isLoading,
isLoading: isChangelogLoading,
page,
pageSize,
setPage,
setPageSize,
sortDirection,
Expand All @@ -36,10 +40,24 @@ export const Changelog = ({
entityId,
entityType,
programId,
});

const {
processedRecords,
isLoading: isProcessingLoading,
} = useListDataValues({
rawRecords,
dataItemDefinitions,
entityId,
entityData,
entityType,
programId,
sortDirection,
page,
pageSize,
});

if (isLoading) {
if (isChangelogLoading || isProcessingLoading) {
return (
<Modal onClose={close}>
<LoadingMaskElementCenter />
Expand All @@ -51,7 +69,7 @@ export const Changelog = ({
<ChangelogComponent
isOpen={isOpen}
close={close}
records={records}
records={processedRecords}
pager={pager}
setPage={setPage}
setPageSize={setPageSize}
Expand Down
Loading

0 comments on commit d039205

Please sign in to comment.