Server side paging
Is this somewhat planed on the roadmap ?
Do we have an estimation regarding its date of release ?
I wonder because it is the only thing preventing United4Earth to work smoothly now
Activity
-
Newest first Oldest first
-
Show all activity Show comments only Show history only
- Owner
Not yet. I guess we'll have to wait for @bleme to leave his vahines...
- Author Contributor
https://www.youtube.com/watch?v=KWfnsFUDkhk
By Alexandre on 2019-07-04T11:02:23 (imported from GitLab project)
- Author Contributor
I've found nothing about paging or even "filtering" (we can do paging with a good filtering spec) on solid spec.
So we need to define a spec first.
Is paging only concerning the first level of a result or also the nested containers ? If it's concerning nested containers, how to do that ? Actual good practice is to augment the JSON with paging attributes like "page, next, previous" to navigate through the navigation. Do we want that ?
There's a lot of work here.
By Jean-Baptiste on 2019-07-04T14:19:48 (imported from GitLab project)
- Owner
I'm not sure if LD Flex supports it, but it probably should.
- Author Contributor
It's a start but the specification is about triples. It says nothing about nested container. Do we want paging on nested containers too ? How to do that ?
By Jean-Baptiste on 2019-07-05T10:54:49 (imported from GitLab project)
- Owner
It also specifies how containers should be paged: https://www.w3.org/2012/ldp/hg/ldp-paging.html#ldpc
I'm not sure to see what's specific about nested containers
- Author Contributor
I think It's complicated to page nested container. A resource can contains multiple containers... I think the best way to do it if to only give the url of nested containers if a resource is paged. So it's the responsibility of the app to retrieve the nested container, following its url, with or without pagination
By Jean-Baptiste on 2019-07-05T11:23:30 (imported from GitLab project)
- Owner
oh yes I see. Yes I guess we can pass only the id of the container and treat it like a standard one then.
- Author Contributor
I could do something with : https://www.django-rest-framework.org/api-guide/pagination/ and https://github.com/tbeadle/django-rest-framework-link-header-pagination
By Jean-Baptiste on 2019-07-05T11:40:15 (imported from GitLab project)
- Owner
Cool! How much work would you say it represents?
- Author Contributor
As usual, it depends :) If it works fine with django-rest api, it's 2h max, more if we want to implement the full spec. If I have to hack django rest, it could take a lot more time !
By Jean-Baptiste on 2019-07-06T14:14:14 (imported from GitLab project)
- Owner
Ok. I guess we have to add some time to implement it in LDFlex too.
- Ghost User assigned to @bleme
assigned to @bleme
By Jean-Baptiste on 2019-07-30T08:33:54 (imported from GitLab project)
- Ghost User created merge request !83 (merged) to address this issue
created merge request !83 (merged) to address this issue
By Jean-Baptiste on 2019-08-05T08:39:31 (imported from GitLab project)
- Ghost User mentioned in merge request !83 (merged)
mentioned in merge request !83 (merged)
By Jean-Baptiste on 2019-08-05T08:39:32 (imported from GitLab project)
- Author Contributor
@alexandre I've done something very "cheap" for the first version using only django features.
So you can enable pagination (some works need to be done front side) by adding this on
settings.py
:REST_FRAMEWORK = { 'DEFAULT_PAGINATION_CLASS': 'rest_framework.pagination.LimitOffsetPagination', 'PAGE_SIZE': 2 }
Then you will get this kind of resources :
{ "count": 5, "next": "http://127.0.0.1:8000/users/?limit=2&offset=2", "previous": null, "results": { "@id": "", "@type": "ldp:Container", "ldp:contains": [ { "@id": "http://127.0.0.1:8000/users/1/", "first_name": "", "groups": { "@id": "http://127.0.0.1:8000/users/1/groups/", "@type": "ldp:Container", "ldp:contains": [], "permissions": [ { "mode": { "@type": "view" } } ] }, "last_name": "", "username": "username", "email": "test@example.com", "account": { "@id": "http://127.0.0.1:8000/accounts/1/" }, "chatProfile": { "@id": "http://127.0.0.1:8000/chat-profile/1/" }, "name": "", "jobOffers": { "@id": "http://127.0.0.1:8000/users/1/jobOffers/", "@type": "ldp:Container", "ldp:contains": [], "permissions": [ { "mode": { "@type": "view" } } ] }, "profile": { "@id": "http://127.0.0.1:8000/members/1/" }, "skills": { "@id": "http://127.0.0.1:8000/users/1/skills/", "@type": "ldp:Container", "ldp:contains": [], "permissions": [ { "mode": { "@type": "view" } }, { "mode": { "@type": "add" } } ] }, "@type": "foaf:user", "permissions": [ { "mode": { "@type": "view" } } ] }, { "@id": "http://127.0.0.1:8000/users/2/", "first_name": "Jean-Baptiste", "groups": { "@id": "http://127.0.0.1:8000/users/2/groups/", "@type": "ldp:Container", "ldp:contains": [ { "@id": "http://127.0.0.1:8000/groups/1/" }, { "@id": "http://127.0.0.1:8000/groups/2/" } ], "permissions": [ { "mode": { "@type": "view" } } ] }, "last_name": "Lemée", "username": "jbl", "email": "jblemee@pm.me", "account": { "@id": "http://127.0.0.1:8000/accounts/2/" }, "chatProfile": { "@id": "http://127.0.0.1:8000/chat-profile/2/" }, "name": "Jean-Baptiste Lemée", "jobOffers": { "@id": "http://127.0.0.1:8000/users/2/jobOffers/", "@type": "ldp:Container", "ldp:contains": [ { "@id": "http://127.0.0.1:8000/job-offers/31/" } ], "permissions": [ { "mode": { "@type": "view" } } ] }, "profile": { "@id": "http://127.0.0.1:8000/members/2/" }, "skills": { "@id": "http://127.0.0.1:8000/users/2/skills/", "@type": "ldp:Container", "ldp:contains": [ { "@id": "http://127.0.0.1:8000/skills/1/" }, { "@id": "http://127.0.0.1:8000/skills/2/" } ], "permissions": [ { "mode": { "@type": "view" } }, { "mode": { "@type": "add" } } ] }, "@type": "foaf:user", "permissions": [ { "mode": { "@type": "view" } } ] } ], "permissions": [ { "mode": { "@type": "view" } } ] }, "@context": "https://cdn.happy-dev.fr/owl/hdcontext.jsonld" }
Just follow the links 'next' and 'previous'. The next step is to put 'next', 'previous' and 'offset' on
Link:
headers to be Linked Data compliantBy Jean-Baptiste on 2019-08-05T12:23:48 (imported from GitLab project)
- Ghost User added 2h of time spent at 2019-08-05
added 2h of time spent at 2019-08-05
By Jean-Baptiste on 2019-08-05T12:17:26 (imported from GitLab project)
- Owner
@bleme Cool, can you check how LD Flex handles LD Paging and make sure it's compatible?
- Ghost User closed via merge request !83 (merged)
closed via merge request !83 (merged)
By Jean-Baptiste on 2019-08-05T12:17:42 (imported from GitLab project)
- Ghost User mentioned in commit d912786d
mentioned in commit d912786d
By Jean-Baptiste on 2019-08-05T12:17:42 (imported from GitLab project)
- Author Contributor
@bleme : Very cool ! Thank you
By Alexandre on 2019-08-05T12:21:55 (imported from GitLab project)
- Author Contributor
I've found nothing about pagination in LDFLex but I think it's not a issue. You can follow the 'next' attribute with LDflex by creating a new 'path' with the 'next' attribute value
By Jean-Baptiste on 2019-08-05T12:22:55 (imported from GitLab project)
- Owner
Well it needs to be handled by the store. We should take the time to define a spec for that.
- Ghost User reopened
reopened
By Jean-Baptiste on 2019-08-05T16:57:07 (imported from GitLab project)
- Ghost User created merge request !84 (merged) to address this issue
created merge request !84 (merged) to address this issue
By Jean-Baptiste on 2019-08-06T09:08:39 (imported from GitLab project)
- Ghost User mentioned in merge request !84 (merged)
mentioned in merge request !84 (merged)
By Jean-Baptiste on 2019-08-06T09:08:40 (imported from GitLab project)
- Author Contributor
We're now ldp compliant :)
By Jean-Baptiste on 2019-08-06T09:11:17 (imported from GitLab project)
- Ghost User closed via merge request !84 (merged)
closed via merge request !84 (merged)
By Jean-Baptiste on 2019-08-06T09:11:25 (imported from GitLab project)
- Ghost User mentioned in commit 800a8312
mentioned in commit 800a8312
By Jean-Baptiste on 2019-08-06T09:11:26 (imported from GitLab project)
- Owner
C'est beau :)
- Calum Mackervoy mentioned in issue management/core-team#2
mentioned in issue management/core-team#2