feat(#792): add upload-ui-extensions action#798
feat(#792): add upload-ui-extensions action#798Vedd-Patel wants to merge 5 commits intomedic:mainfrom
Conversation
|
@dianabarsan @jkuester |
|
Hi @Vedd-Patel, thank you for taking the time to create this feature. And so quickly too! I'm not an official reviewer, just looking through this out of interest (while working on some other CHT conf tasks), so feel free to ignore anything off-base. Mostly trying to understand some of the decisions made here.
|
|
@ChinHairSaintClair here are my thoughts on your points:
{
"type": "app_main_tab",
"title": "Delivery Tracker",
"icon": "icon-mother-child",
"roles": ["chw", "nurse"],
"config": {
"url": "[https://custom-app.example.org](https://custom-app.example.org)"
}
}
(function() {
window.addEventListener('cht-extension-load', (event) => {
if (event.detail.extensionId === 'delivery') {
const container = document.getElementById(event.detail.containerId);
container.innerHTML = `<h2>Delivery Tracker Loaded</h2>`;
}
});
})(); |
|
@Vedd-Patel awesome, glad we're able to chat through the approach 🙂 really appreciate you being open to discussion. Re: In the spirit of extensions having strict requirements and failing early where necessary, perhaps a folder-based structure could help? For example: This structure naturally groups related files and makes filtering by extension name a little easier. It would also support statically named "entry points", and leaves room for additional assets like images/audio/etc., which I vaguely remember discussing in one of the squad calls. Taking this approach now could save us from having to implement two capture modes later. Following this, the From there, it seems feasible to flatten For example, processing could be done like so: A conceptual I haven’t tested this locally yet. Would love your thoughts on whether this approach seems reasonable. |
Description
Fixes #792
Added a new
upload-ui-extensionsaction to the CLI. UI extensions require both a.jsand.properties.jsonfile.This action reads the
ui-extensionsdirectory, validates the.properties.jsonvia Joi (ensuringtypeis eitherapp_main_taborapp_drawer_tab, and checking types fortitle,icon,roles, andconfig), and pushes them to themedicdatabase under theui-extension:${fileName}ID. The.jsfile is stored as an attachment. It also supports targeted uploads (e.g.,cht upload-ui-extensions -- delivery) utilizingenvironment.extraArgs.The core logic has been extracted into
src/lib/upload-ui-extensions.jsfor better code management, and unit tests have been included to verify directory and file parsing behavior.Note: I am currently familiarizing myself with the codebase conventions and commenting styles. Please let me know if there are any suggestions or improvements I can make regarding my code style!
medic/cht-conf #792
Code review items
License
The software is provided under AGPL-3.0. Contributions to this project are accepted under the same license.