Skip to content

feat(plugins-portlet): migrate OSGi Plugins portlet from Dojo to Angular #34732#34957

Open
hmoreras wants to merge 34 commits intomainfrom
issue-34732-plugins-portlet
Open

feat(plugins-portlet): migrate OSGi Plugins portlet from Dojo to Angular #34732#34957
hmoreras wants to merge 34 commits intomainfrom
issue-34732-plugins-portlet

Conversation

@hmoreras
Copy link
Copy Markdown
Member

@hmoreras hmoreras commented Mar 11, 2026

Proposed Changes

Migrates the legacy Dojo/JSP-based OSGi Plugins portlet (dynamic-plugins) to a fully Angular implementation.

Frontend — new libs/portlets/dot-plugins library

  • DotOsgiService (libs/data-access) — typed HTTP client for all /api/v1/osgi endpoints: list, upload, deploy/undeploy, start/stop, process exports, extra packages, restart
  • DotPluginsListStore — NgRx signals store managing bundle list state with loading / refreshing / loaded / error / restarting transitions; subscribes to OSGI_FRAMEWORK_RESTART and OSGI_BUNDLES_LOADED WebSocket events for cluster-wide real-time sync
  • DotPluginsListComponent — data table combining installed bundles + undeployed JARs; drag-and-drop JAR upload (with nested dragenter counter); context menu per row (start/stop/undeploy/process-exports/add-to-bundle); toolbar with search, refresh, extra packages, and OSGi restart
  • DotPluginsUploadComponent — dialog with PrimeNG FileUpload dropzone for uploading one or more JAR files
  • DotPluginsExtraPackagesComponent — dialog to edit or reset the OSGi exported packages list
  • Route registered at plugins path in app.routes.ts with MenuGuardService

Backend

  • Renamed portlet dynamic-pluginsplugins-legacy in portlet.xml; new Angular portlet plugins registered alongside it
  • PortletID.PLUGINS and PortletID.PLUGINS_LEGACY added to the enum
  • Task260320AddPluginsPortletToMenurunonce upgrade task that replaces plugins-legacy (formerly dynamic-plugins) in all layouts with the new Angular plugins portlet; plugins-legacy is removed from the sidebar but remains registered in portlet.xml and can be re-added manually if needed; clears layout cache
  • 58 i18n keys added to Language.properties

Checklist

  • Tests — unit tests for store, all three components, and DotOsgiService
  • Translations — English keys added; translations for other locales pending
  • Security Implications Contemplated — OSGi restart and undeploy are privileged, cluster-wide operations; the portlet is protected by MenuGuardService. No new REST endpoints introduced; existing /api/v1/osgi endpoints are used.

Additional Info

  • The legacy portlet (plugins-legacy) is removed from all layouts so it no longer appears in the sidebar; it remains registered in portlet.xml and can be added back manually if needed.
  • The OSGI_BUNDLES_LOADED WebSocket event is debounced 5 s to avoid rapid-fire reloads during bundle resolution after a restart.
  • Undeployed JARs (files present in the deploy folder but not yet installed) are surfaced as a distinct row type (state: 'undeployed') with a single Deploy action.

Screenshots

This PR fixes: #34732

@github-actions github-actions bot added the Area : Frontend PR changes Angular/TypeScript frontend code label Mar 11, 2026
@github-actions github-actions bot added the Area : Backend PR changes Java/Maven backend code label Mar 12, 2026
@hmoreras hmoreras changed the title modernization ( Plugins Portlet ) : #34732 Migration Dojo to Angular feat(plugins-portlet): migrate OSGi Plugins portlet from Dojo to Angular #34732 Mar 20, 2026
@hmoreras hmoreras marked this pull request as ready for review March 20, 2026 22:38
@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 24, 2026

Pull Request Unsafe to Rollback!!!

  • Category: H-1 — One-Way Data Migration or Destructive Backfill
  • Risk Level: 🟠 HIGH
  • Why it's unsafe: Both upgrade tasks permanently DELETE rows from cms_layouts_portlets and INSERT new portlet entries. After rollback to N-1, the deleted legacy portlet entries (dynamic-plugins, plugins-legacy, tags-legacy) cannot be automatically restored. N-1 has no plugins portlet registered in portlet.xml, so any layout row referencing plugins becomes a dangling reference. Users who had the plugins portlet in their menu before the upgrade will find it missing or broken after rollback.
  • Code that makes it unsafe:
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260320AddPluginsPortletToMenu.java lines 63–70 — DELETE of plugins-legacy / dynamic-plugins from all layouts
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260320AddPluginsPortletToMenu.java lines 73–84 — INSERT of new plugins portlet entry
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260321AddTagsPortletToMenu.java lines 98–107 — DELETE of tags-legacy from all layouts
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260321AddTagsPortletToMenu.java lines 115–131 — INSERT of new tags portlet entry
  • Alternative (if possible): Store the deleted rows in a backup table before deletion (e.g., cms_layouts_portlets_backup_260320) so a rollback script can restore them. Alternatively, use a soft-delete by marking them inactive rather than physically removing them, letting N-1 filter on an active flag it already supports — or document a manual rollback procedure in the task's Javadoc.

