Ignore gui - #7145
Conversation
|
Looks nice! So I haven't looked at the code, but I always felt that the only sensible way to do this would be a tree view, as otherwise there will be tons of clicking on the breadcrumb line just to navigate. What's your feeling? |
The service is a single data source shared by controllers.
|
This table+breadcrumbs UI just developed organically as I hacked at this. Tree requires a more complex structure of files, or loading them all at once, and seemed limiting when this might require some unusual button behavior. At least those were the assumptions I made without having tried to use fancytree :) I could be convinced it's the superior method! |
|
Fancy. Looks reasonable to me. I'd probably put the patterns above the "tree" (or whatever we call it) widget, as the pattern text box is fixed size and the tree widget can have unbounded height? (Didn't look at any code either.) |
|
You a wizard? :) The current breadcrumbs approach seems quite usable to me. I'd probably prefer a tree too - less up-and-down mouse movement (even though I wouldn't use the mouse :P ). And a very cursory glance at fancytree suggests it does what we need: tri-state selection and lazy-loading. However it might have other drawbacks and increased complexity. Basically with my current, limited knowledge of this I consider both approaches viable. Some points I noted on a very cursory glance at the code:
|
|
Not a wizard just an unemployed web dev OK I'll continue with the breadcrumbs UI for now, but will experiment with fancytree and see if the same features are compatible. To @imsodin 's points:
|
Turns out these was simply no need to iterate them all and keep a list of all matches
|
Here is what that advanced mode toggle looks like. I will try out fancytree later this week. Otherwise this is feature complete as much as I planned it and my remaining todo items are small - css, error messaging, translations. I do have some general questions:
|
|
I have not tested this yet, but how do you deal with a lot of folders/files in a folder? Are all of them displayed at once? What happens if you have e.g. 10,000 files in a folder? Is the GUI able to withstand displaying all that at once? If yes, then what is the RAM overhead? |
|
As it stands, I don't deal with them. The rest/db/browse endpoint does not offer pagination, so a folder with 10,000 files will render a table with 10,000 rows in the order returned by the API. For a large folder that might be CPU intensive for the browser! I don't think it is unreasonably memory hungry though.
|
|
Here is the change using fancytree. |
|
Looks great. I know there were some issues with resetting the trees state that I had elsewhere, I think in version restore UI, so perhaps there is something there to be inspired by. Also, I think fancy tree was just a suggestion of something we used before that seem to have worked, but I think you have more expertise in the UI area than all of the maintainers put together, so perhaps there are better, angular specific components that we could use. I guess we use an ancient version of angular so it might be hard to find something that works, but I know for sure that angular material has something like this that would work. One thing that looks strange in the example is the fact that the checkboxes are left aligned, rather than aligned with the item, but I guess that's how fancy tree renders it? I guess if you feel it's polished enough, let us know, and we'll start digging through the code with our limited UI experience. |
This way table auto has the default behavior of using th and td types for fixed width and fill width columns respectively, but offers classes when the desired fixed width column isn't the header.
There was a problem hiding this comment.
I do like this code - and I haven't even looked at the tests yet :)
A though about future extension - not necessary to address in this PR, but to keep in mind to prevent the current implementation going against that (it doesn't as far as I see):
I expect having some sentinel comment(s) to mark the patterns managed by the tree to become necessary soon. One basic use-case that I expect people using the tree to expect, is ignoring file extensions. That's not currently possible, as those aren't simple patterns right now.
Also the improved browse api has landed: #7306
| $scope.emitHTTPError(err); | ||
| }); | ||
| $scope.ignores = Ignores.data; | ||
| $scope.currentFolder.ignoreIsEditingAdvanced = true; |
There was a problem hiding this comment.
There's a convention to prefix members of config/rest api objects (here FolderConfiguration), that are "additional", i.e. only exist in the UI, with a _.
| // Text representation of ignore patterns. Updated when patterns | ||
| // are added or removed, but modifying `text`` does not update | ||
| // `patterns`. |
There was a problem hiding this comment.
That means when I change patterns in advanced mode, and then switch back to the tree and toggle something, my edits from the advanced mode are lost - right?
There was a problem hiding this comment.
No. This comment is kind of misleading, I will update to: "modifying text does not update patterns until parseText is called"
After editing text in advanced mode and calling parseText, all lines are parsed into pattern objects. No data is lost, and when making changes the tree only modifies the patterns simple enough to understand.
There was a problem hiding this comment.
Ah right. I missed the parseIgnores on losing focus in the html.
| }); | ||
| self.data.patterns.splice(afterIndex + 1, 0, newPattern); | ||
|
|
||
| // Remove any more specific patterns so the new pattern has the intended effect. |
There was a problem hiding this comment.
Is negation taking into account somehow? We do recurse into ignored directories to find more specific non-ignored items.
There was a problem hiding this comment.
No. The way it works currently, making a change to a parent directory overwrites all patterns that apply to child directories. We can discuss a way to not overwrite the more specific patterns - there are some weird UI interactions to consider.
There was a problem hiding this comment.
You are one step ahead - I wasn't even thinking about that.
Overwriting child input on toggling a parent seems fine. I was worrying that the (internal) behaviour (recursing into ignored directories) breaks the tree - however as you sort with the least specific last, that's not an issue at all. I just needed a moment to get there :)
|
Updated for new db/browse response structure. Re:future Yes comment fence could be used one day. The complexity of handling patterns like globs or extensions comes from the UI making unintended changes, having widespread in the syncthing folder beyond the specific file the user is toggling. I can imagine one day adding a dialog for these patterns to confirm changes, explaining the impact. Or to confirm your change to parent will remove X number of child patterns. Or option to ignore other files with the same name or extension as the current one. Just speculating. |
|
@imsodin should we just merge this? |
imsodin
left a comment
There was a problem hiding this comment.
Took it for a spin and it's really nice :)
The blue blackground of the tree was a bit distracting to me. I'd keep it white like everything else.
It doesn't look like there's a home for any documentation on using the browser. Maybe the Ignoring Files page?
There's something in the introduction, but it's quite outdated I think (haven't looked at it in a long time). I think it fits best into ignoring files indeed.
@imsodin should we just merge this?
Generally yes.
We should talk about the build process for tech-ui and tests here, as both require npm. Having tests without running seems wasteful. We could back it out of the PR until we decided how to handle it, and add it later.
| <div ng-show="!currentFolder._ignoreIsEditingAdvanced"> | ||
| <table id="ignore-tree" class="table table-condensed table-striped table-auto"> | ||
| <thead> | ||
| <tr> | ||
| <th class="col-fixed"></th> | ||
| <th class="col-flex"></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr> | ||
| <td class="col-fixed"></td> | ||
| <td class="col-flex"></td> | ||
| </tr> | ||
| </tbody> | ||
| </table> | ||
| </div> |
There was a problem hiding this comment.
I'd add some indication that ticked means "sync, do not ignore". In the text pattern a negated pattern (!-prefix) means do not ignore, but sync. I agree that ticked should mean "sync, do not ignore", just see some potential for confusion. Maybe just "Ticked items will be synced, other items ignored."
| </p> | ||
| <p> | ||
| <div class="btn-group"> | ||
| <label class="btn btn-default" ng-class="{active: !currentFolder._ignoreIsEditingAdvanced, disabled: !currentFolder._ignoreIsBasic}" ng-if="editingExisting"> |
There was a problem hiding this comment.
I'd disable it when adding a folder instead of remove it - I prefer it when the UI has the same elements all the time.
|
I have just done some testing with the ignore GUI. Here are some of my observations.
|
Arrow function, trailing comma in function
|
Awesome feature - I found this code when I was motivated to write something similar myself.
|
|
Awesome development! I've been wishing for this functionality for years 🙂 As a stress test I synced a folder containing the Firefox source code. I expanded folders until I had more than 60.000 items in the tree. No problems (de)selecting items. However I encountered one bug. When expanding a directory in the tree, it may use the wrong folder id when calling the rest api. You need two folders to test this. In the first folder browse the tree by expanding directories. Works fine. Then try the same on the second folder. It will fail to browse more than one level. You can see in the network requests panel that it uses the wrong folder id (id of the first folder even though we're inside the second folder now). In the screenshot you can see the current folder id at the top, and the wrong folder id used in the api call. Besides this I'd recommend a few usability improvements. At the moment it looks like a whole folder is included because it's checked and marked blue, even though some of its sub folders are excluded. I think it's useful to distinguish 3 states:
The tree is under the "Ignore Patterns" tab, but what we're selecting is being included (not ignored). This is a bit contradictory in my mind. I think a heading/label above the tree could help explain, for example: "Select items to sync". Currently this ui is not presented when accepting a shared folder. So I'd have to manually set I'd be super happy if the current functionality would be merged. 🥳 |
|
Thanks @tomasz1986
@Jip-Hop |
|
Thanks! I like the descriptive text. Tested again, this time on Windows. I confirm the folder switching is now working properly 🙂 However (un)checking doesn't change the checkbox any more and duplicate ignore rules are added. See screenshots for results after clicking a checkbox multiple times. Would indeed be nice to show a top-level "ignore root" button (similar to manually typing the Have you considered tri-stage checkboxes (selectMode: 3), to not show 'fully checked' if at lease one child is excluded? |
I have done some quick testing.
|
|
🤖 beep boop I'm going to close this pull request as it has been idle for more than 90 days. This is not a rejection, merely a removal from the list of active pull requests that is periodically reviewed by humans. The pull request can be reopened when there is new activity, and merged once any remaining issues are resolved. |
|
I think this would be a really useful addition. @christianprescott are you still interested in finishing the implementation? |
|
Another ping @christianprescott, since you seem to have been active on GitHub again lately. This being one of the most requested features in Syncthing, would you be willing to start working on it again? I see you switched jobs around the time this PR went quiet. Maybe now is a better time? We also have some related progress toward a selective sync GUI using ignore patterns, see #9619 and its immediate user: https://forum.syncthing.net/t/beta-test-my-new-ios-app-for-syncthing/22457/1 |








