Content
Searching workaround for bug #31940 (changing default pageSize)
Added by Freddy Trotin almost 5 years ago
Hi, I have set up my development environment in order to see if I can find a workaround to the bug #31940.
I noticed in the logs that "My page" calls "/api/v3/time_entries?filters=[{"spentOn":{"operator":">t-","values":["7"]}},{"user_id":{"operator":"=","values":["me"]}}]" and opening this URL gives me this output :
{"_type":"Collection","total":31,"count":30,"pageSize":30,"offset":1,"_embedded":...
So I think that the bug is due to the lack of paging in the "SPENT TIME (LAST 7 DAYS)" grid (there should be a "Page 2" link to "offset:2").
Waiting for this bug to be fixed, I thought I could make my own workaround by changing this default "pageSize:30" in some file (having pageSize:50 would do the trick for me).
So I used this command to find in which file this default value is set :
grep -R "pageSize.*30" /openproject
Which gave me these results :
/openproject/docs/api/apiv3/endpoints/grids.apib: "pageSize": 30,
/openproject/docs/api/apiv3/endpoints/grids.apib: "href": "/api/v3/grids?offset=1&pageSize=30"
/openproject/docs/api/apiv3/endpoints/grids.apib: "href": "/api/v3/grids?offset=%7Boffset%7D&pageSize=30",
/openproject/docs/api/apiv3/endpoints/documents.apib: "pageSize": 30,
/openproject/docs/api/apiv3/endpoints/documents.apib: "href": "/api/v3/documents?offset=1&pageSize=30"
/openproject/docs/api/apiv3/endpoints/documents.apib: "href": "/api/v3/documents?offset=%7Boffset%7D&pageSize=30",
/openproject/spec/requests/api/v3/user/user_resource_spec.rb: .to be_json_eql((api_v3_paths.users + '?offset=1&pageSize=30').to_json)
/openproject/spec/lib/api/v3/work_packages/work_package_collection_representer_spec.rb: expected_query = query.merge(pageSize: 30, offset: 1)
/openproject/spec/lib/api/v3/work_packages/work_package_collection_representer_spec.rb: expected_query = query.merge(pageSize: 30, offset: 1)
/openproject/spec/lib/api/v3/work_packages/work_package_collection_representer_spec.rb: let(:href) { '/api/v3/example?a=b&b=c&offset=1&pageSize=30' }
So I tried to replace "30" by "50" in each of these files and refreshed my page but it didn't change anything.
I don't know the ruby language so I don't know if what I try to do can work (maybe it needs compiling some files).
Does anybody know if it may work (in development and in production environment) ?
Replies (1)
In case somebody is still looking for this:
The bug has been fixed with version 10.4.0. So with that version, there is no work around needed any more.
Thanks a lot, Freddy, for your detailed ticket and description of this issue.