Full report/panorama rendering in link previews - #582
Open
LexioJ wants to merge 2 commits into
Open
Conversation
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>
Owner
|
nice one! thanks! I always had this on my todo list. thank you again |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
Text
Talk
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:
resolveReference()only checked own reports. It now falls back toShareService(same forPanoramaService::read(), limited to the fields the panorama view needs)link_preview_enabledwas ignored, that works againAdded 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.