Skip to content

feat(pages): fill the start page of an application with widgets - #3211

Open
rubenvdlinde wants to merge 5 commits into
feat/noid/grid-pages-apifrom
feat/noid/start-page-autofill
Open

rubenvdlinde wants to merge 5 commits into
feat/noid/grid-pages-apifrom
feat/noid/start-page-autofill

Conversation

@rubenvdlinde

@rubenvdlinde rubenvdlinde commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

Part of #3099, on top of #3133 (pages API, on current main as 2.5.0-dev.0). As agreed on #3099, the start page of an application is always a grid page. This is the backend for that: a new application starts with a header and its tables and views as widgets, and existing applications get the same once, on upgrade. It doesn't need the menu (#3135 to #3138), so it can go in while the menu model is reworked on #3100.

This is the first of the pull requests that build grid pages on top of #3133. They're stacked, each on the one before:

  1. feat(pages): fill the start page of an application with widgets #3211 (this one): the start page is filled with widgets when an application is created, on upgrade and on import (backend).
  2. feat(pages): let widgets sit in the tabs of a tabs widget #3212: widgets can sit in the tabs of a tabs widget (backend). It asks a model question and can be dropped without affecting the others.
  3. feat(pages): add the grid canvas and its widgets #3213: the grid canvas and its widgets: header, text, table or view.
  4. feat(pages): add and configure widgets from their server schema #3214: the dialog that adds and configures a widget, generated from the widget types.
  5. feat(pages): show and edit grid pages of an application #3215: grid pages in an application: the page bar, adding and editing pages, arranging widgets.
  6. feat(pages): show the start page of an application as a grid page #3216: the start page shown as a grid page.
  7. feat(pages): add a tabs widget whose tabs hold their own widgets #3217: the tabs widget in the UI.

The menu frontend (F4 to F7: the menu editor, an application as its own app, the overview and the list of applications) waits for the new menu model and comes after it.

Size: 408 lines: 194 code, 210 tests and 4 generated OpenAPI (a changed endpoint description, in a separate commit).

What changes

  • A new application's start page is filled when it's created (ContextService::create): one full-width tables widget that shows every table and view of the application, the way the start page did before it became a grid page. There's no generated header, so the application's name isn't shown twice and doesn't go stale after a rename. A table or view added later shows up in that widget without a widget of its own.
  • Existing applications get the same widget from the migration Version2500Date20261109010000, for every start page that has no widgets yet. A start page that already has widgets is left alone, so running it again changes nothing. The app version goes from 2.5.0-dev.0 to 2.5.0-dev.1, one dev step from its base, so instances already on dev.0 run it.
  • Importing a user's data from an export made before pages had widgets fills the start page the same way. An export that has a widgets list keeps exactly what it says, also when it's empty.
  • The start page holds widgets. PATCH /api/2/contexts/{contextId}/pages/{pageId} used to refuse widgets on the start page (400); it now accepts them. The start page still can't be deleted.
  • page_content is still written when tables are added, as before.

The current frontend keeps showing the start page as its list of tables; #3216 shows the widgets.

How it was tested

On Nextcloud 34 with PostgreSQL:

  • Version2500Date20261109010000Test (database, 2 tests): an empty start page gets one tables widget and a second run changes nothing; a start page with widgets is left alone. Both fail without the migration.
  • ContextServiceTest: creating an application fills its start page, with and without tables (one test, two cases); fails without the change
  • ContextPagesRoundTripTest (database): a start page exported without widgets is filled on import, one with an empty list is not
  • PageServiceTest: the start page holds widgets (was: refuses them); fails without the change
  • the full unit suite on PostgreSQL and SQLite: 562 tests each
  • composer run rector:check, php -l, composer cs:check and psalm, all clean
  • no frontend changes besides the regenerated types

🖼️ Screenshots

No UI change; #3216 shows the filled start page.

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔙 Backport requests are created or not needed: /backport to stableX.X
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI

@AndyScherzinger AndyScherzinger left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review focused on performance, accessibility, security, clean code and architecture. The inline comments only cover points that aren't in the existing threads on #3133, #3132 or #3131; where one follows from an earlier thread, it links to it. This PR has no UI of its own, so the accessibility points are about how #3216 renders the start pages this PR fills. Points marked as reproduced were checked on a dev instance (MariaDB) running this branch with its migration applied.

Comment thread lib/Service/ContextService.php Outdated
}
}

