From ddca4cc488590ba95d6821a9aef57e349ceadcf4 Mon Sep 17 00:00:00 2001 From: StanZGenchev Date: Fri, 11 Sep 2026 16:34:41 +0300 Subject: [PATCH 1/2] Fixed #7352 and refactored Harmonia use Signed-off-by: StanZGenchev --- .claude/docs/harmonia-ui.md | 78 +-- .claude/docs/shells.md | 2 +- DATABASE_SHELL_PLAN.md | 10 +- HARMONIA_2_MIGRATION.md | 193 ------- HARMONIA_RUNTIME_PLAN.md | 33 +- .../intent/parser/IntentParser.java | 24 + .../intent/parser/WidgetSizeIntentTest.java | 94 ++++ .../application-core/i18n/bg-BG/shell.json | 8 +- .../application-core/i18n/en-US/shell.json | 10 +- .../application-core/shell/css/app.css | 21 +- .../shell/js/components/layout/appShell.js | 3 + .../shell/js/stores/notifications.js | 28 +- .../application-core/shell/js/stores/theme.js | 45 +- .../shell/views/_documents.html | 50 +- .../application-core/shell/views/_inbox.html | 24 +- .../META-INF/dirigible/admin/index.html | 114 +++-- .../META-INF/dirigible/admin/js/appShell.js | 3 + .../dirigible/admin/views/_settings.html | 55 +- .../META-INF/dirigible/application/index.html | 136 ++--- .../dirigible/application/js/appShell.js | 3 + .../application/views/_dashboard.html | 45 +- .../application/views/_settings.html | 79 +-- .../META-INF/dirigible/builder/css/app.css | 38 +- .../META-INF/dirigible/builder/index.html | 84 ++-- .../META-INF/dirigible/builder/js/appShell.js | 3 + .../META-INF/dirigible/database/index.html | 64 +-- .../dirigible/database/views/_explorer.html | 4 +- .../dirigible/database/views/_sql.html | 9 +- .../META-INF/dirigible/home/index.html | 38 +- .../META-INF/dirigible/home/js/home.js | 38 +- .../META-INF/dirigible/monitoring/index.html | 82 +-- .../dirigible/monitoring/views/_jobs.html | 31 +- .../dirigible/monitoring/views/_logs.html | 30 +- .../monitoring/views/_messaging.html | 13 +- .../dirigible/monitoring/views/_overview.html | 155 +++--- .../monitoring/views/_processes.html | 114 +++-- .../dirigible/monitoring/views/_system.html | 156 +++--- .../META-INF/dirigible/partner/index.html | 114 +++-- .../META-INF/dirigible/partner/js/appShell.js | 3 + .../dirigible/partner/views/_settings.html | 55 +- .../META-INF/dirigible/personal/index.html | 124 ++--- .../dirigible/personal/js/appShell.js | 3 + .../dirigible/personal/views/_settings.html | 55 +- .../resources/static/tenant-selection.html | 78 ++- .../README.md | 7 +- .../reference/alpinejs/SKILL.md | 2 + .../ui/admin/admin-index.html.template | 51 +- .../ui/my/my-calendar-view.html.template | 6 +- .../ui/my/my-document-view.html.template | 94 ++-- .../ui/my/my-form-view.html.template | 24 +- .../ui/my/my-list-view.html.template | 10 +- .../partner-document-view.html.template | 30 +- .../partner/partner-form-view.html.template | 22 +- .../partner/partner-list-view.html.template | 8 +- .../calendar/calendar-view.html.template | 6 +- .../document/document-view.html.template | 160 +++--- .../ui/perspective/list/page.js.template | 14 + .../ui/perspective/list/view.html.template | 50 +- .../manage/form-view.html.template | 68 +-- .../perspective/manage/list-page.js.template | 13 + .../manage/list-view.html.template | 81 +-- .../master/master-page.js.template | 13 + .../master/master-view.html.template | 78 +-- .../report-file/index.html.template | 63 ++- .../report-file/report.js.template | 22 +- .../report/chart-view.html.template | 4 +- .../report/table-view.html.template | 6 +- .../slots/slots-view.html.template | 6 +- .../ui/shell/dashboard.html.template | 49 +- .../ui/shell/index.html.template | 138 ++--- .../ui/shell/settings.html.template | 17 +- .../ui/translations.json.template | 2 +- .../ui/index.html.template | 41 +- .../template-html/index.html.template | 11 +- npm/test/src/form.js | 2 +- pom.xml | 10 +- .../tests/api/HarmoniaContractIT.java | 476 ++++++++++++++++++ .../tests/api/IntentEmissionCoverageIT.java | 10 +- .../tests/ui/tests/MonitoringShellIT.java | 119 ++++- 79 files changed, 2504 insertions(+), 1558 deletions(-) delete mode 100644 HARMONIA_2_MIGRATION.md create mode 100644 components/engine/engine-intent/src/test/java/org/eclipse/dirigible/components/intent/parser/WidgetSizeIntentTest.java create mode 100644 tests/tests-integrations/src/main/java/org/eclipse/dirigible/integration/tests/api/HarmoniaContractIT.java diff --git a/.claude/docs/harmonia-ui.md b/.claude/docs/harmonia-ui.md index 14f920ff10d..944a019a225 100644 --- a/.claude/docs/harmonia-ui.md +++ b/.claude/docs/harmonia-ui.md @@ -1,38 +1,46 @@ ## Harmonia runtime UI (`template-application-ui-harmonia-java` + `template-form-builder-harmonia`) -The runtime UI stack for generated applications: they render as a self-contained **Alpine.js + Harmonia SPA** (client-routed by Pinecone in hash mode, no iframes/`postMessage` hubs), served at `/services/web//gen//index.html`, talking to the **reused** generated Java REST controllers over a `fetch` client. The AngularJS IDE is untouched; the application layer now ships this stack only. `template-application-ui-harmonia-java` (registered on `platform-templates` as "Application - UI (Harmonia) - Java") emits the view types (list, manage, setting, master-detail, reports) + built-in **Process Inbox** (`/inbox`) and **Documents** (`/documents`) shell sections + inline process-task surfacing; `template-form-builder-harmonia` ("Harmonia Generator from Form Model", extension `form`) is the runtime form generator. The whole stack — Alpine 3.15.11, Harmonia 2.6.0, Lucide 1.8.0 — is embedded as **webjars** via `components/resources/application-core` (report charts use Harmonia's own native `x-h-chart-*` SVG charts; the `chart.js` webjar was dropped with the AngularJS dashboard shell) (incl. Pinecone Router — `org.webjars.npm:pinecone-router`, served version-less at `/webjars/pinecone-router/dist/router.min.js`; it was vendored until the 7.5.2 webjar existed). Developed on PR [#6078](https://github.com/eclipse-dirigible/dirigible/pull/6078). - -**Component reference:** the full codbex-harmonia directive catalog (all `x-h-*` components incl. the `x-h-select` combobox contract, theming, layout) lives **upstream** — the docs site and the agent-readable skill (formerly mirrored in-repo under `reference/harmonia/`; that copy was removed to avoid drift — always consult the upstream, version-matched to `harmonia.version` in the root `pom.xml`). [`.../reference/alpinejs/`](components/template/template-application-ui-harmonia-java/reference/alpinejs/) still covers the Alpine patterns (routing, page components), mirrored from `codbex-athena-app`, the reference app this stack was adopted from. Read them before changing Harmonia markup. - -**Detailed guides:** [`components/template/template-application-ui-harmonia-java/README.md`](components/template/template-application-ui-harmonia-java/README.md) (the SPA shell, view-type parity checklist, the master-detail detail registry, process-tasks store) and [`components/template/template-form-builder-harmonia/README.md`](components/template/template-form-builder-harmonia/README.md) (the neutral `formController(ctx)` contract). The repo-root [`HARMONIA_RUNTIME_PLAN.md`](HARMONIA_RUNTIME_PLAN.md) is the design doc + implementation status. **Gotchas that already burned someone — read before changing the templates:** - -- **REST path must use the Java-sanitised names.** `restBase` is `/services/java//gen/${javaGenFolderName}/api` and each page's `apiPath` is the **relative** `/${javaPerspectiveName}/Controller`; the fetch client prepends `restBase` exactly once. Use `javaGenFolderName`/`javaPerspectiveName` (e.g. `sales-order` → `sales_order`), **not** the raw `genFolderName`/lowercased perspective — the generated backend lives under the sanitised Java package. (Phase 0/1 only passed because `edm` needs no sanitising.) -- **`{ baseUrl: '' }` means "URL is absolute, prepend nothing".** The fetch client checks `opts.baseUrl !== undefined`, not truthiness — passing `''` with a relative path (or omitting it with an absolute path) is the classic doubled-URL bug (`/api/services/java/.../api/...`). Entity pages use a relative `apiPath` and **no** override; absolute URLs (relationship dropdowns, the detail registry) pass `{ baseUrl: '' }`. -- **Date/time widgets need conversion both ways.** The form `toPayload()` turns an HTML `date`/`datetime-local` value into a full ISO instant (`…Z`) so a Jackson `java.time.Instant`/`Timestamp` field binds (empty→`null`, a bare `TIME` passes through); `toDateInput()` slices the backend's ISO value back to what the widget expects on edit. Mirrors the AngularJS stack's `new Date(value)`. -- **Master-detail is registry-driven.** A master page renders one `detailPanel` per `App.detailsFor()` entry; each detail self-registers via `App.registerDetail(...)` (relative `apiPath`), so masters never enumerate details at generation time. The detail list filters via the controller's `?=` query (built into the reused rest-java controller for `*_DETAILS` layouts). -- **The `.form` runs the existing AngularJS `code` via compat shims, and the page is self-contained.** `template-form-builder-harmonia` runs the `.form` `code` as the body of `formController(ctx)` (`ctx.{model, params, http, task, notify, close}`) and defines `$scope`/`$http`/`NotificationHub`/`DialogHub` shims so intent-generated AngularJS `.form` code runs **unchanged** (no migration needed). The page loads only `form.js` + its own minimal fetch client (no `window.App`), because a BPM task form opens standalone in an iframe where the SPA shell assets are absent — an earlier `../../js/...` reference 404'd and left `App` undefined. -- **A standalone page must bootstrap `App.config.projectName` before loading `i18n.js`, or every module-authored label silently stays English.** `i18n.js` reads the project namespace off `App.config.projectName` — which only the SPA shell sets — and without it fetches just the platform `application-core` chrome catalog, so the page's own `.t.*` keys never resolve. The failure is invisible: the baked English literals render, no console error, and every shell page around the iframe IS translated. Both standalone pages (the report page and, since [#6692](https://github.com/eclipse-dirigible/dirigible/issues/6692), the task form) therefore set it in a one-line inline script before the ` @@ -69,7 +63,7 @@ - +
    @@ -77,10 +71,10 @@
  • - + - - + +
@@ -89,7 +83,7 @@