feat(#793): add delete-ui-extensions action#817
Conversation
|
@jkuester finnally pushed this, pls take a look at this when you get a moment!! |
|
ahh! E2E tests passed on re-run! |
jkuester
left a comment
There was a problem hiding this comment.
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 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 😅 |
|
👍 Sure, no worries! They were minor changes and it was easy to just drop them in before merging this. |
Description
added a new
delete-ui-extensionsaction to the CLI to cleanly remove custom UI extensions from the databasethis action connects to the
medicdatabase and removes the specifiedui-extension:${name}documentsif 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) utilizingenvironment.extraArgsif 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-extensiondocument 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.jsattachment 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.jsfor better code management, and comprehensive unit tests have been included to verify both thelibdatabase logic and thefnCLI wrapperMinor Housekeeping: i also resolved a minor SonarQube code smell in
test/lib/attachment-from-file.spec.jswhile i was in the test directory by updating the path import to use the modernnode:pathprefix which was initiallypathFixes #793
Code review items
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.