foreach (GridWidgetTypes::startPageWidgets($context->getName(), $context->getDescription(), $nodeRelIds) as $widget) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Only create(), the migration and the import fill the start page; everything that changes an application's tables and views afterwards still goes to page_content alone. update() (the Edit application dialog, and Import scheme, whose importScheme() ends in update()) adds a node through addNodeToContextAndStartpage() without a widget, and the order set in the dialog, like PUT /api/2/contexts/{contextId}/pages/{pageId} (updateContentOrder()), only rewrites page_content.order. From #3216 on the start page is rendered from its widgets, and page_content is left as the order of the dialog's own list (EditContext.vue). So a table added after creation never appears on Home, reordering in the dialog has no visible effect, and an application created empty and then filled through Import scheme shows its header and nothing else. With the "widget stays and asks for a new table" agreed in #3099, a table removed in the dialog, or deleted by its owner, also leaves a full-width "No table or view to show" box for every member, and adding it back places nothing. #3216's e2e tests already work around this, with addTableWidgetToStartPage() after saving the dialog in four tests.

Reproduced on the dev instance: an application created with two tables got a header and two data widgets. PUT /api/2/contexts/{id} adding a third table added its page_content row but no widget; a second PUT with the nodes in the order third, first reordered page_content, while the widgets stayed header, first table, and a data widget without source, with the third table nowhere.

The description accepts that tables added later aren't placed, but with Edit application and Import scheme unchanged that means the start page stops matching the application right after it is created, and the same URL now has a PATCH for its widgets and a PUT for an order nothing shows. Putting the rule back where every addition passes, addNodeRelToPage() appending a data widget below the lowest one of the start page (with insertPage() and importContext() using the same append), keeps both dialogs meaningful. The tables overview widget proposed in #3099 (comment), one widget listing the application's tables and views, would follow every change by construction.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. A table or view added later gets a full width widget below the lowest widget of the start page, through addNodeRelToPage(), as long as the page has room. Reordering in the Edit application dialog still only changes the list order.

@enjeck, two questions follow from this: should the order in the Edit application dialog arrange the start page, and would the tables overview widget we proposed on #3099 be better than one generated widget per table? Both are also on #3099 with the other open design questions.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix holds: adding a table through PUT /api/2/contexts/{id} now puts a data widget below the lowest one, and reordering leaves the widgets as they are.

It opens one gap: WidgetService::appendDataWidget() writes to the page without PageMapper::raiseVersion(), so the version check in PageService::update() doesn't see it. Someone who has the start page open in edit mode and saves after a table was added (in Edit application, or by Import scheme) gets a 200, and because widgets not listed are deleted, the new table's widget is gone without a conflict. Raising the version inside the atomic() of appendDataWidget(), with null as the expected version like PageService::delete() does, turns that save into the ConflictError the stale editor should get.

Validated: reproduced on a deployed instance (this PR at 8f4db01b, MariaDB: loaded the start page at version 0, added a table with PUT /api/2/contexts/1, the page stayed at version 0 with the new widget; PATCH .../pages/1 with the earlier widget list and version: 0 returned 200 and removed the new widget).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Following @enjeck's answer: a new or migrated start page now gets one "Tables and views" widget that shows all tables and views of the application, instead of a widget per table, so a table added later needs no widget of its own. It lists them in the order they were added; the order in the Edit application dialog doesn't arrange the start page yet.

Comment thread appinfo/info.xml Resolved
Comment thread lib/Service/GridWidgetTypes.php Outdated
public static function startPageWidgets(string $name, string $description, array $nodeRelIds): array {
$widgets = [];
$gridY = 0;
if (trim($name) !== '') {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Accessibility: the generated header repeats what the page around the start page already shows. In #3216, Context.vue renders the application's name as <h1> and its description above the page bar on every page, and GridPage.vue deliberately gives the start page no heading of its own ("The start page sits under the title of its application"). The header widget then renders the same name as <h2> and the description once more, as the Home screenshot in #3099 (comment) shows ("Intake portal" and "Requests from residents" twice). In heading navigation the name comes twice in a row, and screen reader users hear the description, when there is one, twice; through the migration this applies to every existing application. Because the header has no title, GridWidget.vue also labels its <section> with the type name, so every Home starts with a region landmark called "Header", which says nothing about its content.

#3216 keeps both on purpose, because the header is an ordinary widget people can change or remove, and offers to drop the name above the page bar instead. But the header is a copy that nothing keeps current: ContextService::update() changes the name and description without touching it, so after a rename (in Edit application, or by Import scheme, which passes the scheme's name to update()) the page shows the new name above the page bar and the old one in the header, for every member until the owner edits the widget. Reproduced on the dev instance: after PUT /api/2/contexts/{id} with a new name and description, the header still had the old heading and subheading. Dropping the name above the page bar would leave that stale copy as the start page's only title.

Filling the start page with its tables and views only keeps it the way it looks today; the data widgets already work that way, showing their table's live title instead of a copy. A header stays one "Add widget" away for owners who want one. If a generated header stays, it needs to follow the application, for example a header setting that shows the application's name instead of storing it.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed that the name now appears twice, and that the copy goes stale after a rename. @enjeck, what would you like here: no generated header on a new start page, or a header that shows the application's name live instead of a copy? The open design questions are also collected on #3099.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rubenvdlinde could you add a current screenshot of a start page with the generated header, as #3216 renders it? The one on #3099 (#3099 (comment)) shows the name and description twice.

@jancborchardt your feedback would help here: the application's name appears above the page bar and again in the generated header widget, and the header is a stored copy that goes stale after a rename. Would you prefer no generated header on new start pages, or a header that always shows the application's current name?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gone, as @enjeck preferred: a new or migrated start page gets no generated header.

Comment thread lib/Service/GridWidgetTypes.php Resolved
Comment thread lib/Service/ContextService.php Resolved
Comment thread lib/Service/PageService.php Resolved
Comment thread lib/Service/GridWidgetTypes.php Outdated
];
$gridY += self::HEADER_HEIGHT;
}
foreach (array_slice($nodeRelIds, 0, self::MAX_WIDGETS_PER_PAGE - count($widgets)) as $nodeRelId) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nothing says when this cuts: an application with more than 99 tables and views (nothing limits that) gets data widgets for the first 99 only, at creation, on upgrade and on import, while importContext() logs the same cut for exported widgets a few lines further down. With #3216 the rest simply aren't on Home, and the page is then at MAX_WIDGETS_PER_PAGE, so adding any widget answers 400 until the owner removes widgets they never placed. A log line here, and a message on the migration's unused $output, would at least tell someone.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed. A start page that can't show all tables and views logs how many it shows; the migration stops at the same limit.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The log line in insertStartPageWidgets() holds. The migration still cuts at 100 without a word on $output, so an admin upgrading an application with more than 99 tables and views isn't told; an $output->warning() naming the application when array_slice() drops nodes would cover it.

