From 0d9c7465937bc77b15736f37b5da534c8b0fd403 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joakim=20Storl=C3=B8kken=20Melseth?= Date: Mon, 12 Aug 2024 14:19:12 +0200 Subject: [PATCH] chore(release): stop support for 2.38 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 --- d2.config.js | 2 +- .../featuresSupport/support.js | 2 - .../Setup/hooks/useProgramStageFilters.js | 165 +++++++++--------- 3 files changed, 81 insertions(+), 88 deletions(-) diff --git a/d2.config.js b/d2.config.js index 300d6a336b..e909aff221 100644 --- a/d2.config.js +++ b/d2.config.js @@ -4,7 +4,7 @@ const config = { type: 'app', id: '92b75fd0-34cc-451c-942f-3dd0f283bcbd', - minDHIS2Version: '2.38', + minDHIS2Version: '2.39', coreApp: true, entryPoints: { diff --git a/src/core_modules/capture-core-utils/featuresSupport/support.js b/src/core_modules/capture-core-utils/featuresSupport/support.js index 682ec6dd01..637439c74b 100644 --- a/src/core_modules/capture-core-utils/featuresSupport/support.js +++ b/src/core_modules/capture-core-utils/featuresSupport/support.js @@ -1,6 +1,5 @@ // @flow export const FEATURES = Object.freeze({ - programStageWorkingList: 'programStageWorkingList', storeProgramStageWorkingList: 'storeProgramStageWorkingList', multiText: 'multiText', customIcons: 'customIcons', @@ -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, diff --git a/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/Setup/hooks/useProgramStageFilters.js b/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/Setup/hooks/useProgramStageFilters.js index fe9fbe9622..d17f1be4b1 100644 --- a/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/Setup/hooks/useProgramStageFilters.js +++ b/src/core_modules/capture-core/components/WorkingLists/TeiWorkingLists/Setup/hooks/useProgramStageFilters.js @@ -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'; @@ -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]); };