nextcloud / tables

🍱 Nextcloud tables app
https://apps.nextcloud.com/apps/tables
GNU Affero General Public License v3.0
143 stars 24 forks source link

Performance: Evaluate options to make the table/view row listing paginated #941

Open juliushaertl opened 6 months ago

juliushaertl commented 6 months ago

We need to get an overview how complex adding pagination for row results from tables/views is, given that views are filtered on the backend.

blizzz commented 6 months ago

Tables

For tables there are already endpoints on the Api1 Controller that support pagination:

$ ack indexTableRows
appinfo/routes.php
46:             ['name' => 'api1#indexTableRowsSimple', 'url' => '/api/1/tables/{tableId}/rows/simple', 'verb' => 'GET'],
47:             ['name' => 'api1#indexTableRows',       'url' => '/api/1/tables/{tableId}/rows', 'verb' => 'GET'],

lib/Controller/Api1Controller.php
909:    public function indexTableRowsSimple(int $tableId, ?int $limit, ?int $offset): DataResponse {
939:    public function indexTableRows(int $tableId, ?int $limit, ?int $offset): DataResponse {

It seems to be unused by the frontend though, there RowController::index() is being called. Might be even a drop-in replacement.

Views

The same is acutally valid for Views. The Api1 Controller supports pagination:

$ ack indexViewRows 
appinfo/routes.php
48:             ['name' => 'api1#indexViewRows',        'url' => '/api/1/views/{viewId}/rows', 'verb' => 'GET'],

lib/Controller/Api1Controller.php
969:    public function indexViewRows(int $viewId, ?int $limit, ?int $offset): DataResponse {

but RowController::indexView is used.

Conclusio

If the frontend cannot use the routes of Ap1Controller, we can easily add the optional arguments as the same service methods are being used..