Validated: code check only (reproducing it needs an application with more than 99 tables and views).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is gone along with the per-table widgets. Following enjeck on #3099, the migration and a new application now give the start page one tables widget that lists every table and view, so there is no limit left to cut at and nothing to warn about. That is in "feat(pages): start a new start page with one tables widget".

cc @blizzz

@github-actions

Copy link
Copy Markdown
Contributor

Hello there,
Thank you so much for taking the time and effort to create a pull request to our Nextcloud project.

We hope that the review process is going smooth and is helpful for you. We want to ensure your pull request is reviewed to your satisfaction. If you have a moment, our community management team would very much appreciate your feedback on your experience with this PR review process.

Your feedback is valuable to us as we continuously strive to improve our community developer experience. Please take a moment to complete our short survey by clicking on the following link: https://cloud.nextcloud.com/apps/forms/s/i9Ago4EQRZ7TWxjfmeEpPkf6

Thank you for contributing to Nextcloud and we hope to hear from you soon!

(If you believe you should not receive this message, you can add yourself to the blocklist.)

@rubenvdlinde
rubenvdlinde force-pushed the feat/noid/start-page-autofill branch from 5360c44 to e476384 Compare November 19, 2026 13:35
@rubenvdlinde
rubenvdlinde force-pushed the feat/noid/start-page-autofill branch from e476384 to 6c6cdb4 Compare November 20, 2026 10:52
rubenvdlinde added a commit that referenced this pull request Nov 20, 2026
#3211 and #3212 take 2.5.0-dev.1 and 2.5.0-dev.2 and land first, so the
menu migration runs on instances already on either of them.

Assisted-by: ClaudeCode:claude-opus-5-5

Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The start page of an application is a grid page. A new application
starts with a header showing its name and description and one full
width table or view widget per table or view. A migration fills
existing start pages without widgets the same way, in the order they
listed their tables, and an import of data exported before pages held
widgets does too. The page endpoint accepts widgets on the start page,
which still cannot be deleted.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
- a table or view added to an application later gets a widget at the bottom of the
  start page, so the start page follows the Edit application dialog and Import scheme
- a new, migrated or imported start page is filled with one call, its header passing
  the header schema with the description cut to 2000 characters; a start page that
  cannot show every table or view logs how many it shows
- an imported application that gets a new start page has it filled as well
- the migration step sorts after the steps of #2476 and #3131, copies its layout
  instead of using GridWidgetTypes, reads all start pages with two queries, prepares
  its inserts once, commits per hundred pages and reports progress
- the migration test runs in a transaction it rolls back, instead of emptying every
  Tables table of the instance
- the docs say page where the start page now counts as well

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Following enjeck on #3099: a new or migrated start page gets one full width
widget that lists the tables and views of its application, instead of a
generated header that repeated the application's name and one widget per
table. A table added later needs no widget of its own.

Assisted-by: ClaudeCode:claude-opus-5-5
Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
@rubenvdlinde
rubenvdlinde force-pushed the feat/noid/start-page-autofill branch from 6c6cdb4 to 6eaabc6 Compare November 21, 2026 10:53
rubenvdlinde added a commit that referenced this pull request Nov 21, 2026
#3211 and #3212 take 2.5.0-dev.1 and 2.5.0-dev.2 and land first, so the
menu migration runs on instances already on either of them.

Assisted-by: ClaudeCode:claude-opus-5-5

Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants