Table scheme import - #2888
Conversation
b73b4af to
2c9d442
Compare
There was a problem hiding this comment.
Early comments, some can be left for later.
UI wise it looks really nice already!
-
I would not display the UUID as title in the check box. It looks technical and table managers will have not deeper knowledge about it. Would completely keeps this identifier internal and instead use the New Title.
-
In my quick test I also see that Views would be dropped instead of being kept
-
Maybe need to double check the sort order as well when nothing is defined
This is very promising already! :)
| */ | ||
| #[NoAdminRequired] | ||
| #[RequirePermission(Application::PERMISSION_MANAGE, null, 'context', 'contextId')] | ||
| public function importScheme(int $contextId, ?string $name, ?string $iconName, ?string $description, ?array $nodes, ?array $tables): DataResponse { |
There was a problem hiding this comment.
Node sure I understand correctly the role of $nodes vs $tables. Maybe have an idea with the TODO against the nodes.
There was a problem hiding this comment.
$nodes is array ids of tables and views to be shown. The $tables is array of related source tables.
| $columns = $this->columnService->findAllByTable($id, null, $table); | ||
| $this->enhanceTable($table, $userId); | ||
| return new TableScheme($table->getTitle(), $table->getEmoji(), $columns, $table->getViews() ?: [], $table->getDescription() ?: '', $this->appManager->getAppVersion('tables'), $table->getColumnOrderSettingsArray(), $table->getSortArray()); | ||
| $this->enhanceTable($table, $userId ?? $this->userId); |
There was a problem hiding this comment.
i suppose there is a reason for this line change? ^
There was a problem hiding this comment.
It would cause error when $userId is null
No, that should be there! In my test, the scheme file I uploaded did not have any changes with the views. However the dialog showed they would be removed, instead of kept. |
The application scheme includes the table schemes of related source tables. So it also detects the different views of those tables. Should we skip processing removed views when importing application scheme? |
Views that are missing in the scheme that is being imported shall be removed. In my case the detection was not correct, since they were still present, they should not be shown to be removed. |
|
@blizzz Do you mean that the view does present in the scheme but shown to be removed? It is strange, I cannot reproduce this issue. Could you please share the reproduce steps, as well as the scheme file you used and the uuid of the effected view? |
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
f57b358 to
c112d88
Compare
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
be79f8e to
d82400f
Compare
| if (!isset($tables['addTables']) || !is_array($tables['addTables']) | ||
| || !isset($tables['modifyTables']) || !is_array($tables['modifyTables'])) { | ||
| throw new BadRequestError('Invalid tables structure provided.'); | ||
| } |
There was a problem hiding this comment.
removing tables needs to be added as well, right?
There was a problem hiding this comment.
We should not remove the tables since they might be used in another application. Updating $node already reflect the elements to show on that application.
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
…bles into table-scheme-import
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
fixes updating columns when UUIDs are provided, e.g. during schema import. There we already have the proper local IDs in place. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Leads to confusion on other places, when it is re-imported and json_decoded. For example in schema update cases, it would result into identifying columns as modified while in fact they are unchanged. Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
|
I added two small commits with small fixes. A bit unsure about f8e2e1c – here i soften the check and instead of erroring out, simply discard the submitted UUID. Easier on user front-ends. Also, when i would all passing this parameter, then the remaining call is set on true, but we have more entry points here afaik. cc @samin-z – FYI you had the error case and we talked about that as well. More todos:
I still only tested a little bit, but spent maybe too long on those small changes (investigation time…). |
| $nodes = $context->getNodes(); | ||
| $tables = []; | ||
|
|
||
| foreach ($nodes as &$node) { |
There was a problem hiding this comment.
This leaves a dangling reference, so we should unset($node) after the loop?
There was a problem hiding this comment.
It is unnecessary, we are not using the $node after loop.
Signed-off-by: Luka Trovic <luka@nextcloud.com>
|
Signed-off-by: Luka Trovic <luka@nextcloud.com>
- UUIDs on tables are not needed for their strucutre updates – …but for Contexts. When a table is used in them, it has to be shared Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Signed-off-by: Luka Trovic <luka@nextcloud.com>
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
|
|
||
| test('Export scheme to json', async ({ userPage: { page } }) => { | ||
| const sourceScheme = await getTutorialScheme(page) | ||
| prepareSchemeForImport(sourceScheme, 'Imported scheme export') |
There was a problem hiding this comment.
tests succeed locally when i add this back
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
7f5621d to
d46fe08
Compare

🖼️ Screenshots
🏁 Checklist
/backport to stableX.X🤖 AI (if applicable)