Repository navigation
Todo
Labels
enhancementNew feature or request
Description
Is your feature request related to a problem? Please describe.
- Pages need simple structure beyond a header and free text. These three come up on almost every page we built in the prototype.
Why this is needed
- Application builders lay out start pages with only four widget types today: header, text, data and tables (
lib/Service/GridWidgetTypes.php). Simple structure between sections is missing. - buildiq parity: label, divider and banner are three of buildiq's presentational widgets (feature comparison, section 3: "partial, straightforward").
- Plan: part of the step "copy of the keep widgets", target sprint 6; it needs the form field types dropped in 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) and the screenshots (Screenshots of applications, pages and widgets at desktop and phone width #3460) depend on it.
Describe the solution you'd like
- Three static widget types for grid pages: a label (short text with an optional icon), a divider (a horizontal line between sections) and a banner (a coloured block with a title, text and an optional link). Each declares its settings as a server schema, like the existing header and text widgets.
Diagram
flowchart LR
E[edit the page] --> A[add widget]
A --> T["types from GET api/2/widget-types"]
T --> C{label, divider or banner}
C --> F[form built from the settings schema]
F --> S["save: PATCH api/2/contexts/{id}/pages/{pageId}"]
S --> V[page shows the widget in theme colours]
Acceptance Criteria
- Each type is listed by
GET /api/2/widget-typeswith its settings schema. - The widget editor builds its form from that schema, with no type-specific form code.
- Colours come from the theme variables, no fixed colours.
- Export and import of an application carry the widgets.
- Unit tests for the schemas, a Playwright spec that adds each widget to a page.
- 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. - The banner uses
NcNoteCard(with the neutral type and actions slot of feat(NcNoteCard): add a neutral type and an actions slot nextcloud-libraries/nextcloud-vue#9155). A label or banner does not repeat the widget's own title (jancborchardt on Grid pages in applications (frontend) #3099). - Usable at 360 px wide: nothing cut off and no horizontal scroll of the page. Every action works with the keyboard alone.
Components
- CnLabelWidget (keep, week 44): the label widget type, copied as is; its settings become a server schema in
GridWidgetTypes. - CnDividerWidget (keep, week 44): the divider widget type, copied as is.
- CnBannerWidget (keep, week 44): the banner widget type, copied as is. The component list notes its remote visibility rule needs a count through the data adapter (Frontend utilities on the Tables data adapter: schema shapes, display names, fields, visibility and the edit state #3470 (Frontend utilities on the Tables data adapter: schema shapes, display names, fields, visibility and the edit state #3470)); until then a banner shows without it.
Out of scope
- The other presentational widgets: Image and video widgets #3426, Link, links, quicklinks, tile and menu widgets #3427 and Container widget #3428.
- Rich text in the banner: the text widget covers it.
- Slicing, in landing order: one PR per widget type, divider, label, banner.
Describe alternatives you've considered
Questions for maintainers
- Banner colours? Options: (a) the types of
NcNoteCard(info, success, warning, error and neutral from feat(NcNoteCard): add a neutral type and an actions slot nextcloud-libraries/nextcloud-vue#9155), (b) a free colour from the theme. We would go with (a): it reuses existing words and colours and stays readable in dark mode. - Label as its own type, or a smaller variant of the header? Options: (a) its own type, (b) a size setting on the header. We would go with (a): a buildiq manifest maps one to one on import (Import an application from another builder's manifest #3459).
- 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 on a page. The banner carries an optional link.
- Today: a widget has no address of its own. Pages have slugs (
page_<id>, Technical name for tables and applications, CRUD routes by application and table #3094) but no reference URL or preview; only tables and views have one (lib/Reference/ReferenceProvider.php). - What this issue must do: when the banner links inside the application, store the target by type and slug, as Link, links, quicklinks, tile and menu widgets #3427 does, so export and import keep it. A widget needs no link identity for Link a row to objects in other apps: mails, Deck cards, files, rows of other tables #3468, which links rows.
- 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