From 41851d23123b2d210a04865000f4749367244ee6 Mon Sep 17 00:00:00 2001 From: "@dhis2-bot" Date: Thu, 16 May 2024 10:50:53 +0000 Subject: [PATCH 1/6] chore(release): cut 100.2.2 [skip release] ## [100.2.2](https://github.com/dhis2/dashboard-app/compare/v100.2.1...v100.2.2) (2024-05-16) ### Bug Fixes * avoid re-rendering an item when adding the same again (DHIS2-17016) ([#2935](https://github.com/dhis2/dashboard-app/issues/2935)) ([dd67fc6](https://github.com/dhis2/dashboard-app/commit/dd67fc69c6b39bd177c1dd6a51cdf90d4dd4a1a2)) * avoid reading from undefined error (DHIS2-17334) ([#2970](https://github.com/dhis2/dashboard-app/issues/2970)) ([a4e5340](https://github.com/dhis2/dashboard-app/commit/a4e5340a6605db261fd2a2af1ced272d94c760dc)) * dimension list design (DHIS2-16270) ([#2861](https://github.com/dhis2/dashboard-app/issues/2861)) ([790afd2](https://github.com/dhis2/dashboard-app/commit/790afd2d64e8fb8252088453cdb803735b79c4de)) * system / user setting for display name not respected in Org Unit tree (DHIS2-15000) ([#2971](https://github.com/dhis2/dashboard-app/issues/2971)) ([928b88a](https://github.com/dhis2/dashboard-app/commit/928b88a7a97816f0c0a8a9cf364bf7fa189c848a)) --- CHANGELOG.md | 10 ++++++++++ package.json | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f290732cb..2cb261373 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,13 @@ +## [100.2.2](https://github.com/dhis2/dashboard-app/compare/v100.2.1...v100.2.2) (2024-05-16) + + +### Bug Fixes + +* avoid re-rendering an item when adding the same again (DHIS2-17016) ([#2935](https://github.com/dhis2/dashboard-app/issues/2935)) ([dd67fc6](https://github.com/dhis2/dashboard-app/commit/dd67fc69c6b39bd177c1dd6a51cdf90d4dd4a1a2)) +* avoid reading from undefined error (DHIS2-17334) ([#2970](https://github.com/dhis2/dashboard-app/issues/2970)) ([a4e5340](https://github.com/dhis2/dashboard-app/commit/a4e5340a6605db261fd2a2af1ced272d94c760dc)) +* dimension list design (DHIS2-16270) ([#2861](https://github.com/dhis2/dashboard-app/issues/2861)) ([790afd2](https://github.com/dhis2/dashboard-app/commit/790afd2d64e8fb8252088453cdb803735b79c4de)) +* system / user setting for display name not respected in Org Unit tree (DHIS2-15000) ([#2971](https://github.com/dhis2/dashboard-app/issues/2971)) ([928b88a](https://github.com/dhis2/dashboard-app/commit/928b88a7a97816f0c0a8a9cf364bf7fa189c848a)) + ## [100.2.1](https://github.com/dhis2/dashboard-app/compare/v100.2.0...v100.2.1) (2024-04-24) diff --git a/package.json b/package.json index 46e6517b6..8c61ae00d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "dashboard-app", - "version": "100.2.1", + "version": "100.2.2", "description": "DHIS2 Dashboard app", "private": true, "license": "BSD-3-Clause", From ac3f1c729c9e3a59415de5e56b058e771f5bec81 Mon Sep 17 00:00:00 2001 From: "@dhis2-bot" Date: Sun, 19 May 2024 03:40:08 +0200 Subject: [PATCH 2/6] fix(translations): sync translations from transifex (dev) Automatically merged. --- i18n/lo.po | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/i18n/lo.po b/i18n/lo.po index 3bd66c1af..19e9cce36 100644 --- a/i18n/lo.po +++ b/i18n/lo.po @@ -4,13 +4,14 @@ # Philip Larsen Donnelly, 2021 # Somkhit Bouavong , 2022 # Saysamone Sibounma, 2023 +# Namwan Chanthavisouk, 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" -"POT-Creation-Date: 2024-02-26T14:42:02.563Z\n" +"POT-Creation-Date: 2024-03-19T12:31:03.302Z\n" "PO-Revision-Date: 2019-06-25 12:37+0000\n" -"Last-Translator: Saysamone Sibounma, 2023\n" +"Last-Translator: Namwan Chanthavisouk, 2024\n" "Language-Team: Lao (https://app.transifex.com/hisp-uio/teams/100509/lo/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -82,6 +83,12 @@ msgstr "" msgid "Filters not applied" msgstr "" +msgid "Only Period and Organisation unit filters can be applied to this item" +msgstr "" + +msgid "Some filters not applied" +msgstr "" + msgid "There was a problem loading this dashboard item" msgstr "" @@ -152,7 +159,7 @@ msgid "Open this item in {{appName}}" msgstr "" msgid "Not available offline" -msgstr "" +msgstr "ບໍ່ສາມາດໃຊ້ໄດ້ອອບລາຍ" msgid "Visualizations" msgstr "" From 1c2d1b28a9532fe41352382c7fd4408ad2789ac9 Mon Sep 17 00:00:00 2001 From: "@dhis2-bot" Date: Sun, 26 May 2024 03:40:49 +0200 Subject: [PATCH 3/6] fix(translations): sync translations from transifex (dev) Automatically merged. --- i18n/lo.po | 4 ++-- i18n/ru.po | 7 ++++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/i18n/lo.po b/i18n/lo.po index 19e9cce36..d04a228a8 100644 --- a/i18n/lo.po +++ b/i18n/lo.po @@ -263,7 +263,7 @@ msgid "No, stay here" msgstr "" msgid "Yes, discard changes" -msgstr "" +msgstr "ຕົກລົງ, ຍົກເລີກການປ່ຽນແປງ" msgid "No access" msgstr "ບໍ່ມີການເຂົ້າເຖີງ" @@ -458,7 +458,7 @@ msgid "" msgstr "" msgid "No, cancel" -msgstr "" +msgstr "ບໍ່, ຍົກເລີກ" msgid "Yes, remove filters" msgstr "" diff --git a/i18n/ru.po b/i18n/ru.po index 0b3a9ffad..9d86e0e86 100644 --- a/i18n/ru.po +++ b/i18n/ru.po @@ -3,13 +3,14 @@ # Philip Larsen Donnelly, 2021 # Viktor Varland , 2021 # Ulanbek Abakirov , 2024 +# Yury Rogachev , 2024 # msgid "" msgstr "" "Project-Id-Version: i18next-conv\n" "POT-Creation-Date: 2024-03-19T12:31:03.302Z\n" "PO-Revision-Date: 2019-06-25 12:37+0000\n" -"Last-Translator: Ulanbek Abakirov , 2024\n" +"Last-Translator: Yury Rogachev , 2024\n" "Language-Team: Russian (https://app.transifex.com/hisp-uio/teams/100509/ru/)\n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" @@ -263,7 +264,7 @@ msgid "No, stay here" msgstr "Нет, остаюсь тут" msgid "Yes, discard changes" -msgstr "" +msgstr "Да, не сохранять изменения" msgid "No access" msgstr "Нет доступа" @@ -466,7 +467,7 @@ msgid "" msgstr "" msgid "No, cancel" -msgstr "" +msgstr "Нет, отменить" msgid "Yes, remove filters" msgstr "" From 74c9b194ed4dc3b6915ba5e0583b99999f6f8ef0 Mon Sep 17 00:00:00 2001 From: Adel Bensaad Date: Tue, 4 Jun 2024 13:55:57 +0100 Subject: [PATCH 4/6] chore: [DHIS2-17377] enhance CI with conditional e2e tests recording in Cypress Cloud (#2984) Implements DHIS2-17377 Conditional Recording Triggers: Implemented conditional recording triggers via commit messages and GitHub labels to ensure that Cypress tests are only recorded when necessary. Parallel Execution Strategies: Refined parallel execution strategies to improve efficiency and resolve test redundancies in GitHub Actions. Debugging Enhancements: Added detailed debugging outputs to help track the dynamic values of the test environment variables and ensure correct parameter passing in the workflow. Manual Grouping of Tests: In GitHub Actions, without specified test groups, all tests would run in every parallel container, leading to unnecessary repetition. By organizing tests into predefined groups, each group runs only once. This prevents redundancy and expedites the testing process. Why Not Rely on Cypress's Automatic Balancing? While Cypress automatically assigns tests to machines to balance workload (more on Cypress load balancing), GitHub Actions requires explicit distribution of tasks. This manual grouping ensures efficient resource usage and prevents multiple executions of the same tests across different runners. Benefits: This approach allows precise control over test distribution, enhancing predictability and efficiency. It reduces total execution time and operational costs by ensuring each test is run precisely once across the available infrastructure. This method optimises our use of GitHub Actions, ensuring a faster, cost-effective, and efficient testing process. Update Documentation: Updated the documentation to reflect the changes and ensure clarity on the new CI/CD processes. Expected Outcomes: Reduced Cypress Cloud Credit Usage: By optimising the conditions under which tests are recorded and uploaded to Cypress Cloud, we anticipate a significant reduction in credit usage. Increased CI Efficiency: With better management of parallel execution and conditional testing, the CI process should be more efficient, leading to quicker test cycles. --------- Co-authored-by: @dhis2-bot Co-authored-by: Jen Jones Arnesen --- .github/workflows/dhis2-verify-app.yml | 48 ++++++++++++++++++++++---- README.md | 9 +++++ cypress/support/generateTestMatrix.js | 35 +++++++++++++++++++ 3 files changed, 85 insertions(+), 7 deletions(-) create mode 100644 cypress/support/generateTestMatrix.js diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index 84741d1e0..db0d089ae 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -2,7 +2,7 @@ name: 'dhis2: verify (app)' on: pull_request: - types: ['opened', 'edited', 'reopened', 'synchronize'] + types: ['opened', 'labeled', 'reopened', 'synchronize'] push: branches: - 'master' @@ -19,6 +19,18 @@ env: CI: true jobs: + setup-matrix: + runs-on: ubuntu-latest + outputs: + matrix: ${{ steps.set-matrix.outputs.specs }} + steps: + - uses: actions/checkout@v3 + - name: Generate test matrix + id: set-matrix + run: | + node cypress/support/generateTestMatrix.js > matrix.json + echo "::set-output name=specs::$(cat matrix.json)" + build: runs-on: ubuntu-latest steps: @@ -77,12 +89,16 @@ jobs: e2e-prod: runs-on: ubuntu-latest - needs: test + needs: [test, setup-matrix] if: "!contains(github.event.head_commit.message, '[skip ci]')" strategy: + fail-fast: false matrix: - containers: [1, 2, 3, 4] + spec-group: ${{ fromJson(needs.setup-matrix.outputs.matrix) }} + + env: + SHOULD_RECORD: ${{ contains(github.event.head_commit.message, '[e2e record]') || contains(join(github.event.pull_request.labels.*.name), 'e2e record') }} steps: - uses: actions/checkout@v3 @@ -96,17 +112,35 @@ jobs: path: '**/node_modules' key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} + - name: Set Cypress Record Environment Variables + if: env.SHOULD_RECORD == 'true' + run: | + echo "CYPRESS_GROUP=e2e-${{ matrix.spec-group.id }}" >> $GITHUB_ENV + echo "CYPRESS_TAG=${{ github.event_name }}" >> $GITHUB_ENV + echo "CYPRESS_CI_BUILD_ID=${{ github.run_id }}" >> $GITHUB_ENV + + - name: Debug Environment Variables + run: | + echo "SHOULD_RECORD=${{ env.SHOULD_RECORD }}" + echo "CI Build ID=${{ github.run_id }}" + echo "Computed Group=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }}" + echo "Computed Tag=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }}" + echo "Computed CI Build ID=${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }}" + echo "Spec=${{ join(matrix.spec-group.tests, ',') }}" + - name: End-to-End tests uses: cypress-io/github-action@v2 with: - record: true - parallel: true start: ${{ env.SERVER_START_CMD }} wait-on: ${{ env.SERVER_URL }} wait-on-timeout: 300 cache-key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('patches/*.patch') }} - group: 'e2e' - tag: ${{ github.event_name }} + record: ${{ env.SHOULD_RECORD }} + parallel: ${{ env.SHOULD_RECORD }} + group: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_GROUP || '' }} + tag: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_TAG || '' }} + ci-build-id: ${{ env.SHOULD_RECORD == 'true' && env.CYPRESS_CI_BUILD_ID || '' }} + spec: ${{ join(matrix.spec-group.tests, ',') }} env: CI: true CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} diff --git a/README.md b/README.md index 400c39899..94f665056 100644 --- a/README.md +++ b/README.md @@ -61,6 +61,15 @@ Builds the app for production to the `build` folder.
. This command is run See the [building](https://platform.dhis2.nu/#/scripts/build) section for more information. +## Conditional E2E Test Recording + +To record e2e tests in Cypress Cloud, you can use one of the following methods based on your needs: + +- **Commit Message**: Include `[e2e record]` in your commit messages to activate recording. +- **GitHub Labels**: Apply the `e2e record` label to your pull request to trigger recording. + +This setup helps in managing Cypress Cloud credits more efficiently, ensuring recordings are only made when explicitly required. + ## Learn More You can learn more about the platform in the [DHIS2 Application Platform Documentation](https://platform.dhis2.nu/). diff --git a/cypress/support/generateTestMatrix.js b/cypress/support/generateTestMatrix.js new file mode 100644 index 000000000..473181936 --- /dev/null +++ b/cypress/support/generateTestMatrix.js @@ -0,0 +1,35 @@ +const fs = require('fs') +const path = require('path') + +const getAllFiles = (dirPath, arrayOfFiles = []) => { + const files = fs.readdirSync(dirPath) + + files.forEach((file) => { + if (fs.statSync(path.join(dirPath, file)).isDirectory()) { + arrayOfFiles = getAllFiles(path.join(dirPath, file), arrayOfFiles) + } else if (path.extname(file) === '.feature') { + arrayOfFiles.push(path.join(dirPath, file)) + } + }) + + return arrayOfFiles +} + +const createGroups = (files, numberOfGroups = 8) => { + const groups = [] + for (let i = 0; i < numberOfGroups; i++) { + groups.push([]) + } + + files.forEach((file, index) => { + groups[index % numberOfGroups].push(file) + }) + + return groups.map((group, index) => ({ id: index + 1, tests: group })) +} + +const cypressSpecsPath = './cypress/integration' +const specs = getAllFiles(cypressSpecsPath) +const groupedSpecs = createGroups(specs) + +console.log(JSON.stringify(groupedSpecs)) From d92d48a9a4304658bebb3a919c1345109f725b36 Mon Sep 17 00:00:00 2001 From: Jen Jones Arnesen Date: Thu, 6 Jun 2024 10:11:04 +0200 Subject: [PATCH 5/6] chore: run release step on tags so it publishes to d2-ci (#2989) * chore: run release step on tags so it publishes to d2-ci * chore: do not run release step on dev branch --- .github/workflows/dhis2-verify-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dhis2-verify-app.yml b/.github/workflows/dhis2-verify-app.yml index db0d089ae..c6d3d4da7 100644 --- a/.github/workflows/dhis2-verify-app.yml +++ b/.github/workflows/dhis2-verify-app.yml @@ -160,7 +160,7 @@ jobs: if: | !github.event.push.repository.fork && github.actor != 'dependabot[bot]' && - (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/dev') + (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/')) steps: - uses: actions/checkout@v3 with: From 8b3587ed13f7c9019a2606fa8e120e4146de3b7e Mon Sep 17 00:00:00 2001 From: Edoardo Sabadelli Date: Thu, 6 Jun 2024 14:56:15 +0200 Subject: [PATCH 6/6] fix: fetch visualization always when caching (DHIS2-17509) (#2986) A previous fix for an item flashing issue caused the offline cache to lack the request for the visualizations. The fix looks at the recording state and triggers a fetch that can be recorded. --- src/components/Item/VisualizationItem/Item.js | 10 ++++++++++ src/pages/view/ItemGrid.js | 1 + 2 files changed, 11 insertions(+) diff --git a/src/components/Item/VisualizationItem/Item.js b/src/components/Item/VisualizationItem/Item.js index 93f30c97b..f17f235bf 100644 --- a/src/components/Item/VisualizationItem/Item.js +++ b/src/components/Item/VisualizationItem/Item.js @@ -114,6 +114,15 @@ class Item extends Component { this.setState({ configLoaded: true }) } + componentDidUpdate(prevProps) { + if ( + this.props.isRecording && + this.props.isRecording !== prevProps.isRecording + ) { + apiFetchVisualization(this.props.item) + } + } + isFullscreenSupported = () => { const el = getGridItemElement(this.props.item.id) return !!(el?.requestFullscreen || el?.webkitRequestFullscreen) @@ -322,6 +331,7 @@ Item.propTypes = { dashboardMode: PropTypes.string, gridWidth: PropTypes.number, isEditing: PropTypes.bool, + isRecording: PropTypes.bool, item: PropTypes.object, itemFilters: PropTypes.object, setActiveType: PropTypes.func, diff --git a/src/pages/view/ItemGrid.js b/src/pages/view/ItemGrid.js index 28241b1ef..0a112be77 100644 --- a/src/pages/view/ItemGrid.js +++ b/src/pages/view/ItemGrid.js @@ -109,6 +109,7 @@ const ResponsiveItemGrid = ({ dashboardId, dashboardItems }) => { item={item} gridWidth={gridWidth} dashboardMode={VIEW} + isRecording={forceLoad} onToggleItemExpanded={onToggleItemExpanded} />