Skip to content
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

Tree selector for ignore patterns #9132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

p0l0us
Copy link
Contributor

@p0l0us p0l0us commented Sep 26, 2023

Purpose

As a user, I wish to have an easy way to select which files from other devices will be downloaded and managed in my syncthing folder.

The main problem with current ignores is, that a user doesn't know what files exists in the global tree without downloading all files to the device or checking other device(s). So I want to expose the global item tree in the folder ignore editor tab in a tree component, allowing the user to select files which should be downloaded (not ignored). The feature target is not complex ignores management - just simply choose what to download.

Tree selection overrides the ignore patterns by something like:

// Generated by tree selector
!/FolderToDownload
!/AnotherFolder/FileToDownload.bar
!/AnotherFolder/FileToDownload_2.bar
**

The tree component is not supposed to parse any other ignore patterns than those generated by itself. It is each user's responsibility to not screw format up when using the tree selector. If the first line "// Generated by tree selector" is missing or incorrect, all patterns will be replaced by "**" and the user can un-ignore items one by one.

// Generated by tree selector
**

A broader view of the feature will be clarified by the following PR draft:
#9130

Testing

Describe what testing has been done, and how the reviewer can test the change
if new tests are not included.

Screenshots

Not receive-only folders:

image

Receive-only folders:

image

Tree expanded:

image

Documentation

No API changes.

@acolomb
Copy link
Member

acolomb commented Sep 26, 2023

Thank you for working on this. Have you seen #7145? It is a previous attempt at providing a similar feature, although sadly never finished. Might give you some inspiration or a basis to make your contribution most useful.

@tomasz1986
Copy link
Contributor

One major issue with the previous attempt was that performance with larger numbers of files/folders was abysmal. It literally brought the whole GUI down, making it completely unresponsive, in the worst case for minutes.

Possibly related:

@p0l0us
Copy link
Contributor Author

p0l0us commented Sep 27, 2023

One major issue with the previous attempt was that performance with larger numbers of files/folders

I just tried with 10 000 and 100 000 files in random folders, and it's not that bad. There is about 2s lag with 100 000 files when loading the tree. But I would expect such behavior.

Of course with higher number of ignore patterns parsing would take longer. What is reasonable performance we're aiming to ?

For now, I'm planning following improvements:

  • Tree data loading spinner or a message when loading the tree
  • Design similar to suggested PR with Basic and Advanced tabs.
  • Remove limitation to receive-only folders if possible.

@tomasz1986
Copy link
Contributor

tomasz1986 commented Sep 27, 2023

I just tried with 10 000 and 100 000 files in random folders, and it's not that bad. There is about 2s lag with 100 000 files when loading the tree. But I would expect such behavior.

Of course with higher number of ignore patterns parsing would take longer. What is reasonable performance we're aiming to ?

2s lag with 100,000 files is totally fine, I would say. With the restore versions tree, the lag starts with 1,000+ files already, and the same was true for the tree generated in the other PR.

I'm going to test your PR later on using a similar setup as before, as it would be absolutely great if you've actually managed to solve the tree lag problem.

Just for the record, in those other trees the lag happens when there are 1,000+ files in the same folder (e.g. the root folder which is always loaded).

@p0l0us
Copy link
Contributor Author

p0l0us commented Sep 27, 2023

I did more testing of the performance and did some tweaks:

  • I believe, limited height of FancyTree improved the initialization performance when 10 000 files in root folder since UI creates less items. It is also the reason why all nodes should be closed by default (TBD).
  • I used web worker to parse data from db/browse service to FancyTree format.
  • Data for FancyTree are pre-formatted in background once loaded. Loader is triggered by Edit Folder modal open. So most likely FancyTree data will be prepared before user even opens Ignore Patterns tab.

Limitation to receive-only folders removed.

Tree data loading message

image

Switching between Basic and Advanced patterns in Advanced settings tab and stored in folder config

image

Tree now takes whole space of Ignore Pattern tab and height is resizable.

image

* Folder Basic Ignores Tree tweaks
*/

#folderGlobalTree-container {
Copy link
Contributor

Choose a reason for hiding this comment

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

The styles here seem like a copy from #restoreTree-container. Is this correct? If yes, then I think it would be nice to just create a common class with these to add to the both elements to avoid the repetition.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I just copied that.

I will look at this later, when I know the style is final. min-height and max-height might need some tuning.

@p0l0us p0l0us changed the title Receive only tree selector for ignore patterns Tree selector for ignore patterns Sep 28, 2023
@ismay
Copy link

ismay commented Feb 17, 2024

Is this PR still on the table? Would be great to have, it's been such a highly anticipated feature.

@EmberLightVFX
Copy link

Writing a push on this PR also. Getting this into Syncthing would change a lot on how we're currently using it and for the average user this tree view instead will be way easier than learning git-ignore patterns.

@p0l0us What's the state of this PR? Anything you feel is missing?

@galilley
Copy link

Is it possible to add some user defined global ignore patterns to exclude temporary files like ".~", ".pyc" etc?

Also I would like to offer some extension to see the size (remote/local) of folders in the tree.

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.

None yet

6 participants