Repository navigation
feat(contexts): carry the menu through export and import - #3138
rubenvdlinde wants to merge 2 commits into
Conversation
dca4eb5 to
bc762f6
Compare
bc762f6 to
04aafd2
Compare
04aafd2 to
455a391
Compare
8ac7add to
bfdf4e9
Compare
There was a problem hiding this comment.
thank you @rubenvdlinde
i tested the pr manually for now, what i found is the API part works fine, the exported file contains 'menuItems' and the import saves them when they are in the body. however the import screen does not send them.
from what i see, ImportContextSchemePreview.vue builds the import body in emitPayload() from the name, icon,description, tables and nodes. 'menuItems' is left out, so the application keeps the menu it already has. the preview response already returns the menu under 'menuItem' and it needs to be included in the import request, otherwise a user of the screen never gets the menu from the file.
bfdf4e9 to
e2404c1
Compare
|
Thanks @samin-z, good catch. The preview already returned the menu, but the screen never sent it with the import. The import screen now has a Menu switch, like Title, Icon and Resources. It shows the current menu, the menu after the import, and the items that would be skipped. When the switch is on (the default), the import sends the menu from the file. When it's off, the application keeps the menu it has. A Cypress component test covers both cases. |
511e6ca to
a1b94a7
Compare
…heme import Importing a scheme skipped a node whose uuid was unknown and answered 200, but answered 403 for a node on a table or view the user cannot manage. Such a node is now skipped the same way as an unknown one, unless it already belongs to the application, the way the menu of #3138 skips its items. A table to modify that is not here or cannot be managed is refused with the same 400 in both cases. Assisted-by: ClaudeCode:claude-opus-5-5 Signed-off-by: Ruben van der Linde <ruben@conduction.nl>
a1b94a7 to
2471ff4
Compare
The menu now travels with its application through a scheme export and import, and when a user's data is moved to another instance. An export writes each item with pages by technical name, tables and views by uuid, and the group of an item by the group's position in the exported menu. The title it shows is written along, for the import preview. An import replaces the menu: it finds pages by technical name and tables and views among the nodes of the application, so a menu never adds a table to it. Every item is checked like the API checks it, and an item that fails or whose target did not come along is skipped and logged with the reason, as is every item past the 200th. An item whose group did not come before it, or was skipped, moves to the top level. Moving a user's data keeps the links, the items for the pages and the items for the moved table. View items are skipped, as that import has no mapping from old view ids to new ones yet. The scheme preview shows the menu the import would save, next to the current one, and the items it would skip. The import screen has a Menu switch, like Resources: when it is off, the application keeps its menu. 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>
2471ff4 to
6368c26
Compare
|
@samin-z could you review this one again? |
|
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.) |
Part of the stack on #3133, on top of #3135 (menu API). Implements the export and import part of the menu proposal on #3100. A menu now travels with its application through a scheme export and import, and when a user's data is moved to another instance. This replaces #3138.
Size: 537 lines: 320 code, 192 tests and 25 generated OpenAPI.
What changes
importContext()maps nodes, so a menu never adds a table to an application. Every item is checked like the API checks it; an item that fails or whose target didn't come along is skipped and logged with the reason, and so is every item past the 200th. An item whose group didn't come before it, or was skipped, moves to the top level.TablesMigrator) carries the menu: links, items for the moved application's pages, and items for the moved table. View items are skipped for now, because that import has no mapping from old view ids to new ones.How it was tested
On Nextcloud 34 with PostgreSQL:
MenuServiceTestagainst the database: a menu with a group, a link, a table and a page through a scheme export andimportScheme(); a user migration throughimportContext(); items an import can't use, each skipped with its reason (data provider); an item whose group didn't come first moves to the topcomposer cs:check, psalm and rector, all clean;npm run lint,npm run stylelint,npm run typescript:checkandnpm run buildImportContextSchemePreview.cy.js: the import sends the menu, leaves it out when the switch is off, lists skipped items, and has no menu section without a menu🖼️ Screenshots
One small UI change: the Menu switch on the import screen, with the menu before and after and the items that would be skipped.
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)