Skip to content

Added sorting by name, date or size ascending/descending#624

Closed
tobiasKaminsky wants to merge 12 commits intoowncloud:developfrom
tobiasKaminsky:sortingFiles
Closed

Added sorting by name, date or size ascending/descending#624
tobiasKaminsky wants to merge 12 commits intoowncloud:developfrom
tobiasKaminsky:sortingFiles

Conversation

@tobiasKaminsky
Copy link
Copy Markdown
Contributor

Hello,
I have added the possibility to sort files/folders by name, date or size.
The option is stored temporary, so it is obeyed if the directory is changed.

Filename sorting fixes also #379
Sorting by size: Folder are sorted by name, as there is no information about the number of files containing the directory.

Sorting is, like dolphin or windows explorer, separated between folder and files.

TODO: Translate to other languages.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Sep 15, 2014

This is something to discuss with @jancborchardt . An screenshot would be appreciated.

Forget about translations, we only define English in development. Translations are done in and pulled from Transifex , synchronized daily with the branch 'develop'.

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

I have made three screenshots:

  1. enhanced file sorting
  2. "Sorting" option after clicking on the three points
  3. available sorting options:
  • Filename - ascending
  • Filename - descending
  • Date - ascending
  • Date - descending
  • Filesize - ascending
  • Filesize - descending

screenshot_2014-09-15-09-43-15
screenshot_2014-09-15-09-43-23
screenshot_2014-09-15-09-43-30

@jancborchardt
Copy link
Copy Markdown
Member

Nice, this look good!

@tobiasKaminsky one thing: The words »ascending« and »descending« are quite confusing. Instead use the more understandable labels:

  • Name, A-Z
  • Name, Z-A
  • Date, newest first
  • Date, oldest first
  • Size, biggest first
  • Size, smallest first

@jancborchardt
Copy link
Copy Markdown
Member

cc @MTRichards

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

I have added a small change:
Now the folders are always on top and get sorted, then the files are displayed.
Before that it occured that the folders were on the bottom as the list was only reversed.
Now the behaviour is exactly the same like in dolphin (KDE file browser).

One thing left: When "Sorting by size" all folders stay in A-Z order as there is no information how big/many files they have. One could iterate over every folder and sum up its content, but this is maybe too much, or?

@jancborchardt
Copy link
Copy Markdown
Member

@davivel don’t we have the folder size info by now? The web client displays it with no problems. cc @icewind1991 on how we do that there.

@jancborchardt
Copy link
Copy Markdown
Member

@tobiasKaminsky in the list of the sorting options – let’s actually cut it down to 3:

  • A - Z
  • Newest - Oldest
  • Biggest - Smallest

The reverse orders are of little use and clutter up the list.

@jancborchardt
Copy link
Copy Markdown
Member

And if we don’t have the folder size info for now, we can start out with the »A - Z« and »Newest - Oldest« sorting options.

@jancborchardt
Copy link
Copy Markdown
Member

By the way, they should be styled as radio buttons so it’s obvious which one is currently active.

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

  • Radio buttons are done (I will add it later when the other questions are solved)
  • I personally like the possibility to reverse the sorting order as otherwise one has to scroll down the complete list. Currently I am thinking about a global switch, which is located on the bottom (or top) of the dialog called "reverse", which is a toggle button. What do you think?

@MTRichards
Copy link
Copy Markdown

Great stuff here.

@jancborchardt the issue with folder size was one of performance, if I remember. I don't know if we can get folder size directly from the server, or if we have to create it locally - if I remember, the issue was that we had to calculate it, which takes time with each sub folder query of the server - and gets worse the bigger the tree.

@davivel Is this still the case?

@MTRichards
Copy link
Copy Markdown

I personally like the possibility to reverse the sorting order as otherwise one has to scroll down the complete list. Currently I am thinking about a global switch, which is located on the bottom (or top) of the dialog called "reverse", which is a toggle button. What do you think?

I do like the reverse order - and your thought removes clutter.
@jancborchardt ?

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

@jancborchardt the issue with folder size was one of performance, if I remember. I don't know if we can get folder size directly from the server, or if we have to create it locally - if I remember, the issue was that we had to calculate it, which takes time with each sub folder query of the server - and gets worse the bigger the tree.

For test reasons I have added recursive function I have found on stackoverflow. It is only calculating the local folder size. But it seems very quick.
Or does it have to be the size of the folder on the server?

@jancborchardt
Copy link
Copy Markdown
Member

Let’s start small with just the one order and leave out the reverse, ok? Small steps please, we can always add it later if we feel it is necessary.

- Folder size is computed locally (therefore only downloaded files are
obeyed)
@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

