Repository navigation
feat(pages): show the start page of an application as a grid page - #3216
rubenvdlinde wants to merge 16 commits into
Conversation
9fbacef to
5bba135
Compare
e634745 to
0b7f668
Compare
0b7f668 to
a043954
Compare
a043954 to
7754c14
Compare
AndyScherzinger
left a comment
There was a problem hiding this comment.
Review focused on performance, accessibility, security, clean code and architecture. The UI checks ran on a dev instance (MariaDB) with the frontend built from this PR. They covered axe-core 4.14 on the start page, the heading structure, CSV export from a table widget (works now, the file downloads), switching between Home and a grid page, the start page's details form, and an application created and changed through the API to check what the server does to its start page.
Accessibility: axe on the start page only reports the four rules of the table grid that main already has (unlabelled row checkboxes, empty header cell, unnamed rich text cells, scrollable cells without keyboard access); they're tracked separately, not part of this PR. Landmarks and the tab panel's label are fine. The duplicated heading is in the comment on GridPage.vue line 143.
Security: nothing found. No v-html, the CSV export keeps escapeFormulae, and access is checked again before the export.
On the server side of the start page (#3211), shown by this PR:
WidgetService::appendDataWidgetdoesn't raise the page version, so the optimistic lock doesn't protect against it. When a table is added while the owner edits Home, the owner's save deletes the new widget without the 409 message. Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at7754c144: on a new application, adding a table appended a widget with the version still 0; a save with version 0 and the old widget list returned 200 and removed it.) Raising the version inappendDataWidgetfixes it.- Removing a table from an application keeps its widget without a source, and every viewer sees a "No table or view to show" card on Home that only the owner can remove. The old start page simply dropped the table. Removing the widget along with the node, mirroring
appendDataWidget, or showing the empty state only in edit mode, avoids the pile-up when tables are added and removed. (Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at7754c144: table added, removed and re-added, one source-less data widget left and the card shown on Home.)
Already raised on #3215, now also on the start page: a reload() while editing (for example after "Edit application") drops the draft without the discard prompt, and loadActivePage() has no request tracking (now visible on quick Home/page switches, because the spinner that used to hide it is gone).
Description: "Tables added later are not placed on the start page (#3211)" doesn't match the server (see the comment on context.spec.ts line 115).
| await expect(page.locator('h1', { hasText: viewTitle })).toBeVisible() | ||
| // Tables and views added after the application was created are not placed on its start page | ||
| await expect(page.locator('[data-cy="startPageGrid"]')).toBeVisible() | ||
| await expect(page.locator('[data-cy="gridWidget"]').getByRole('heading', { name: tableTitle })).toHaveCount(0) |
There was a problem hiding this comment.
The server this PR builds on does place tables added later: ContextService::addNodeRelToPage calls WidgetService::appendDataWidget (#3211). So this assertion fails ("Update and add resources" fails on all four Playwright jobs here, with "Expected 0, Received 1"), and the serial tests after it don't run. Once this is fixed, the four tests that add the table through "Edit application" and then call addTableWidgetToStartPage would add a second widget for the same table and hit strict-mode violations on the heading. Dropping the helper and asserting the widget that was placed automatically fits the server; the helper's docblock (line 60) and the comment on line 113 say the opposite too.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: adding table 2 to an application through PUT /contexts/<id> appended a data widget for it to the start page). CI: run 42797552035.
There was a problem hiding this comment.
Fixed in "test(pages): expect a table added later on the start page" and "test(pages): find tables on the start page through one helper". The helper that added a widget by hand is gone and the test now checks that the table and view added through "Edit application" show up on Home. Since the start page now holds one tables widget that lists every table and view of the application, a table added later needs no widget of its own.
cc @blizzz
| } | ||
| if (request === this.loadRequest) { | ||
| // The rows start in the sorting the table or view was saved with | ||
| this.viewSetting = this.element?.sort?.length ? { presetSorting: [...this.element.sort] } : {} |
There was a problem hiding this comment.
Seeding the sort here resets the whole view setting on every load(), and load() runs on Edit page, Cancel, Save and Edit page details (the refetch raised on #3213). So a viewer's search, filters, sorting and hidden columns are wiped by each of them. Before this PR load() left viewSetting alone, so they survived the refetch. The opposite case doesn't work either: changing the default sort through the widget's own "Table settings" or "View settings" changes element.sort without a load(), so the widget keeps the old preset. Seeding once per target, and again when element.sort changes (as MainWrapper does with its element watcher), with one shared helper instead of a third copy, fixes both.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: searched "Create" in the Requests widget on Home, one row left; Edit page, the search field was empty and all 4 rows back). The sort change: code check only.
There was a problem hiding this comment.
Agreed, load() was the wrong place for it. A data widget now starts its view setting once per table or view, through a presetViewSetting() helper that MainWrapper uses too, and takes over a change of the saved sorting without touching the rest. So a refetch on Edit page, Cancel or Save keeps the viewer's search, filters and sorting. A component test covers the reload and a changed default sort.
cc @blizzz
| {{ t('tables', 'Edit page details') }} | ||
| </NcActionButton> | ||
| <NcActionButton :close-after-click="true" data-cy="gridPageDelete" @click="$emit('delete', page)"> | ||
| <NcActionButton v-if="!isStartPage" |
There was a problem hiding this comment.
"Edit page details" stays on the start page, but ContextPageForm only saves with a title, and the start page has none. So the owner can't set just an icon or a description on Home, and once a title is typed in to get past this, it can't be cleared again to get "Home" back, although PageService::validateTitle accepts an empty title for the start page. The typed title is also shown untranslated to everyone and turns on the start page's own heading. Requiring the title only for grid pages (isStartPage(this.page) || this.title.trim() !== '') fixes it. The Playwright test only checks that the button is there.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: Home → Edit page details, title empty, Save disabled).
There was a problem hiding this comment.
Right, the start page can go without a title now. The form only requires one for grid pages and tells you that an empty title on the start page means Home, so you can set just an icon or a description, or clear the title again. The component test saves the start page with an empty title and checks a grid page still needs one.
cc @blizzz
| <div class="grid-page" data-cy="gridPage"> | ||
| <div class="grid-page__header"> | ||
| <div class="grid-page__heading"> | ||
| <div class="grid-page" :data-cy="isStartPage ? 'startPageGrid' : 'gridPage'"> |
There was a problem hiding this comment.
With the start page now a GridPage on the context route, its route guards fire when a row is opened from a table widget: EditRow pushes /application/<id>/row/<rowId>, a different record (contextRow) rendered by the same Context. The "Discard unsaved changes?" prompt opens over the row editor, and "Discard changes" discards nothing, because the instance is reused and the draft stays. A later Save stores what the user agreed to discard. Skipping the prompt when contextId and the page stay the same fixes it.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: Home in edit mode with a widget made taller, "Edit row" in the Requests widget, prompt shown over the row editor; after "Discard changes" the URL was /application/1/row/1 and edit mode still on).
There was a problem hiding this comment.
Thanks for the reproduction. The route guards now let a navigation through when the application and the page stay the same, which covers opening a row, so there is no prompt and nothing is falsely discarded. A Playwright test opens a row from the tables widget while Home is in edit mode.
cc @blizzz
| // If nodes exist but not in startpage content, they won't be shown. | ||
| // This matches backend logic where nodes are added to startpage. | ||
| } | ||
| await this.loadActivePage() |
There was a problem hiding this comment.
When loading an application fails, reload() resets neither activePage nor errorMessage. With the start page now kept in activePage, the next application shows its own name and page bar above the previous application's start page, and since errorMessage is never cleared, the activeContext watcher (line 119) skips every later reload. The old start page cleared contextResources at the start of reload(); this.activePage = null and this.errorMessage = null there fix it.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: Home of application 1, then #/application/999 ("This application could not be found"), then #/application/5: application 5's title above application 1's header widget "Intake portal" and its data widgets as "No table or view to show"; only a browser reload recovers).
There was a problem hiding this comment.
Agreed. When reload() starts for another application it clears the page and the error message first, and the activeContext watcher only stops on an error of the application it belongs to. Your sequence (an application, a missing one, another one) is a Playwright test now.
cc @blizzz
| this.reload() | ||
| } | ||
| '$route.params.pageId'() { | ||
| this.loadActivePage() |
There was a problem hiding this comment.
This fixes the full reload on Home only partly: loadActivePage() sets activePage = null, so GridPage and its data widgets unmount and mount again on every return to Home. Each DataWidget starts with loading: false and finds its rows in the store, so it first builds the table, then load() swaps it for a spinner, refetches columns and all rows, and builds it again. When the application changes, this watcher and the activeContext watcher's reload() both load the start page. Keeping the start page mounted (or starting widgets in loading and refreshing in the background when the store has the rows), and returning early here when the context changes, avoids it.
Validated: reproduced on a deployed instance (MariaDB, 2.4 data upgraded through #3133 to #3212, frontend built from this PR at 7754c144: grid page → Home, no spinner any more, but 7 requests: the start page, then columns and rows of each of the 3 widgets again). The double mount and the duplicate load on an application switch: code check only.
There was a problem hiding this comment.
Agreed. The page on screen now stays until the next one has loaded, only a page change within the same application loads a page (an application switch loads its start page once, through the reload), and a data widget whose rows are already in the store refreshes without the spinner. A Playwright test goes from a grid page back to Home and counts one rows request and no spinner.
cc @blizzz
| const startPage = pages.find(p => p.page_type === 'startpage') | ||
|
|
||
| if (startPage && startPage.content) { | ||
| const sortedContent = Object.values(startPage.content).sort((a, b) => a.order - b.order) |
There was a problem hiding this comment.
The start page was the only place that showed the order stored in page_content. "Edit application" still lets the owner drag tables into an order and saves it (updateContentOrder), but the start page is now placed by widget positions, which nothing updates from that order, so the drag handles no longer change anything visible. Either drop the ordering from the dialog or apply it to the start page widgets.
Validated: code check only.
There was a problem hiding this comment.
Good point. The tables widget now follows the order from "Edit application", which is kept in the content of the start page, with anything without an order after it by id, so the drag handles do something visible again. A component test and a Playwright test check the order.
cc @blizzz
|
|
||
| &:deep(.row.first-row) { | ||
| margin-inline-start: 0; | ||
| padding-inline-start: 20px; |
There was a problem hiding this comment.
This override moves with nothing: ElementTitle still renders its row first-row bar inside a widget when the element is filtered, a view is shared or the viewer has local adjustments, and the global .row.first-row style gives it a 60px start padding and 20px bottom padding inside a 400px card. Moving the override into DataWidget's scoped style keeps the bar aligned.
Validated: code check only.
There was a problem hiding this comment.
You're right, the override went with the table list. It lives in DataWidget's scoped style now, so the bar lines up inside a widget. I did not add a test for the padding itself.
cc @blizzz
| await expect(page.locator('[data-cy="contextStartPageLink"]')).toHaveAttribute('aria-selected', 'true') | ||
| await expect(page.locator('[data-cy="contextPageAdd"]')).toBeVisible() | ||
| await expect(page.locator('[data-cy="gridPage"]')).toHaveCount(0) | ||
| await expect(page.locator('.resources')).toHaveCount(0) |
There was a problem hiding this comment.
.resources no longer exists after this PR, so this check can't fail. The test on the next lines infers that Delete is missing from the inline "Edit page details" button instead of checking [data-cy="gridPageDelete"] has count 0, and nothing covers the new widget handlers (export, filtered export, scheme import) or the preset sort, which are what this PR adds to DataWidget.
Validated: code check only.
There was a problem hiding this comment.
Fair. The .resources check is gone, the Home test checks directly that gridPageDelete is not there, and there are new tests for exporting all rows and the filtered rows as CSV, for opening the scheme import and for a view whose rows show in their saved sorting on Home.
cc @blizzz
| const resourceInput = createContextModal.locator('[data-cy="contextResourceForm"] input').first() | ||
| await resourceInput.click() | ||
| await resourceInput.fill(resourceTitle) | ||
| await page.getByRole('option', { name: new RegExp(resourceTitle, 'i') }).first().click() |
There was a problem hiding this comment.
new RegExp(resourceTitle, 'i') isn't escaped: a title like Budget (2026) doesn't match its option, and Old Tasks sorts before Tasks and is picked by .first(). escapeRegExp(resourceTitle) (line 12, used elsewhere in this file) fixes it.
Validated: code check only.
There was a problem hiding this comment.
Thanks. The title goes through escapeRegExp now, anchored at the start of the option (after the emoji), and selectFromVueDropdown in context.spec.ts escapes it too.
cc @blizzz
7754c14 to
fdb3e36
Compare
fdb3e36 to
82ab303
Compare
82ab303 to
984a023
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.) |
984a023 to
797162f
Compare
391f03c to
212bd2b
Compare
212bd2b to
9cc4c20
Compare
|
This one is gone with "feat(pages): start a new start page with one tables widget": adding a table no longer writes a widget at all, since the start page lists every table and view through one tables widget. So there is no write that could slip past the version check. The pile-up is gone, since the start page no longer gets a widget per table. A data widget you placed yourself can still lose its table, so it now only shows in edit mode, where it asks for another table or view and can be removed. Viewers don't see an empty card any more. I'll update the description: since the 18 Nov round the start page has one tables widget that lists every table and view of the application, so a table added later shows up there without a widget of its own. cc @blizzz |
The start page of an application is shown as the grid of its widgets, with Edit page and Edit page details for its owner and no Delete. The old list of tables is no longer shown; the table or view widget takes over its CSV download, scheme import and saved sorting. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
A data widget shows the title of its table in its own heading, the table inside no longer repeats it. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Since the start page follows the tables and views added to an application, the tests wait for the widget instead of placing it themselves. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…its start page 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>
…s again A data widget set its view setting on every load, so Edit page, Cancel and Save cleared what the viewer had searched, filtered and sorted, while a changed default sort was not taken over. It now starts the view setting once per table or view, takes over a change of the saved sorting, and shares presetViewSetting() with MainWrapper. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Edit page details asked every page for a title, so the start page could not get only an icon or a description, nor its title cleared to be called Home again. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Opening a row from a widget changes the route but keeps the page, so the page guards let it through instead of asking to discard unsaved changes that stay anyway. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…found The view kept the start page and the error of the application before, and the error stopped every later load. Loading another application now starts without them. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
Every switch of pages cleared the page first, so the start page and its data widgets mounted again behind a spinner, and an application switch loaded its start page twice. The shown page now stays until the next one arrives, only a page change within the application loads a page, and a data widget whose rows are in the store refreshes without a spinner. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The option of a table or view was matched by its title as an unescaped pattern anywhere in its name, so "Budget (2026)" did not match and "Old Tasks" was picked for "Tasks". The title is escaped now, and the resource select anchors it at the start. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The order of the tables and views set in "Edit application" is kept in the content of the start page, which the tables widget did not read. It now lists them in that order, and those without one after them by id. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
A data widget whose table or view left the application showed every viewer an empty card that only the owner could remove. It now only shows in edit mode, where it asks for another table or view. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The start page used to pull the bar of a table in; with the table list gone, a bar in a data widget took the indent of the page. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
The start page test no longer checks for the gone table list, the delete action is checked by its own selector, and the CSV exports, the scheme import and the saved sorting of a table or view on the start page have a test each. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
…the label Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
9cc4c20 to
5faaef2
Compare
Part of #3099, on top of #3215 (grid pages). The start page of an application is shown as the grid of its widgets, which #3211 fills when an application is created or upgraded. The old list of tables is no longer shown.
Size: 387 lines: 324 code and 63 tests.
What changes
How it was tested
On Nextcloud 34 with PostgreSQL:
context-grid-pages.spec.ts, including the start page of a new application and editing it, plus the existingcontext.spec.tsandcontext-navigation.spec.ts. The tests incontext.spec.tsthat add a table to an existing application find it on the start page in its tables widgetnpm run lint,npm run stylelintandnpm run build🖼️ Screenshots
Open question
The header widget repeats the application's name and description, which the page already shows above the page bar. We kept both, because the header is an ordinary widget people can change or remove. If you'd rather drop the name above the page bar on the start page, that's a small follow-up.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)