Skip to content
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

feat: serve global app shell at /apps/ [DHIS2-17021] #16703

Merged
merged 16 commits into from
Mar 21, 2024

Conversation

amcgee
Copy link
Member

@amcgee amcgee commented Mar 5, 2024

If an app with the name global-app-shell is installed this filter will take effect.

  1. Serve the global app shell app at /apps/ (including top-level subpaths such as /apps/dashboard)
  2. Redirect from existing app paths (i.e. /dhis-web-dashboard/index.html) to the global app shell path for the same app (/apps/dashboard)
  3. For convenience, redirect from /apps/dashboard/ to /apps/dashboard
  4. Inject DHIS2 base url into index.html files for installed apps, replacing __DHIS_BASE_URL__ (ideally included in index.html as <meta name="dhis-base-url" content="__DHIS2_BASE_URL__" />). This is particularly helpful for the global app shell itself, but can also be leveraged by any other app
  5. Skip the redirect (number 2 above) if the querystring contains ?redirect=false

A few things still to iron out...

  • This is opt-in, by default nothing changes and no global app shell is bundled. Should we consider making this the default? It would significantly increase the consistency benefits
  • Bundled apps can't take advantage of the __DHIS2_BASE_URL__ runtime replacement (this might be OK for now...)
  • We should perhaps redirect from /apps/dashboard back to /dhis-web-dashboard if the app shell has been uninstalled
  • Appending a filename from a particular application (i.e. webapp.manifest or plugin.html) manually to the global app shell public URL will no longer work. For example /apps/dashbaord/webapp.manifest or /apps/dashboard/package.json will return a 404. This could be confusing and obnoxious, but mostly for developers and expert users... perhaps these paths should redirect back to their source counterparts...?

@amcgee amcgee marked this pull request as draft March 5, 2024 11:49
@amcgee amcgee requested a review from KaiVandivier March 5, 2024 11:49
@amcgee amcgee added the deploy Deploy DHIS2 instance with IM. label Mar 5, 2024
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

Attention: Patch coverage is 9.09091% with 60 lines in your changes are missing coverage. Please review.

Project coverage is 67.14%. Comparing base (945eb12) to head (6a57f26).

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #16703      +/-   ##
============================================
- Coverage     67.16%   67.14%   -0.03%     
- Complexity    32181    32183       +2     
============================================
  Files          3556     3557       +1     
  Lines        131870   131931      +61     
  Branches      15316    15325       +9     
============================================
+ Hits          88574    88582       +8     
- Misses        36099    36153      +54     
+ Partials       7197     7196       -1     
Flag Coverage Δ
integration 50.17% <9.09%> (-0.02%) ⬇️
integration-h2 33.86% <9.09%> (-0.02%) ⬇️
unit 30.40% <1.51%> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
...rc/main/java/org/hisp/dhis/setting/SettingKey.java 87.37% <100.00%> (+0.06%) ⬆️
...is/webapi/servlet/DhisWebApiWebAppInitializer.java 0.00% <0.00%> (ø)
...org/hisp/dhis/webapi/controller/AppController.java 11.40% <0.00%> (-1.47%) ⬇️
...org/hisp/dhis/webapi/filter/GlobalShellFilter.java 11.36% <11.36%> (ø)

... and 1 file with indirect coverage changes


Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 945eb12...6a57f26. Read the comment docs.

@amcgee amcgee changed the title feat: serve global app shell at /apps/ [DHIS2-15635] feat: serve global app shell at /apps/ [DHIS2-17021] Mar 7, 2024
@amcgee amcgee added deploy Deploy DHIS2 instance with IM. and removed deploy Deploy DHIS2 instance with IM. labels Mar 12, 2024
@amcgee amcgee marked this pull request as ready for review March 12, 2024 08:19
Copy link
Contributor

@jbee jbee left a comment

Choose a reason for hiding this comment

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

Path replacement was discussed in today's meeting - it would be good to have a high level explanation somewhere, maybe in form of javadoc.

@amcgee amcgee enabled auto-merge (squash) March 21, 2024 07:30
@amcgee amcgee disabled auto-merge March 21, 2024 07:42
@amcgee amcgee enabled auto-merge (squash) March 21, 2024 07:43
Copy link

sonarcloud bot commented Mar 21, 2024

@amcgee amcgee merged commit 1c00620 into master Mar 21, 2024
13 of 14 checks passed
@amcgee amcgee deleted the DHIS2-15635-global-app-shell branch March 21, 2024 07:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy Deploy DHIS2 instance with IM.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants