Repository navigation
feat(pages): fill the start page of an application with widgets - #3211
rubenvdlinde wants to merge 5 commits into
Conversation
AndyScherzinger
left a comment
There was a problem hiding this comment.
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.
| } | ||
| } | ||
|
|
||
| foreach (GridWidgetTypes::startPageWidgets($context->getName(), $context->getDescription(), $nodeRelIds) as $widget) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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.
| public static function startPageWidgets(string $name, string $description, array $nodeRelIds): array { | ||
| $widgets = []; | ||
| $gridY = 0; | ||
| if (trim($name) !== '') { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
There was a problem hiding this comment.
@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?
There was a problem hiding this comment.
Gone, as @enjeck preferred: a new or migrated start page gets no generated header.
| ]; | ||
| $gridY += self::HEADER_HEIGHT; | ||
| } | ||
| foreach (array_slice($nodeRelIds, 0, self::MAX_WIDGETS_PER_PAGE - count($widgets)) as $nodeRelId) { |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Fixed. A start page that can't show all tables and views logs how many it shows; the migration stops at the same limit.
There was a problem hiding this comment.
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).
There was a problem hiding this comment.
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
05ea37e to
e30b5dd
Compare
e30b5dd to
8f4db01
Compare
8f4db01 to
f5ad485
Compare
f5ad485 to
5d76b28
Compare
5d76b28 to
12ef427
Compare
|
Hello there, 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.) |
12ef427 to
5360c44
Compare
5360c44 to
e476384
Compare
e476384 to
6c6cdb4
Compare
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>
6c6cdb4 to
6eaabc6
Compare
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:
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
ContextService::create): one full-widthtableswidget 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.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 from2.5.0-dev.0to2.5.0-dev.1, one dev step from its base, so instances already on dev.0 run it.widgetslist keeps exactly what it says, also when it's empty.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_contentis 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 onetableswidget 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 changeContextPagesRoundTripTest(database): a start page exported withoutwidgetsis filled on import, one with an empty list is notPageServiceTest: the start page holds widgets (was: refuses them); fails without the changecomposer run rector:check,php -l,composer cs:checkand psalm, all clean🖼️ Screenshots
No UI change; #3216 shows the filled start page.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)