-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite scrolling for files app #7167
Conversation
@PVince81 What is your plan regarding the share information for the 20 loaded files? From my point of view any share information should be delivered together with the file information. an example JSON response could look like this: [
{
"fileId" : 6967,
"shares" : [
{
"type" : "files",
"shareType" : 5,
"permission" : 1,
"shareId" : 241,
"name" : "07-12-11_no231_weihnachtsmann.jpg",
"url" : "http://localhost/core-stable5/public.php?service=files&t=0e72c30928c1faed00ff0602771b24bf",
"shareWith" : "user@example.com"
},
{
"permission" : 1,
"shareType" : 4,
"type" : "files",
"shareWith" : "user@example.com",
"name" : "07-12-11_no231_weihnachtsmann.jpg",
"url" : "http://localhost/core-stable5/public.php?service=files&t=558af554cd3d0b41648c01b4b0ba6f8a",
"shareId" : 242
}
],
"path" : "/07-12-11_no231_weihnachtsmann.jpg"
},
{
"fileId" : 185,
"path" : "/Beamer JVC HD1.jpg",
"shares" : [
{
"type" : "files",
"shareType" : 5,
"permission" : 1,
"shareId" : 241,
"shareWith" : "user@example.com",
"url" : "http://localhost/core-stable5/public.php?service=files&t=0e72c30928c1faed00ff0602771b24bf",
"name" : "Beamer JVC HD1.jpg"
},
{
"permission" : 1,
"type" : "files",
"shareType" : 4,
"name" : "Beamer JVC HD1.jpg",
"url" : "http://localhost/core-stable5/public.php?service=files&t=558af554cd3d0b41648c01b4b0ba6f8a",
"shareWith" : "user@example.com",
"shareId" : 242
},
{
"shareId" : 291,
"url" : "http://localhost/core-stable5/public.php?service=files&t=b88b2771c1c1a48beb9bcb0334123a7c",
"name" : "Beamer JVC HD1.jpg",
"shareWith" : null,
"type" : "file",
"shareType" : 3,
"permission" : 1
}
]
}
] |
@DeepDiver1975 at the moment ALL files are loaded in a JS array but only the 20 first are rendered in the table, so having the whole sharing should currently work. But you are right, I could try making the share data available along with the file data instead, maybe a task for the ajaxification here: #6968 |
@DeepDiver1975 I'll discuss this with Björn tomorrow as I still need to get familiar with the sharing API and will either add it into that PR or separately (a mix between the sharing task and files app performance improvements) |
For sure - my intention was to talk/discuss about the overall picture and concept. |
@owncloud/designers question about infinite scroll.
For 2) we could try and find out whether the file belongs to the current displayed range, if yes insert it, if not don't show it and let it appear as soon as the user scrolls down. What do you think ? |
Just tried this in IE8 (VM, not so strong computer) with 10000 files. Of course if you try and scroll to the bottom it will become slower over time, but at least you can open that folder without crashing the browser. I'm surprised that even IE8 isn't bothered when loading 10000 file entries into a JS array. |
I think this is already a nice improvement. I suggest we look into "API wise pagination" and "virtual scrolling" later (separate PR/future) I'll try and optimize this one here a bit more. |
I agree. This is a nice improvement and kind of "good enough" TM because 10000 file in one directory is a corner case anyways. |
Cool! After the scroll threshold improvement as we talked about, I’m fine with this. :) Design-wise this is a 👍 although I can’t judge if the code is ok. |
Thanks for the design review. |
Please review #7195 first, which fixes the "select all" case when not all files are in the list |
Rebased on top of the ajaxification branch which is itself rebased on top of master so needs to be retested. @MorrisJobke if you like you can test this branch instead of the ajaxification one... at least this way we can get the infinite scroll stuff in faster... Then I'll need someone to look at the code. |
@schiesbn if you like I can guide you through the new code on this branch for a code review ? |
reviewed the code together with @PVince81, looks good 👍 |
|
@PVince81 Rebase please (or just fast-forward ;)) |
Rebased. |
|
I predict many future issues with this because many apps rely on the file names being in the DOM (for example slideshow). These apps will have to be adapted to rely on the FileList.files array. |
Rebased and fixed selection to be now based on the internal array instead of the visible checkboxes... Additional issues:
|
I think this should be ready to test now, I haven't redone a regression test at the moment, but here are some tests related to the required changes:
|
- moved file selection code to FileList - fix selection summary when all files are selected - nextPage now auto-selects files if "select all" checkbox is checked - fixed trashbin to use the same selection logic as FileList
The FileList.files model is now updated with file operations. Adding files to the list will add to the model first, then to the DOM. If the insertion point isn't visible yet, the file won't be added to the DOM until the user scrolls down. Updated unit tests to include checking for the correct insertion point.
Removed "insert" flag, inserting is by default for FileList.add(). Added "animate" flag to FileList.add(). Added logic to correctly detect when to insert/append elements whenever the insertion point is visible or not. Fixed "render next page" logic to work correctly when many pages of files have been added.
The file selection is now based on the internal model array FileList.files instead of the visible checkboxes. This makes it possible to virtually select files that haven't been rendered yet (select all, then deselect a visible one) Added more unit tests for selection (with shift and ctrl as well)
Now using _.bind() for event handlers so we can use "this" which is more readable than a static access to FileList.
Fixed drag and drop code to use FileList.getSelectedFiles() instead of the visible DOM elements.
Rebased. |
A new inspection was created. |
went through the code together with @PVince81 and saw how it works 👍 |
A new inspection was created. |
NICE! 👍 |
🚀 Test Passed. 🚀 |
Infinite scrolling for files app
Thanks! 🍸 |
🚀 Test Passed. 🚀 |
Trying to cherry-pick this branch for a OC6.02 install. After merging just the modified files, I'm getting this error in the owncloud.log file... {"app":"PHP","message":"Call to a member function getType() on a non-object at /www/beta/apps/files/index.php#45","level":3,"time":"2014-04-28T23:05:40+00:00"} Any suggestions? |
Use the master branch if you want to test thus feature. Cherry-pick will not work as many other changes are necessary Von Samsung Mobile gesendet -------- Ursprüngliche Nachricht -------- Trying to cherry-pick this branch for a OC6.02 install. After merging just the modified files, I'm getting this error in the owncloud.log file... {"app":"PHP","message":"Call to a member function getType() on a non-object at /www/beta/apps/files/index.php#45","level":3,"time":"2014-04-28T23:05:40+00:00"} Any suggestions? — |
Thanks! Sorry for the newbie question.. but what's the best way to know what pull request made it into the owncloud community editions? For example, how can I tell if this made it into 6.0.3? |
Without juggling with git it's a bit hard to see. But generally speaking the stable branches (OC 6) only get bugfixes, no new features. Even easier is to just ask in the PR 😉 |
Thanks for the info guys. Still trying to learn how to use github efficiently... |
Adds in-memory infinite scroll: the whole files list is loaded into a JS array but only the next 20 table rows are rendered, and then the next 20, etc when scrolling.