Skip to content

feat(ui): mount skychat/logs in WinBox via a CDK-portal bridge (no self-iframe) - #3720

Merged
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/ui-winbox-ng-portal
Aug 5, 2026
Merged

feat(ui): mount skychat/logs in WinBox via a CDK-portal bridge (no self-iframe)#3720
0pcom merged 1 commit into
skycoin:developfrom
0pcom:feat/ui-winbox-ng-portal

Conversation

@0pcom

@0pcom 0pcom commented Aug 5, 2026

Copy link
Copy Markdown
Collaborator

What

Steps 3 + 5 of the GUI embedding standardization (docs/design/gui-embedding-standardization.md): the wasm desktop's ☰ Chat and ☰ Logs WinBox windows iframed the SPA back into itself (/#/nodes/<pk>/chat?embed=1, .../logs?embed=1) — loading a second Angular runtime just to show one component. This replaces that with an in-context mount of the real Angular component.

Completes the standardization series (#3715 SharedModule, #3716 bundle-mount host, #3717 VPN lazy).

How the route-coupling was solved

The doc flagged this as the hard part: SkychatComponent/LogsComponent get their visor from NodeComponent.currentNode (a static observable set by the parent NodeComponent route), which a bare portal mount wouldn't have. The key finding: both components only read node.localPk, and neither injects ActivatedRoute/Router/NodeComponent. So decoupling is clean.

  • New NgBridgeService exposes window.SkywireNg.mountComponent(el, name, opts): creates the component via a CDK DomPortalOutlet in the app's root injector (same services/theme/session), sets its inputs before first CD, returns a dispose() handle. AppComponent installs it at startup. Registry: skychat, logs.
  • SkychatComponent / LogsComponent gain an optional embeddedNodeKey input (+ embeddedPeer for chat). When set (portal mount), they synthesize the node from the key instead of subscribing to NodeComponent.currentNode. Routed behaviour is 100% unchanged (input unset → old path).
  • browse.js chat/logs windows prefer window.SkywireNg.mountComponent and fall back to the ?embed=1 iframe if the bridge is absent (keeps browse.js robust in any host). Peer retarget re-mounts skychat; the window disposes the component on close.

Net: one Angular runtime, shared context, no self-iframe — while keeping the single 1500-line Angular skychat component (no dual-surface divergence).

Verification (live, over CDP on a persistent Brave tab)

Against a fresh hv serve --tls --harness:

  • ng lint / ng build / go build . — clean.
  • Bridge: window.SkywireNg.mountComponent(div, 'skychat', {nodeKey}) rendered the real app-skychat (full chat UI, 10.6 KB DOM) in the app's context — 0 console errors.
  • Desktop: clicking ☰ Logs opened the "visor log" WinBox now hosting app-logs with no iframe (hostsAppLogs: true, hostsIframe: false) — 0 console errors.

…lf-iframe)

Steps 3 + 5 of the GUI embedding standardization
(docs/design/gui-embedding-standardization.md): the wasm desktop's ☰ Chat and
☰ Logs WinBox windows iframed the SPA back into itself
(/#/nodes/<pk>/chat?embed=1, .../logs?embed=1), loading a SECOND Angular runtime
just to show one component. Replace that with an in-context mount of the real
Angular component.

- New NgBridgeService exposes window.SkywireNg.mountComponent(el, name, opts):
  it creates the component via a CDK DomPortalOutlet in the app's root injector
  (same services/theme/session), sets its inputs, and returns a dispose handle.
  AppComponent installs it at startup. Registry: skychat, logs.
- SkychatComponent / LogsComponent gain an optional embeddedNodeKey input (+
  embeddedPeer for chat). When set (portal mount, no NodeComponent parent route),
  they synthesize the node from the key — both only read node.localPk — instead
  of subscribing to NodeComponent.currentNode. Routed behaviour is unchanged.
- browse.js chat/logs windows now prefer window.SkywireNg.mountComponent and
  fall back to the ?embed=1 iframe if the bridge is absent (non-Angular host).
  Peer retarget re-mounts skychat; the window disposes the component on close.

One Angular runtime, shared context, no self-iframe. Validated live on a fresh
hv serve --harness: the bridge mounts the real app-skychat, and clicking ☰ Logs
opens a WinBox hosting app-logs (no iframe), 0 console errors.

Rebuilt the embedded UI bundle.
@0pcom
0pcom merged commit 74f99c7 into skycoin:develop Aug 5, 2026
12 checks passed
0pcom added a commit that referenced this pull request Aug 5, 2026
…eb stays iframed (#3721)

The skychat/logs ?embed=1 WinBox windows now mount the real Angular component via
the window.SkywireNg CDK-portal bridge (#3720) — the earlier "deferred" finding
was resolved once it was clear both components only read node.localPk and inject
no routing deps. Also record the decision that skycoin-web stays iframed (separate
upstream-owned app + wallet custody boundary), superseding the old migration-list
line about converging it into the SPA.
@0pcom
0pcom deleted the feat/ui-winbox-ng-portal branch August 14, 2026 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant