Skip to content

Commit

Permalink
Merge branch 'master' into hv/feat/DHIS2-18325_showOrgUnitSelectorInN…
Browse files Browse the repository at this point in the history
…ewEventForm
  • Loading branch information
henrikmv committed Jan 21, 2025
2 parents a4bf697 + eb4a0a1 commit 71dacfa
Show file tree
Hide file tree
Showing 38 changed files with 405 additions and 208 deletions.
35 changes: 35 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,38 @@
## [101.21.6](https://github.com/dhis2/capture-app/compare/v101.21.5...v101.21.6) (2025-01-16)


### Bug Fixes

* [DHIS2-18668] remove delete tei button in enrollment event pages ([#3941](https://github.com/dhis2/capture-app/issues/3941)) ([aef3400](https://github.com/dhis2/capture-app/commit/aef340023249b53de305fea55627082b443da060))

## [101.21.5](https://github.com/dhis2/capture-app/compare/v101.21.4...v101.21.5) (2025-01-15)


### Bug Fixes

* [DHIS2-18836] show 'Profile' instead of 'False' during loading ([#3938](https://github.com/dhis2/capture-app/issues/3938)) ([70aa7cc](https://github.com/dhis2/capture-app/commit/70aa7ccb5c9d6dee978175b4e639e2b3cd415a9c))

## [101.21.4](https://github.com/dhis2/capture-app/compare/v101.21.3...v101.21.4) (2025-01-13)


### Bug Fixes

* [DHIS2-18355] runtime error occurs when saving empty widget in Related stages ([#3935](https://github.com/dhis2/capture-app/issues/3935)) ([4ebef85](https://github.com/dhis2/capture-app/commit/4ebef8596d1814efb385c1817b5968405b704af7))

## [101.21.3](https://github.com/dhis2/capture-app/compare/v101.21.2...v101.21.3) (2025-01-12)


### Bug Fixes

* [DHIS2-17613] Use new note endpoint ([#3908](https://github.com/dhis2/capture-app/issues/3908)) ([a9fdea8](https://github.com/dhis2/capture-app/commit/a9fdea8ac8284b28ec3c0acf0551e9cd1a68a180))

## [101.21.2](https://github.com/dhis2/capture-app/compare/v101.21.1...v101.21.2) (2025-01-09)


### Bug Fixes

* [DHIS2-18569] Relationship widget limited to 50 entries ([#3927](https://github.com/dhis2/capture-app/issues/3927)) ([a1e493d](https://github.com/dhis2/capture-app/commit/a1e493d48179e7749d61f52504fdeb3c11dfa53e))

## [101.21.1](https://github.com/dhis2/capture-app/compare/v101.21.0...v101.21.1) (2025-01-08)


Expand Down
8 changes: 8 additions & 0 deletions cypress/e2e/NewPage/NewPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -649,6 +649,14 @@ And('you delete the recently added tracked entity', () => {
});

And('you delete the recently added malaria entity', () => {
// deselect the program stage from the context selector
cy.get('[data-test="stage-selector-container-clear-icon"]')
.click();

cy.get('[data-test="dhis2-uicore-button"]')
.contains('Yes, discard changes')
.click();

cy.get('[data-test="profile-widget"]')
.contains('Malaria Entity profile')
.should('exist');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,6 @@ Feature: The user interacts with the widgets on the enrollment add event page
And the user sees the owner organisation unit
And the user sees the last update date

Scenario: You can delete a tracked entity from the profile widget
Given you add a new tracked entity in the Malaria focus investigation program
When the user clicks the "Back to all stages and events" button
When the user clicks the "New Event" button
When you open the overflow menu and click the "Delete Focus area" button
Then you see the delete tracked entity confirmation modal
When you confirm by clicking the "Yes, delete Focus area" button
Then you are redirected to the home page

Scenario: User can open the delete modal
Given you land on the enrollment add event page by having typed #/enrollmentEventNew?programId=IpHINAT79UW&orgUnitId=DiszpKrYNg8&teiId=EaOyKGOIGRp&enrollmentId=wBU0RAsYjKE&stageId=A03MvHHogjR
Then the enrollment widget should be opened
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ Feature: The user interacts with the widgets on the enrollment edit event
And the user sees the owner organisation unit
And the user sees the last update date

Scenario: You can delete a tracked entity from the profile widget
Given you add a new tracked entity in the Malaria focus investigation program
When you open the overflow menu and click the "Delete Focus area" button
Then you see the delete tracked entity confirmation modal
When you confirm by clicking the "Yes, delete Focus area" button
Then you are redirected to the home page

Scenario: User can open the delete modal
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=XGLkLlOXgmE&orgUnitId=DiszpKrYNg8
Then the enrollment widget should be opened
Expand Down Expand Up @@ -76,7 +69,7 @@ Feature: The user interacts with the widgets on the enrollment edit event
Then the event has the user Tracker demo User assigned
When you remove the assigned user
Then the event has no assignd user

@v>=41
Scenario: The user can view an event changelog on the enrollment edit event
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=QsAhMiZtnl2&orgUnitId=DiszpKrYNg8
Expand All @@ -85,7 +78,7 @@ Feature: The user interacts with the widgets on the enrollment edit event
And the changelog modal should contain data
# One row is filtered out as the metadata is no longer there
And the number of changelog table rows should be 9

@v>=41
Scenario: The user can change changelog page size
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=QsAhMiZtnl2&orgUnitId=DiszpKrYNg8
Expand All @@ -96,7 +89,7 @@ Feature: The user interacts with the widgets on the enrollment edit event
And you change the page size to 100
Then the number of changelog table rows should be 37
Then the table footer should display page 1

@v>=41
Scenario: The user can move to the next page in the changelog
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=QsAhMiZtnl2&orgUnitId=DiszpKrYNg8
Expand Down
4 changes: 2 additions & 2 deletions i18n/en.pot
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,8 @@ msgstr "Active"
msgid "Completed"
msgstr "Completed"

msgid "Please add or cancel note before saving the event"
msgstr "Please add or cancel note before saving the event"
msgid "Please add or cancel the note before saving the event"
msgstr "Please add or cancel the note before saving the event"

msgid "Save and add another"
msgstr "Save and add another"
Expand Down
10 changes: 5 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "capture-app",
"homepage": ".",
"version": "101.21.1",
"version": "101.21.6",
"cacheVersion": "7",
"serverVersion": "38",
"license": "BSD-3-Clause",
Expand All @@ -10,7 +10,7 @@
"packages/rules-engine"
],
"dependencies": {
"@dhis2/rules-engine-javascript": "101.21.1",
"@dhis2/rules-engine-javascript": "101.21.6",
"@dhis2/app-runtime": "^3.9.3",
"@dhis2/d2-i18n": "^1.1.0",
"@dhis2/d2-icons": "^1.0.1",
Expand Down Expand Up @@ -92,7 +92,7 @@
"@babel/eslint-parser": "^7.19.1",
"@babel/plugin-transform-flow-strip-types": "^7.16.7",
"@babel/preset-env": "^7.16.11",
"@babel/preset-react": "^7.16.7",
"@babel/preset-react": "^7.26.3",
"@badeball/cypress-cucumber-preprocessor": "17.2.1",
"@cypress/webpack-preprocessor": "^6.0.0",
"@dhis2/cli-app-scripts": "^10.4.0",
Expand Down Expand Up @@ -130,12 +130,12 @@
"jsdoc-export-default-interop": "^0.3.1",
"node-fetch": "2",
"redux-devtools-extension": "^2.13.9",
"wait-on": "^7.2.0"
"wait-on": "^8.0.1"
},
"resolutions": {
"@dhis2/cli-app-scripts": "^10.4.0",
"@dhis2/app-runtime": "^3.10.2",
"@babel/preset-react": "7.16.7",
"@babel/preset-react": "7.26.3",
"@dhis2/ui": "^9.10.1",
"@dhis2-ui/calendar": "^10.0.3",
"@js-temporal/polyfill": "0.4.3",
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.21.1",
"version": "101.21.6",
"license": "BSD-3-Clause",
"main": "./build/cjs/index.js",
"scripts": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ export const FEATURES = Object.freeze({
trackedEntitiesCSV: 'trackedEntitiesCSV',
newAocApiSeparator: 'newAocApiSeparator',
newEntityFilterQueryParam: 'newEntityFilterQueryParam',
newNoteEndpoint: 'newNoteEndpoint',
newRelationshipQueryParam: 'newRelationshipQueryParam',
});

// The first minor version that supports the feature
Expand All @@ -26,6 +28,8 @@ const MINOR_VERSION_SUPPORT = Object.freeze({
[FEATURES.trackedEntitiesCSV]: 40,
[FEATURES.newAocApiSeparator]: 41,
[FEATURES.newEntityFilterQueryParam]: 41,
[FEATURES.newNoteEndpoint]: 42,
[FEATURES.newRelationshipQueryParam]: 41,
});

export const hasAPISupportForFeature = (minorVersion: string | number, featureName: string) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ export const getEventDateValidatorContainers = () => {
const validatorContainers = [
{
validator: hasValue,
message: i18n.t('A value is required'),
errorMessage: i18n.t('A value is required'),
},
{
validator: preValidateDate,
message: i18n.t('Please provide a valid date'),
errorMessage: i18n.t('Please provide a valid date'),
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const validateCategories = (value?: ?string, props?: Object, fieldId?: string) =

return {
valid: hasValue(value),
message: i18n.t('Please select {{categoryName}}', { categoryName }),
errorMessage: i18n.t('Please select {{categoryName}}', { categoryName }),
};
};

export const getCategoryOptionsValidatorContainers = (props?: Object, fieldId?: string) => {
const validatorContainers = [
{
validator: (value?: ?string) => validateCategories(value, props, fieldId),
message: '',
errorMessage: '',
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ export const getEnrollmentDateValidatorContainer = () => {
const validatorContainers = [
{
validator: hasValue,
message:
errorMessage:
i18n.t('A value is required'),
},
{
validator: isValidEnrollmentDate,
message: i18n.t('Please provide a valid date'),
errorMessage: i18n.t('Please provide a valid date'),
},
{ validator: isValidNonFutureDate,
message: i18n.t('A date in the future is not allowed'),
errorMessage: i18n.t('A date in the future is not allowed'),
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ export const getIncidentDateValidatorContainer = () => {
const validatorContainers = [
{
validator: hasValue,
message:
errorMessage:
i18n.t('A value is required'),
},
{
validator: isValidIncidentDate,
message: i18n.t('Please provide a valid date'),
errorMessage: i18n.t('Please provide a valid date'),
},
{ validator: isValidNonFutureDate,
message: i18n.t('A date in the future is not allowed'),
errorMessage: i18n.t('A date in the future is not allowed'),
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ export const getEventDateValidatorContainers = () => {
const validatorContainers = [
{
validator: hasValue,
message:
errorMessage:
i18n.t('A value is required'),
},
{
validator: preValidateDate,
message: i18n.t('Please provide a valid date'),
errorMessage: i18n.t('Please provide a valid date'),
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export const getNoteValidatorContainers = () => {
const validatorContainers = [
{
validator: validateNote,
message: i18n.t('Please add or cancel note before saving the event'),
errorMessage: i18n.t('Please add or cancel the note before saving the event'),
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ type Validator = (value: any,

export type ValidatorContainer = {
validator: Validator,
message: string,
errorMessage: string,
};

export function getValidationError(value: any, validatorContainers: ?Array<ValidatorContainer>, internalComponentError?: ?{error: ?string, errorCode: ?string}) {
if (!validatorContainers) {
return null;
}

let message;
let errorMessage;
const errorEncountered = validatorContainers.some((validatorContainer) => {
const validator = validatorContainer.validator;
const result = validator(value, internalComponentError);
Expand All @@ -24,10 +24,10 @@ export function getValidationError(value: any, validatorContainers: ?Array<Valid
return false;
}

message = (result && result.errorMessage) || (result && result.message) || validatorContainer.message;
errorMessage = (result && result.errorMessage) || validatorContainer.errorMessage;
return true;
});


return (errorEncountered ? (message || i18n.t('validation failed')) : null);
return (errorEncountered ? (errorMessage || i18n.t('validation failed')) : null);
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ const validateCategories = (value?: ?string, props?: Object, fieldId?: string) =

return {
valid: hasValue(value),
message: i18n.t('Please select {{categoryName}}', { categoryName }),
errorMessage: i18n.t('Please select {{categoryName}}', { categoryName }),
};
};

export const getCategoryOptionsValidatorContainers = (props?: Object, fieldId?: string) => {
const validatorContainers = [
{
validator: (value?: ?string) => validateCategories(value, props, fieldId),
message: '',
errorMessage: '',
},
];
return validatorContainers;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
// @flow
import { featureAvailable, FEATURES } from 'capture-core-utils';
import { actionCreator } from '../../../../actions/actions.utils';
import { effectMethods } from '../../../../trackerOffline';

Expand All @@ -25,11 +26,13 @@ export const updateEventNoteField = (value: string) =>
export const requestSaveEventNote = (note: string) =>
actionCreator(actionTypes.REQUEST_SAVE_EVENT_NOTE)({ note });

export const startSaveEventNote = (eventId: string, serverData: Object, selections: Object, clientId: string) =>
export const startSaveEventNote = (eventUid: string, serverData: Object, selections: Object, clientId: string) =>
actionCreator(actionTypes.START_SAVE_EVENT_NOTE)({ selections, clientId }, {
offline: {
effect: {
url: `events/${eventId}/note`,
url: (featureAvailable(FEATURES.newNoteEndpoint))
? `tracker/events/${eventUid}/note`
: `events/${eventUid}/note`,
method: effectMethods.POST,
data: serverData,
},
Expand Down
Loading

0 comments on commit 71dacfa

Please sign in to comment.