Let’s start small with just the one order and leave out the reverse, ok? Small steps please, we can always add it later if we feel it is necessary.

Right. I have removed the other options.
Folder size is computed locally.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Sep 17, 2014

Sorry for coming late.

About the size of folders, I think it is currently returned by the server in the property < d:quota-used-bytes > , but I am not sure, the name is a bit confusing. I would appreciate confirmation about this. CC @DeepDiver1975 @PVince81 .

@tobiasKaminsky , about your solution with local size of folders, probably won't work. The primary reason why we removed in the past the size of folders was not performance, but lack of synchrony with the real size in the server until the user browses down through all the tree of files or a full account synchronization is performed. With the local folder size the lack of synchrony is bigger, since will only match the server when all the files are downloaded (and synchronized).

@jancborchardt
Copy link
Copy Markdown
Member

@tobiasKaminsky by the way, you should join us on IRC in #owncloud-android (freenode IRC)! :)

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Sep 17, 2014

Yes, now I have a bouncer, so should not lost any more messages :$

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

About the size of folders, I think it is currently returned by the server in the property , but I am not sure, the name is a bit confusing. I would appreciate confirmation about this.
As far as I have found, the data are transferred via WebDav (ReadRemoteFolderOperation:79)
On the webdav interface via Browser (e.g. /remote.php/webdav/temp/) there is no file size.

Regarding the difference between local and server folder size:
I thought of this use case: Trying to find out which folder consume the most local size and then maybe delete them in order to get more space. But you are right, it is not mentioned that it is the local size which could confuse user.
So we should use the server folder size. But where is it? ;)

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

i have found something
in 049f659 @masensio has removed a function that gets the folder size from the server...
Maybe we can re-activate this and test the function?

@DeepDiver1975
Copy link
Copy Markdown
Member

About the size of folders, I think it is currently returned by the server in the property < d:quota-used-bytes > , but I am not sure, the name is a bit confusing. I would appreciate confirmation about this. CC @DeepDiver1975 @PVince81 .

Folder size does not exist in the webdav standard

@DeepDiver1975
Copy link
Copy Markdown
Member

Folder size does not exist in the webdav standard

but there is an owncloud extension to the standard:
owncloud/core#10723

😉 🚀

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Sep 18, 2014

That's cool!!!

But I still do not understand what < d:quota-used-bytes > is. I cannot find it in Webdav standards, but seem to match the value of folders size.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Sep 18, 2014

@tobiasKaminsky , that removed code is the one I mentioned before that does not work fine; it is calculating the folder size from size of descendent files -- but with the current known value of that sizes. If a file several levels down the way of the current file changed, that size won't be synchronized until the user browses down, and the size of its folder ancestor in the current folder will be calculated from a not synchronized value.

@jancborchardt
Copy link
Copy Markdown
Member

Yup, let’s move fast and iterate. No need to wait for folder size calculation, sorting by date and name is already great! :)

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

Ok.
Then I am done here :)
Please test and then it can be added to develop.

In order to get things clear it should exist a new issue for sorting by size, which refers to the "server-side folder size calculation" task. Otherwise it will maybe get forgotten?

@jancborchardt
Copy link
Copy Markdown
Member

@davivel @jabarros @rperezb please test ^

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Oct 14, 2014

I'm on it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any specific reason to pass getApplicationContext() instead of 'this' ? If the answer is 'no', 'this' should be prefered.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changed.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Oct 17, 2014

Sorry for the delay, I had to swtich to other tasks.

Finished the code review, please, check my comments.

Additionally, a rebase on develop is needed before testing, BUT not before we merge the release-1.6.0 branch into master & develop. We will do this on Monday.

@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

I have committed all your requested changes.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you enable auto formatting? We'd rather it's disabled until we unify an official formatter. This makes harder the reviews.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. It was a try to get automatically lines < 120 characters.
But it has changed to much, so I disabled it.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Oct 21, 2014

Thanks for the updates. The code review is fine for me now.

Please, rebase on 'develop' branch so that @purigarcia may validate the functionality.

@davivel
Copy link
Copy Markdown
Contributor

davivel commented Oct 24, 2014

We wanted to push this a bit up, so we rebased on 'develop' ourselves, in the branch 'sort_files'.

I close this PR to replace it with a #676

@davivel davivel closed this Oct 24, 2014
@masensio masensio mentioned this pull request Mar 17, 2015
1 task
@tobiasKaminsky tobiasKaminsky deleted the sortingFiles branch August 26, 2015 06:46
@tobiasKaminsky
Copy link
Copy Markdown
Contributor Author

@davivel I have created a PR to use the folder size of the server: #1655

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants