Skip to content

Commit

Permalink
chore(release): stop support for 2.38
Browse files Browse the repository at this point in the history
To keep a manageable codebase, we have decided to support only the same version range as the backend. However, in contrast to the backend, we will release new features for all the supported versions as long as we have the backend support.

BREAKING CHANGE: Bump version to 101.0.0 to facilitate potential fixes for 2.38
  • Loading branch information
JoakimSM committed Aug 12, 2024
1 parent bae6e7a commit 4074978
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 90 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,7 @@ Feature: User interacts with Stages and Events Widget
Given you open the enrollment page by typing #enrollment?programId=IpHINAT79UW&orgUnitId=UgYg0YW7ZIh&teiId=fhFQhO0xILJ&enrollmentId=gPDueU02tn8
Then you should see the disabled button New Birth event

# Waiting for pipline to update DB/DB update for 39 and 41
@user:trackerAutoTestRestricted @v=38 @v=40 @v=42
@user:trackerAutoTestRestricted
Scenario: Program stage is hidden if no data read access
And you open the enrollment page by typing #enrollment?enrollmentId=iNEq9d22Nyp&orgUnitId=DiszpKrYNg8&programId=WSGAb5XwJ3Y&teiId=k4ODejBytgv
Then the Care at birth program stage should be hidden
2 changes: 1 addition & 1 deletion d2.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const config = {
type: 'app',

id: '92b75fd0-34cc-451c-942f-3dd0f283bcbd',
minDHIS2Version: '2.38',
minDHIS2Version: '2.39',
coreApp: true,

entryPoints: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
// @flow
export const FEATURES = Object.freeze({
programStageWorkingList: 'programStageWorkingList',
storeProgramStageWorkingList: 'storeProgramStageWorkingList',
multiText: 'multiText',
customIcons: 'customIcons',
Expand All @@ -14,7 +13,6 @@ export const FEATURES = Object.freeze({

// The first minor version that supports the feature
const MINOR_VERSION_SUPPORT = Object.freeze({
[FEATURES.programStageWorkingList]: 39,
[FEATURES.storeProgramStageWorkingList]: 40,
[FEATURES.multiText]: 41,
[FEATURES.customIcons]: 41,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// @flow
import { useMemo } from 'react';
import i18n from '@dhis2/d2-i18n';
import { useFeature, FEATURES } from 'capture-core-utils';
import { statusTypes, translatedStatusTypes } from 'capture-core/events/statusTypes';
import { type TrackerProgram, type ProgramStage } from '../../../../../metaData';
import { ADDITIONAL_FILTERS, ADDITIONAL_FILTERS_LABELS } from '../../helpers';
Expand Down Expand Up @@ -34,94 +33,90 @@ const useProgramStageDropdowOptions = stages =>
);

export const useProgramStageFilters = ({ stages }: TrackerProgram, programStageId?: string) => {
const supportsProgramStageWorkingLists = useFeature(FEATURES.programStageWorkingList);
const { hideDueDate, occurredAtLabel, scheduledAtLabel } = useProgramStageData(programStageId, stages);
const options: Array<{ text: string, value: string }> = useProgramStageDropdowOptions(stages);

return useMemo(() => {
if (supportsProgramStageWorkingLists) {
const translatedStatus = translatedStatusTypes();
return [
{
id: ADDITIONAL_FILTERS.programStage,
type: 'TEXT',
header: i18n.t(ADDITIONAL_FILTERS_LABELS.programStage),
options,
mainButton: true,
transformRecordsFilter: () => null,
const translatedStatus = translatedStatusTypes();
return [
{
id: ADDITIONAL_FILTERS.programStage,
type: 'TEXT',
header: i18n.t(ADDITIONAL_FILTERS_LABELS.programStage),
options,
mainButton: true,
transformRecordsFilter: () => null,
},
{
id: ADDITIONAL_FILTERS.occurredAt,
type: 'DATE',
header: occurredAtLabel,
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: occurredAtLabel,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (filter: string) => {
const queryArgs = {};
const filterParts = filter.split(':');
const indexGe = filterParts.indexOf('ge');
const indexLe = filterParts.indexOf('le');
if (indexGe !== -1 && filterParts[indexGe + 1]) {
queryArgs.occurredAfter = filterParts[indexGe + 1];
}
if (indexLe !== -1 && filterParts[indexLe + 1]) {
queryArgs.occurredBefore = filterParts[indexLe + 1];
}
return queryArgs;
},
{
id: ADDITIONAL_FILTERS.occurredAt,
type: 'DATE',
header: occurredAtLabel,
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: occurredAtLabel,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (filter: string) => {
const queryArgs = {};
const filterParts = filter.split(':');
const indexGe = filterParts.indexOf('ge');
const indexLe = filterParts.indexOf('le');
if (indexGe !== -1 && filterParts[indexGe + 1]) {
queryArgs.occurredAfter = filterParts[indexGe + 1];
}
if (indexLe !== -1 && filterParts[indexLe + 1]) {
queryArgs.occurredBefore = filterParts[indexLe + 1];
}
return queryArgs;
},
},
{
id: ADDITIONAL_FILTERS.status,
type: 'TEXT',
header: i18n.t(ADDITIONAL_FILTERS_LABELS.status),
options: [
{ text: translatedStatus.ACTIVE, value: statusTypes.ACTIVE },
{ text: translatedStatus.SCHEDULE, value: statusTypes.SCHEDULE },
{ text: translatedStatus.COMPLETED, value: statusTypes.COMPLETED },
{ text: translatedStatus.OVERDUE, value: statusTypes.OVERDUE },
{ text: translatedStatus.SKIPPED, value: statusTypes.SKIPPED },
],
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: ADDITIONAL_FILTERS_LABELS.status,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (rawFilter: string) => ({
status: rawFilter.split(':')[1],
}),
},
...(hideDueDate === false
? [
{
id: ADDITIONAL_FILTERS.scheduledAt,
type: 'DATE',
header: scheduledAtLabel,
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: scheduledAtLabel,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (filter: string) => {
const queryArgs = {};
const filterParts = filter.split(':');
const indexGe = filterParts.indexOf('ge');
const indexLe = filterParts.indexOf('le');
if (indexGe !== -1 && filterParts[indexGe + 1]) {
queryArgs.scheduledAfter = filterParts[indexGe + 1];
}
if (indexLe !== -1 && filterParts[indexLe + 1]) {
queryArgs.scheduledBefore = filterParts[indexLe + 1];
}
return queryArgs;
},
},
{
id: ADDITIONAL_FILTERS.status,
type: 'TEXT',
header: i18n.t(ADDITIONAL_FILTERS_LABELS.status),
options: [
{ text: translatedStatus.ACTIVE, value: statusTypes.ACTIVE },
{ text: translatedStatus.SCHEDULE, value: statusTypes.SCHEDULE },
{ text: translatedStatus.COMPLETED, value: statusTypes.COMPLETED },
{ text: translatedStatus.OVERDUE, value: statusTypes.OVERDUE },
{ text: translatedStatus.SKIPPED, value: statusTypes.SKIPPED },
],
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: ADDITIONAL_FILTERS_LABELS.status,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (rawFilter: string) => ({
status: rawFilter.split(':')[1],
}),
},
...(hideDueDate === false
? [
{
id: ADDITIONAL_FILTERS.scheduledAt,
type: 'DATE',
header: scheduledAtLabel,
disabled: !programStageId,
tooltipContent: i18n.t('Choose a program stage to filter by {{label}}', {
label: scheduledAtLabel,
interpolation: { escapeValue: false },
}),
transformRecordsFilter: (filter: string) => {
const queryArgs = {};
const filterParts = filter.split(':');
const indexGe = filterParts.indexOf('ge');
const indexLe = filterParts.indexOf('le');
if (indexGe !== -1 && filterParts[indexGe + 1]) {
queryArgs.scheduledAfter = filterParts[indexGe + 1];
}
if (indexLe !== -1 && filterParts[indexLe + 1]) {
queryArgs.scheduledBefore = filterParts[indexLe + 1];
}
return queryArgs;
},
]
: []),
];
}
return [];
}, [programStageId, supportsProgramStageWorkingLists, occurredAtLabel, scheduledAtLabel, hideDueDate, options]);
},
]
: []),
];
}, [programStageId, occurredAtLabel, scheduledAtLabel, hideDueDate, options]);
};

0 comments on commit 4074978

Please sign in to comment.