Skip to content

feat(#793): add delete-ui-extensions action#817

Merged
jkuester merged 7 commits into
medic:10224-ui-extensionsfrom
Vedd-Patel:feat/delete-ui-extensions
May 11, 2026
Merged

feat(#793): add delete-ui-extensions action#817
jkuester merged 7 commits into
medic:10224-ui-extensionsfrom
Vedd-Patel:feat/delete-ui-extensions

Conversation

@Vedd-Patel
Copy link
Copy Markdown

Description

added a new delete-ui-extensions action to the CLI to cleanly remove custom UI extensions from the database

this action connects to the medic database and removes the specified ui-extension:${name} documents
if run without any arguments, it will automatically query and delete all existing UI extension documents in the database
it also supports targeted deletions (e.g., cht --local delete-ui-extensions my-extension) utilizing environment.extraArgs
if a specific extension is targeted but not found (404), it logs a warning and gracefully skips it

to address the TODO in the issue ticket regarding the service worker: When the ui-extension document is deleted from CouchDB, standard replication will remove the configuration from the user's local device on their next sync, the CHT core app will no longer attempt to render the custom web component, while the actual .js attachment might temporarily live on in the Service Worker's cache, it becomes completely inert/orphaned and the UI instantly reflects the deletion.

the core logic has been extracted into src/lib/delete-ui-extensions.js for better code management, and comprehensive unit tests have been included to verify both the lib database logic and the fn CLI wrapper

Minor Housekeeping: i also resolved a minor SonarQube code smell in test/lib/attachment-from-file.spec.js while i was in the test directory by updating the path import to use the modern node:path prefix which was initially path

Fixes #793

Code review items

  • Readable: Concise, well named, follows the style guide, documented if necessary.
  • Documented: Configuration and user documentation on cht-docs
  • Tested: Unit and/or integration tests where appropriate
  • Backwards compatible: Works with existing data and configuration. Any breaking changes documented in the release notes.

License

The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.

@Vedd-Patel
Copy link
Copy Markdown
Author

Vedd-Patel commented May 6, 2026

@jkuester finnally pushed this, pls take a look at this when you get a moment!!
i've one question, i'm using SonarQube IDE extention to detect the errors before pushing, i tried to update/restart/reset the extention but that's not showing in local but its failing in CI
and also can you pls take a look at failing E2E test

@Vedd-Patel
Copy link
Copy Markdown
Author

ahh! E2E tests passed on re-run!

@jkuester jkuester self-requested a review May 6, 2026 18:03
@jkuester jkuester changed the base branch from main to 10224-ui-extensions May 11, 2026 16:55
Copy link
Copy Markdown
Contributor

@jkuester jkuester left a comment

Choose a reason for hiding this comment

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

Pushed some updates to align this with the existing code we have added already for UI extensions, but otherwise the library logic for deleting the docs was great.

Now this should be good to go!

@jkuester jkuester merged commit 897cdf3 into medic:10224-ui-extensions May 11, 2026
6 checks passed
@Vedd-Patel
Copy link
Copy Markdown
Author

@jkuester i honestly didn’t think of these changes earlier, but if you had given me a hint or pointed me in that direction, i would’ve been happy to make the necessary changes from my side 😅

@jkuester
Copy link
Copy Markdown
Contributor

👍 Sure, no worries! They were minor changes and it was easy to just drop them in before merging this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add cht-conf support for delete-ui-extensions action

2 participants