Skip to content

Commit b2bf2f6

Browse files
authored
Merge pull request #2598 from nextcloud/enh/column-uuids
feat: add UUIDs to columns
2 parents c891704 + 66eee66 commit b2bf2f6

21 files changed

Lines changed: 739 additions & 63 deletions

.github/workflows/playwright.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ jobs:
4040
cache: 'npm'
4141
node-version-file: 'package.json'
4242

43+
- name: Set up dependencies
44+
run: composer i --no-dev
45+
4346
- name: Install dependencies
4447
run: npm ci
4548

@@ -54,6 +57,16 @@ jobs:
5457
env:
5558
SERVER_BRANCH: ${{ matrix.server-versions }}
5659

60+
- name: Show logs
61+
if: failure()
62+
run: |
63+
for id in $(docker ps -aq); do
64+
docker container inspect "$id" --format '=== Logs for container {{.Name}} ==='
65+
docker logs "$id" >> nextcloud.log
66+
done
67+
echo '=== Nextcloud server logs ==='
68+
docker exec nextcloud-e2e-test-server_tables cat data/nextcloud.log
69+
5770
- name: Upload test results
5871
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
5972
if: always()

.scoper-production-dependencies

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@ maennchen/zipstream-php
44
markbaker/complex
55
markbaker/matrix
66
psr/simple-cache
7+
symfony/uid
8+
symfony/polyfill-uuid

appinfo/info.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ Share your tables and views with users and groups within your cloud.
2626
Have a good time and manage whatever you want.
2727
2828
]]></description>
29-
<version>2.2.0</version>
29+
<version>2.2.1-dev.0</version>
3030
<licence>AGPL-3.0-or-later</licence>
3131
<author>Nextcloud GmbH and Nextcloud contributors</author>
3232
<namespace>Tables</namespace>

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
"lint": "find . -name \\*.php -not -path './vendor/*' -not -path './build/*' -print0 | xargs -0 -n1 php -l",
4040
"cs:check": "php-cs-fixer fix --dry-run --diff",
4141
"cs:fix": "php-cs-fixer fix",
42-
"psalm": "./vendor/bin/psalm.phar --show-info=false --no-cache",
42+
"psalm": "@php ./vendor/bin/psalm.phar --show-info=false --no-cache",
4343
"psalm:update-baseline": "./vendor/bin/psalm.phar --update-baseline",
4444
"psalm:fix": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType",
4545
"psalm:fix:dry": "./vendor/bin/psalm.phar --no-cache --alter --issues=InvalidReturnType,InvalidNullableReturnType,MismatchingDocblockParamType,MismatchingDocblockReturnType,MissingParamType,InvalidFalsableReturnType --dry-run",
@@ -65,6 +65,7 @@
6565
"require": {
6666
"phpoffice/phpspreadsheet": "^5.1",
6767
"ext-json": "*",
68-
"bamarni/composer-bin-plugin": "^1.9.1"
68+
"bamarni/composer-bin-plugin": "^1.9.1",
69+
"symfony/uid": "^6.4"
6970
}
7071
}

composer.lock

Lines changed: 162 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/Analytics/AnalyticsDatasource.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -298,9 +298,9 @@ private function formatSelectionValue(Column $column, mixed $value): mixed {
298298
return '';
299299
}
300300

301-
foreach ($column->getSelectionOptionsArray() as $option) {
302-
if ((int)$option['id'] === (int)$value) {
303-
return $option['label'];
301+
foreach ($column->getSelectionOptionsCollection() as $option) {
302+
if ($option->key() === (int)$value) {
303+
return $option->label();
304304
}
305305
}
306306

@@ -318,9 +318,9 @@ private function isMultiSelection(Column $column): bool {
318318
private function getSelectionLabels(Column $column, array $values): array {
319319
$labels = [];
320320
foreach ($values as $value) {
321-
foreach ($column->getSelectionOptionsArray() as $option) {
322-
if ((int)$option['id'] === (int)$value) {
323-
$labels[] = $option['label'];
321+
foreach ($column->getSelectionOptionsCollection() as $option) {
322+
if ($option->key() === (int)$value) {
323+
$labels[] = $option->label();
324324
break;
325325
}
326326
}

lib/Controller/ApiTablesController.php

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use OCA\Tables\Service\ColumnService;
2323
use OCA\Tables\Service\TableService;
2424
use OCA\Tables\Service\ViewService;
25+
use OCA\Tables\Vendor\Symfony\Component\Uid\Uuid;
2526
use OCP\App\IAppManager;
2627
use OCP\AppFramework\Http;
2728
use OCP\AppFramework\Http\Attribute\NoAdminRequired;
@@ -153,6 +154,9 @@ public function createFromScheme(string $title, string $emoji, string $descripti
153154
$table = $this->service->create($title, 'custom', $emoji, $description);
154155
$colMap = [];
155156
foreach ($columns as $column) {
157+
if (isset($column['uuid']) && !Uuid::isValid($column['uuid'])) {
158+
throw new \InvalidArgumentException('Invalid UUID provided');
159+
}
156160
$col = $this->columnService->create(
157161
$this->userId,
158162
$table->getId(),
@@ -182,7 +186,8 @@ public function createFromScheme(string $title, string $emoji, string $descripti
182186
usergroupSelectGroups: $column['usergroupSelectGroups'],
183187
usergroupSelectTeams: $column['usergroupSelectTeams'],
184188
showUserStatus: $column['showUserStatus'],
185-
customSettings: empty($column['customSettings']) ? null : json_encode($column['customSettings'])
189+
customSettings: empty($column['customSettings']) ? null : json_encode($column['customSettings']),
190+
uuid: $column['uuid'] ?? null,
186191
)
187192
);
188193
$colMap[$column['id']] = $col->getId();

0 commit comments

Comments
 (0)