Skip to content

Full report/panorama rendering in link previews - #582

Merged
Rello merged 6 commits into
Rello:masterfrom
LexioJ:feat/reference-provider-full-view
Sep 17, 2026
Merged

Rello merged 6 commits into
Rello:masterfrom
LexioJ:feat/reference-provider-full-view

Conversation

@LexioJ

@LexioJ LexioJ commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

As announced in #581, this makes Analytics links actually useful when pasted into Text, Talk or Tables: instead of the static card with just icon and title, the link preview now renders the real content.

Tables

grafik

Text

grafik

Talk

grafik

Reports show up as their actual chart / data table / KPI (whatever is configured in the report options), loaded live from the existing data endpoints. Panoramas render their first page as a widget grid with a link to the remaining pages. If loading fails for whatever reason (report deleted, no permission anymore, scripts blocked), it just falls back to the old static card, so nothing breaks.

I made sure the chart bundle is only lazy-loaded when a page actually contains an analytics reference — pages without such links don't pay for this.

While working on this I ran into two bugs that this PR also fixes:

  • reports/panoramas shared with me resolved as "Report not found" in previews, because resolveReference() only checked own reports. It now falls back to ShareService (same for PanoramaService::read(), limited to the fields the panorama view needs)
  • the admin setting link_preview_enabled was ignored, that works again

Added PHPUnit tests for the reference provider and the share fallbacks, plus a few OCP stubs that were needed to test the reference interfaces.

Happy to adjust if you'd prefer a different approach for anything here.

LexioJ added 2 commits August 12, 2026 16:53
The reference provider (Smart Picker / link preview) previously showed a
static card with icon, title and subtitle. Analytics links pasted into
rich text (Text documents, Talk, Tables descriptions) now render the
actual content:

- Reports render as full chart, data table, KPI or combined view using
  the stored report options, fetched live from the existing data
  endpoints with ETag/localStorage caching.
- Panoramas render their first page as a grid with all report, text and
  picture widgets, plus a link to the remaining pages.
- The chart stack is lazy-loaded on the first rendered analytics
  reference, so pages without analytics links load no extra scripts.
- Failed loads (deleted report, revoked permission, blocked scripts)
  fall back to the previous static card.

Fixes along the way:
- resolveReference() now falls back to ShareService, so reports and
  panoramas shared with the current user no longer resolve as
  "Report not found". PanoramaService::read() gained the same fallback,
  restricted to the fields the panorama view needs.
- The admin toggle link_preview_enabled is functional again.

Signed-off-by: Alexander Askin <lexioj@gmail.com>
@Rello

Rello commented Aug 13, 2026

Copy link
Copy Markdown
Owner

nice one! thanks!

I always had this on my todo list.
to reduce the (js) overhead I thought about a downsized server-side-chart-rendering so only simple svgs could be shown everywhere.
i will check your suggestion.

thank you again

@Rello Rello added this to the 7.0.0 milestone Sep 14, 2026
Bring PR Rello#582 onto current master and adapt its isolated renderer to DataTables 3 and flexible dataset helpers.

Signed-off-by: Rello <github@scherello.de>

Assisted-by: Codex:GPT-5
@Rello

Rello commented Sep 15, 2026

Copy link
Copy Markdown
Owner

I am adjusting this PR because the app changed. e.g. the new datatables does not require jquery anymore

@Rello

Rello commented Sep 16, 2026

Copy link
Copy Markdown
Owner

testing in progress....

Signed-off-by: Rello <github@scherello.de>
Assisted-by: Codex:GPT-5
@Rello

Rello commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Preview asset footprint for the current PR head (b6c6f047), measured from the checked-in JavaScript and CSS files for a cold preview. Gzip-equivalent is the sum of the files compressed individually; actual HTTP transfer depends on server compression and browser cache. The totals include the reference registration script and CSS, but exclude Nextcloud's own page assets, reference lookup, icons, report JSON, and HTTP overhead.

Preview Uncompressed assets Gzip-equivalent
Registration only (no Analytics link rendered) 36.6 KB 7.7 KB
KPI 252.8 KB 59.8 KB
Table 418.4 KB 109.4 KB
Chart 527.3 KB 156.5 KB
Chart + table 692.8 KB 206.1 KB

As an example of the variable data cost, local NC34 report #4 returned 36 rows in 2,158 bytes of JSON (738 bytes gzip-equivalent). Table pagination displays ten rows per page but still fetches the full report. Asset files are shared across previews on the same page; cacheable report responses can use ETags on later loads.

Assisted-by: Codex:GPT-5

@Rello

Rello commented Sep 16, 2026

Copy link
Copy Markdown
Owner

Rello and others added 2 commits September 16, 2026 23:04
Preserve explicit chart and table selections, retain combined content mode, and keep the original picker with scoped heading and keyboard fixes. Add regression coverage and update the changelog.

Signed-off-by: Rello <github@scherello.de>
Assisted-by: Codex:GPT-5
@Rello
Rello merged commit 52d65c2 into Rello:master Sep 17, 2026
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.

2 participants