Purpose
This change adds a browser for the global state of a folder and reflects which files and directories are ignored. I aim to close #4729, not to build next gen ignores.
It does:
present a browser of files and directories
show each file's status as unaffected, ignored, or included (by a !negated pattern)
match files to simple patterns (anchored at folder root, identifying a specific file)
use client-side parsing and matching for patterns
make use of /rest/db/browse in its current form
have some tests
It will soon:
edit ignore patterns with a checkbox or toggle button
detect advanced patterns, and decline to show the browser view when present
be better integrated with the ignores UI - I don't intend to keep it in its own tab
It does not:
handle "advanced" patterns - wildcards, case insensitivity, etc
prepare for larger scale - large number of files or ignore patterns, pagination
use fancytree for the browser view
Testing
This change includes Javascript tests! I am happy to split their addition out into a separate issue. I am not familiar with the project's build practices and would need some direction to get them running in CI.
Tests should help build confidence in a complex client side pattern-matching change. See the 'matchingPatterns' block of browseController.test.js for the examples demonstrating which patterns match which files. The controller is tested thoroughly but template is not - I think that's acceptable, it's relatively thin.
To test this change manually, open the folder edit modal and go to the "browse" tab.
Screenshots
Documentation
I have a change prepared to add a Testing section to syncthing/docs dev/web.rst. Just a couple sentences and a code block describing how to run the karma tests.
It doesn't look like there's a home for any documentation on using the browser. Maybe the Ignoring Files page?