Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- Application start pages often show a logo, a photo or an instruction video.
Why this is needed
- Application builders want a logo, a photo or an instruction video on the start page; the four widget types of today (
lib/Service/GridWidgetTypes.php) have no media. - buildiq parity: image and video are buildiq presentational widgets (feature comparison, section 3).
- Plan: part of the step "copy of the keep widgets", target sprint 6, after the form field types of feat(pages): add the grid canvas and its widgets #3213 and feat(pages): add and configure widgets from their server schema #3214. Acceptance path 2 (a page with every widget type) depends on it.
Describe the solution you'd like
- Two media widget types for grid pages: an image from Files or a URL, with alternative text, and a video from Files or an embeddable URL.
Diagram
flowchart TD
O[viewer opens the page] --> S{source}
S -- Files --> R{can the viewer read the node?}
R -- yes --> P[Files preview or video]
R -- no --> X[empty state]
S -- URL --> H{host allowed by the admin?}
H -- yes --> E[image or embedded video]
H -- no --> X
Acceptance Criteria
- Each type is listed by
GET /api/2/widget-typeswith its settings schema. - An image from Files uses the Files preview; an image without alternative text cannot be saved.
- A video from a URL only plays from the hosts the admin allows, or from Files.
- A file the viewer cannot read shows an empty state, not an error.
- Export and import carry the widget; a Files reference is documented as instance specific.
- Unit tests for the schemas, a Playwright spec per widget.
- Settings are stored as JSON text in the
settingstext column oftables_contexts_widget(at most 60000 bytes,GridWidgetTypes::SETTINGS_MAX_BYTES), not in a database JSON column, as advised on Grid pages in applications (frontend) #3099. Nothing is filtered or sorted on them. - Widgets are saved through the page route
PATCH api/2/contexts/{contextId}/pages/{pageId}, which declares#[RequirePermission]for managing the application, and the service checks the same right before it writes. A test saves a page with the new widget as a reader of the application and expects 403, as learned in the review of feat(contexts): give applications a menu with its own API #3135. - When the file is deleted the widget shows the same empty state; nothing else needs cleaning up. The empty state uses
NcEmptyContent. - Usable at 360 px wide: nothing cut off and no horizontal scroll of the page. Every action works with the keyboard alone.
Components
- CnImageWidget (keep, week 44): the image widget type: an image from Files or a URL, with alternative text.
- CnVideoWidget (keep, week 44): the video widget type: a video from Files or an embeddable URL.
Out of scope
- Galleries, carousels and Photos albums.
- Uploading a file from the widget.
- Slicing, in landing order: one PR for the image widget, then one for the video widget.
Describe alternatives you've considered
Questions for maintainers
- Videos from outside the instance? Options: (a) only from Files in the first version, (b) an admin list of allowed hosts in the Tables admin settings. We would go with (a) first and (b) as its own PR: the content security policy then needs one deliberate change, not one per widget.
- Images from a URL? Options: (a) only from Files, (b) any URL, loaded by the browser. We would go with (a): Nextcloud's content security policy restricts outside images, and Files gives previews and access checks.
- Which word for the page an application opens on? jancborchardt asked on Grid pages in applications (frontend) #3099 for a word Nextcloud already uses. Options: (a) "Home", as in Talk, (b) "Dashboard", (c) keep "Start page". We would go with (a) "Home": Jan named Talk as the example, and "Dashboard" is already the Nextcloud Dashboard app, so two dashboards would confuse. The slug in the code can stay
dashboard(Page::START_PAGE_SLUG).
Additional context
Linking to other objects
- Object: a widget that points at a Files node or a URL.
- Today: no link from a widget to a file is recorded anywhere; Files does not know a page shows its file. Files has a collaboration resource provider for type
file, which Tables does not use. - What this issue must do: store the Files node id, not a path, check read access per viewer when the page renders (an empty state otherwise), and document the id as instance specific in export. That is the same identity and the same access rule as Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468, so a later "used on" lookup for a file can reuse it. No entry in the link store is needed.
- A widget that shows another app's object (a Deck board, a calendar, a text file) is the same registration question as Q2 (do apps register widgets for Tables?), still open on Grid pages in applications (frontend) #3099. The Teams widgets of Team dashboard circles#2552 and Team dashboard V1 circles#3010 go in a similar direction; maintainers can say whether Tables widgets and Teams widgets should share one registry.
Relevant files:
Related issues
Drafted with AI assistance from the project plan; @remko48 reviews it. Part of #3419.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or request
Activity