Repository navigation
Description
Add the Network configuration page to the mica-ui app, reachable from the Settings page (Content section): the edition of the network form with QJsonFormBuilder (from @obiba/quasar-ui-json-form/builder) and the permissions configuration. Reference: the Angular admin page #/admin/network-config (form and permissions tabs; the taxonomy/search tab is out of scope).
Findings
- The server stores the form as an angular-schema-form pair:
EntityConfigService.validateDefinitionrequires a JSON array andfindComplete()concatenatesdefinition-mandatory.jsonwith the custom definition. The builder emits a JSON Formsuischema(object) and there is no reverse converter, so a small server change is needed. - Form texts are
t(key)tokens resolved server-side (/form?locale=) from the global bundle (/config/i18n/{locale}.json= default + custom); the translator walks any JSON so it is dialect-agnostic. The public pages read the schema titles the same way, sot()wrapping must be preserved on save. - The builder makes every text a translation key (
website.title,group.1.label...) with its owntranslationsmap. Mica's bundle is nested JSON and already holds flat keys such as"website": "Website": a generatedwebsite.titlewould turnwebsiteinto an object and breakt(website)everywhere, so the new keys must be namespaced. CustomTranslationsResource.save(merge=true)discards the merged node (bug);/config/i18n/custom/import?merge=trueworks and covers every locale in one call.AclPanel.vue/useAclalready manage permissions + accesses (with file and open-access handling); only the help texts are document-specific.
Decisions
- Server-side merge of the mandatory part with a hand-written JSON Forms
uischema-mandatory.jsonbesidedefinition-mandatory.json(network only for now, other types when their pages are ported). Builder-generated keys are namespaced by mica-ui on save (Revised: the texts of the form are stored with it (network-form.<key>), keys loaded from the bundle are kept as they are.translationsfield ofEntityFormDto/EntityConfig, by locale) and resolved before the Mica bundle; the Mica translations are not read nor written by the builder page. A token of a key the form does not translate (legacy form) is kept as a literal and still resolved by the server. ThekeyPrefixfollow-up (Form builder: keyPrefix option for the generated translation keys quasar-json-form#52) is no longer needed for Mica.
Plan
Server (mica-core)
-
EntityConfigService:validateDefinitionaccepts an object (JSON Forms UI schema) as well as an array -
EntityConfigService: when the custom definition is an object, the merged definition isVerticalLayout { elements: [ ...mandatory uischema elements, custom ] };getMandatoryUischemaResourcePath()defaults touischema-mandatory.jsonbeside the mandatory definition (empty layout when missing) -
config/network-form/uischema-mandatory.json(Label +_name,_acronym,_description) -
EntityConfigServiceTest: uischema merge cases; migrated to JUnit 5 (it was JUnit 4 and never ran)
Once the network form is saved from mica-ui, the legacy Angular network edit page can no longer render it (mica-ui has its own).
mica-ui: forms of either dialect
-
stores/forms.ts: the definition is an array or an object -
useEntityForm:convertAsf→toJsonForms(dialect detected by shape)
mica-ui: form configuration composable
useEntityConfigForm(target):
- load:
GET /config/{target}/form-custom→toJsonFormskeeping thet()tokens, strings that are exactlyt(key)unwrapped tokey(mixed HTML help blocks are left as they are, the server still resolves them at render time); the translations of the keys the form uses come fromGET /config/i18n/{lang}.jsonper configured language - save: from the builder model, every slot holding a known key becomes
t(key), the keys not loaded from the bundle being prefixed withnetwork-form.; the new or changed translations of the used keys go toPUT /config/i18n/custom/import?merge=true, thenPUT /config/{target}/form-customwith the JSON Forms pair;formsStore.clear() - vitest coverage of unwrap / wrap / prefix / translations diff
mica-ui: page and components
- route
settings/network→SettingsNetworkPage.vue, Settings page Content item (shown whenisNetworkEnabled) - Form tab:
EntityFormBuilder.vuewithQJsonFormBuilder(languagesfrom the configuration), save / cancel, unsaved changes guard on route leave - Permissions tab:
AclPanelon/config/network/permissionsand/config/network/accesses, with file, admin only; new optionalpermissionHelp/accessHelpprops for the global wording - i18n en / fr
Verified headlessly against the local Mica: a field added in the builder is saved as a JSON Forms pair (t(network-form.text.title), custom translation network-form.text.title), /form?locale=en merges the mandatory layout and resolves the titles, and the network edit page renders the mandatory fields plus the custom ones.
Activity
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)
mica-ui: network configuration page (#4610) (#4611)