@hmoreras
Copy link
Copy Markdown
Member Author

After run a test, for upgrade and then rollback locally, there is not risk with the upgrade task related to left menu updates related to this PR

@claude
Copy link
Copy Markdown
Contributor

claude bot commented Mar 25, 2026

Pull Request Unsafe to Rollback!!!

  • Category: H-1 — One-Way Data Migration or Destructive Backfill
  • Risk Level: 🟠 HIGH
  • Why it's unsafe: Both upgrade tasks permanently DELETE rows from cms_layouts_portlets and INSERT new portlet entries. After rollback to N-1, the deleted legacy portlet entries (dynamic-plugins, plugins-legacy, tags-legacy) cannot be automatically restored. N-1 has no plugins portlet registered in portlet.xml, so any layout row referencing plugins becomes a dangling reference. Users who had the plugins portlet in their menu before the upgrade will find it missing or broken after rollback.
  • Code that makes it unsafe:
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260320AddPluginsPortletToMenu.java lines 63–70 — DELETE of plugins-legacy / dynamic-plugins from all layouts
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260320AddPluginsPortletToMenu.java lines 73–84 — INSERT of new plugins portlet entry
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260321AddTagsPortletToMenu.java lines 98–107 — DELETE of tags-legacy from all layouts
    • dotCMS/src/main/java/com/dotmarketing/startup/runonce/Task260321AddTagsPortletToMenu.java lines 115–131 — INSERT of new tags portlet entry
  • Alternative (if possible): Store the deleted rows in a backup table before deletion (e.g., cms_layouts_portlets_backup_260320) so a rollback script can restore them. Alternatively, use a soft-delete by marking them inactive rather than physically removing them, letting N-1 filter on an active flag it already supports — or document a manual rollback procedure in the task's Javadoc.

hmoreras and others added 4 commits March 26, 2026 14:51
…ndeployed toggle

- Uploading wall now appears immediately when JARs are dropped or selected via
  dialog and stays visible until the OSGI_BUNDLES_LOADED websocket event triggers
  the data reload; the wall is never dismissed early by the HTTP 200 response alone
- Upload HTTP logic moved from the upload dialog into the store so both drag-and-drop
  and dialog paths share a single uploading state transition
- Added "Show undeployed" toggle (off by default) to hide undeployed JARs from the table
- Added find/search bar to the Extra Packages dialog: debounced scroll-to-match via
  RxJS Subject + debounceTime, prev/next navigation, match count indicator, and
  mirror-div technique for pixel-accurate textarea scrolling
- Upload icon in the uploading wall no longer spins
- Store tests updated to reflect the new upload flow (no loadAll from uploadBundles;
  reload is owned by OSGI_BUNDLES_LOADED websocket event)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Task260320 (plugins): previously renamed dynamic-plugins to plugins-legacy
and deleted it from cms_layouts_portlets, breaking rollback — the old version's
portlet.xml registers dynamic-plugins, so removing that DB row meant the JSP
portlet would disappear from the menu after a downgrade. Fix: skip the rename
and keep the dynamic-plugins row untouched; only insert the new Angular plugins
entry alongside it. forceRun() simplified to only check whether plugins is absent.
Tests updated to assert dynamic-plugins is preserved and cover the coexistence
steady state.

Task260321 (tags): removed entirely. The old released DB already has portlet_id
= 'tags' in cms_layouts_portlets, and the new portlet.xml reuses that same ID
for the Angular portlet, so forceRun() returns false on every real upgrade — the
task never ran in production. tags-new and tags-legacy were dev-only artifacts of
this branch. tags-legacy portlet registration kept in portlet.xml and PortletID
so admins can manually restore the JSP portlet if needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@fmontes fmontes linked an issue Mar 30, 2026 that may be closed by this pull request
15 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI: Safe To Rollback Area : Backend PR changes Java/Maven backend code Area : Frontend PR changes Angular/TypeScript frontend code Human: Safe To Rollback

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Dojo to Angular: Plugins Portlet Add startup tasks to put Tags and Plugins (Angular) portlets in menu

6 participants