fix: hide "Open in app" for plugins without an app entrypoint (DHIS2-21739)#3335
Draft
karolinelien wants to merge 2 commits into
Draft
fix: hide "Open in app" for plugins without an app entrypoint (DHIS2-21739)#3335karolinelien wants to merge 2 commits into
karolinelien wants to merge 2 commits into
Conversation
…21739)
Plugin-only apps have a pluginLaunchUrl but no launchUrl, so there is no
standalone app to open. The dashboard item menu still showed "Open in {app}"
and the reducer built the href as `${launchUrl}${appUrl}`, producing the
literal string "undefinedundefined" and a 404 on click.
Only expose the "Open in" option when the app actually has a launch URL, and
stop concatenating undefined when building the app URL.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
|
🚀 Deployed on https://pr-3335.dashboard.netlify.dhis2.org |
Extract the item-details reducer from AppItem into a pure module so the URL-building logic can be unit-tested directly, and add a regression spec covering plugins without an app entrypoint (no launchUrl no longer yields an "undefinedundefined" href). Also drop the unused item prop passed to ItemContextMenu. AI Assisted Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Implements DHIS2-21739
Description
Plugin-only apps (installed without an app entrypoint in
d2.config.js, e.g. Capture Growth Chart) are served with apluginLaunchUrlbut nolaunchUrl— there is no standalone app to open. Despite this, the dashboard item's ⋯ menu still showed an "Open in {app}" option. Clicking it navigated to a broken relative URL (.../dhis-web-dashboard/undefinedundefined) and 404'd, because the app URL was built by concatenating`${appDetails.launchUrl}${newState.appUrl}`where both parts wereundefined.This PR:
openInAppEnabled = allowVisOpenInApp && !!appUrl). The ⋯ menu is still shown for such plugins when "View fullscreen" is available.undefinedwhen there is nolaunchUrl, soappUrlisundefined(not"undefinedundefined") for entrypoint-less plugins.AI Assisted.
Quality checklist
Add N/A to items that are not applicable.
ToDos
Known issues
Screenshots
supporting text