Skip to content

fix: remove d2 #3023

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 40 commits into
base: master
Choose a base branch
from
Open

fix: remove d2 #3023

wants to merge 40 commits into from

Conversation

edoardo
Copy link
Member

@edoardo edoardo commented Apr 18, 2024

Implements DHIS2-19197


Key features

  1. get rid of d2 entirely

Description

This branch has changes to remove the need for d2.


TODO

  • figure out how to use the user data store without d2
  • lots of regression testing
  • fix tests, particularly the App.js tests, but before touching them we should figure out how we want to test, what should
    be tested in Cypress and what in unit tests
  • look for and clean up more code not needed
  • see if it's possible to avoid fetching all user authorities to check for the ALL, do we really need the isSuperuser flag?
  • fix DimensionsPanel.spec.js: figure out how to mock the cachedDataQuery / provider (tests are skipped)

Known issues

  • the user data store is used to store the visualization object when switching visualization from DV to Maps. Currently it relies on d2 as it's using some classes defined in that package.
  • now that with this PR DV uses the app service data for getting/setting the current AO in the user data store, Maps should be updated in order to read the AO from the same key, since the app service stores the key under settings. Fixed here.

Screenshots

Not very meaningful but this is the app running on this branch:
Screenshot 2022-07-21 at 15 16 34

@dhis2-bot
Copy link
Contributor

dhis2-bot commented Apr 18, 2024

🚀 Deployed on https://pr-3023.data-visualizer.netlify.dhis2.org

@dhis2-bot dhis2-bot temporarily deployed to netlify April 18, 2024 07:50 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 18, 2024 07:57 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 25, 2024 10:58 Inactive
@jenniferarnesen jenniferarnesen changed the base branch from dev to master June 21, 2024 09:49
@edoardo edoardo force-pushed the fix/remove-d2-v2 branch from bcc0334 to a3ada98 Compare July 5, 2024 08:54
@dhis2-bot dhis2-bot temporarily deployed to netlify July 5, 2024 08:56 Inactive
edoardo added 3 commits July 8, 2024 15:07
The confirm screen when leaving the page didn't work with functional
components.
@dhis2-bot dhis2-bot temporarily deployed to netlify July 8, 2024 13:17 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 8, 2024 13:50 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify July 9, 2024 08:30 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify August 16, 2024 12:29 Inactive
@edoardo edoardo mentioned this pull request Dec 5, 2024
7 tasks
@edoardo edoardo added the On hold label Dec 5, 2024
@dhis2-bot dhis2-bot temporarily deployed to netlify April 28, 2025 13:13 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 28, 2025 13:22 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify April 28, 2025 14:06 Inactive
@edoardo edoardo added the e2e dev Run e2e against analytics-dev label May 6, 2025
@dhis2-bot dhis2-bot temporarily deployed to netlify May 6, 2025 11:20 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 6, 2025 13:18 Inactive
edoardo added 2 commits May 7, 2025 14:46
Needed once the Highchart's offline export PR is merged.
@dhis2-bot dhis2-bot temporarily deployed to netlify May 7, 2025 12:52 Inactive
@edoardo edoardo requested a review from HendrikThePendric May 7, 2025 13:47
@edoardo edoardo removed the On hold label May 8, 2025
@dhis2-bot dhis2-bot temporarily deployed to netlify May 8, 2025 09:01 Inactive
@dhis2-bot dhis2-bot temporarily deployed to netlify May 8, 2025 12:08 Inactive
@edoardo edoardo marked this pull request as ready for review May 8, 2025 12:25
Copy link
Contributor

@HendrikThePendric HendrikThePendric left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes all look great, the bundle size will have decreased and I think the code is a lot easier to follow in many places now. The changes we discussed when you walked me through the changed have all been implemented, so I think this is ready for KFMT now 🚀 .

@HendrikThePendric
Copy link
Contributor

Just one additional note after my approval. If fixing the SonarCube issue is easy to do then it would be good to address it.

But on the other hand:

  • The level of complexity was already present, you actually simplified this code.
  • It's a bit of a false positive anyway, the code is indeed 4 levels but that's just because there are two nested describe scopes and one it, so the "brain overload" tag here is not really applicable.

@dhis2-bot dhis2-bot temporarily deployed to netlify May 9, 2025 08:45 Inactive
@edoardo
Copy link
Member Author

edoardo commented May 9, 2025

Just one additional note after my approval. If fixing the SonarCube issue is easy to do then it would be good to address it.

But on the other hand:

  • The level of complexity was already present, you actually simplified this code.
  • It's a bit of a false positive anyway, the code is indeed 4 levels but that's just because there are two nested describe scopes and one it, so the "brain overload" tag here is not really applicable.

I refactored the test and extracted the intercept function.

@dhis2-bot dhis2-bot temporarily deployed to netlify May 9, 2025 11:14 Inactive
)
goToStartPage()
})
it('opens the period dimension modal', () => {
Copy link
Collaborator

@jenniferarnesen jenniferarnesen May 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cypress testing best practices would suggest that the whole describe should be in a single test:
https://docs.cypress.io/app/core-concepts/best-practices#Having-Tests-Rely-On-The-State-Of-Previous-Tests
https://docs.cypress.io/app/core-concepts/best-practices#Creating-Tiny-Tests-With-A-Single-Assertion

You can leave the old titles as comments if you feel that is informative

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
e2e dev Run e2e against analytics-dev
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants