Current behavior
When you paste an analytics link (/apps/analytics/r/{id} or /pa/{id}) into a Text document, a Talk message or a Tables description, the smart picker widget just shows a generic card: app icon, "Analytics Report", report name. You have to click through to the app to see anything.
What I'd like to do
Render the real thing directly in the widget. The use case that got me started: I have a Nextcloud table and an analytics report built on that table's data — I want that visualization to show up right in the table's description, live, without leaving Tables.
Rough shape of the change (I have a working branch, PR coming shortly):
- Report links render the full visualization inline — chart, data table or KPI tile, depending on how the report is configured. Data is fetched live from the existing
/data/{id} endpoint, so permissions and the ETag/localStorage caching we already use for the dashboard widget apply as-is.
- Panorama links render the first page as a grid with all its report/text/picture widgets, plus a link to the remaining pages.
- The chart stack (Chart.js, moment, plugins — roughly 600KB) is only lazy-loaded once an analytics reference is actually rendered on a page. Talk/Text pages without analytics links load nothing extra.
- If the data can't be loaded (report deleted, permission revoked, scripts blocked by an adblocker), the widget falls back to the current static card.
Bugs I ran into along the way
Two things worth fixing regardless of the feature:
- Reports/panoramas that are shared with you resolve as "Report not found" in link previews, because the reference provider only checks own items and never falls back to
ShareService (unlike OutputController::read).
- The
link_preview_enabled admin flag is dead code — it's read in matchReference() but the early return is commented out, so there's currently no way to switch previews off.
Open questions
- Widget height: I went with a fixed ~350px body for now. Does that work in all host apps, or should it be configurable?
- Panoramas: first page only (with a "page 1/n" link) feels like the right trade-off vs. building a pager into the widget. Opinions?
- Table visualizations pull in DataTables + jQuery lazily. jQuery is only loaded if the host page doesn't already have one — Talk is the case I'm most wary about, so extra testing there would be appreciated.
Happy to hear thoughts before I open the PR.
Current behavior
When you paste an analytics link (
/apps/analytics/r/{id}or/pa/{id}) into a Text document, a Talk message or a Tables description, the smart picker widget just shows a generic card: app icon, "Analytics Report", report name. You have to click through to the app to see anything.What I'd like to do
Render the real thing directly in the widget. The use case that got me started: I have a Nextcloud table and an analytics report built on that table's data — I want that visualization to show up right in the table's description, live, without leaving Tables.
Rough shape of the change (I have a working branch, PR coming shortly):
/data/{id}endpoint, so permissions and the ETag/localStorage caching we already use for the dashboard widget apply as-is.Bugs I ran into along the way
Two things worth fixing regardless of the feature:
ShareService(unlikeOutputController::read).link_preview_enabledadmin flag is dead code — it's read inmatchReference()but the early return is commented out, so there's currently no way to switch previews off.Open questions
Happy to hear thoughts before I open the PR.