check browseable items automatically with "is_folderish" metadata#1499
check browseable items automatically with "is_folderish" metadata#1499
Conversation
dc58240 to
cf6672b
Compare
|
I have tested this PR and it works as expected. I don't have such large image folders so I don't know how can I test it... I will try to create dummy folders here.. Anyway, perhaps this is another issue, but wouldn't ordering items alphabetically (using |
|
@petschki I haven't tested this, so I might be wrong... but why would you get an empty list? I see in mockup/src/pat/contentbrowser/src/utils.js Lines 61 to 67 in cf6672b selectableTypes types, and so in your example where only Image is selectable, you should only get images from the catalog. Am I missing something?
OTOH, I would be -1 on removing the ability to configure |
|
@frapell thanks for your suggestions. You're right, Your code snipped belongs to the "search mode" of contentbrowser, which is a flat list of items without the ability to browse somewhere at all (this is like the "search mode" in the old relateditems pattern) so there, we can simply constrain the catalog query to the selectable types without caring about browseable types ... |
cf6672b to
4a5beb2
Compare
4a5beb2 to
6fffa9c
Compare
6fffa9c to
cacfc36
Compare
|
I don't understand why we are not filtering for browsableTypes in the query, what is the problem with that? If nothing is set, we skip that filter, even if selectableTypes are given. selectableTypes should only have an affected if we can select them, they should still be visible. The only problem I see with the current behavior, is that providing selectableTypes, is also activating the filter for browsableTypes. When i provide browsableTypes, then i have to put all my folderish types. I could live with that. I honestly rarely use the browsableTypes filter. But selectableTypes all the time. Maybe instead of browsableTypes, a browsableTypesBlacklist does more sense if at all. |
|
I've made some progress here:
(possible) downsides:Since we cannot make OR concated catalog queries like "item_type=selectableTypes OR is_folderish=True" we have to load the complete level list when we have defined |
I think the "browseableTypes" problem is solved here since we're autodetecting if not defined. Once again: defining |
1ecba82 to
f22c1af
Compare
UPDATEAfter talking to @MrTango we came to the following conclusion: Loading the unbatched and filtered "selectableTypes" list would potentially lead to long loading time for large folders and especially in slow network conditions. That's why we are now loading the batched level items as usual and in case of defined A folder with many images and files where only images are defined as selectable types (in tinymce for example) looks like the following screenshot:
this loads even faster, because we can get rid of the extra iteration and filtering process. |
mauritsvanrees
left a comment
There was a problem hiding this comment.
This makes lots of sense. Works for me when I try it in coredev 6.1. Tested in a multilingual site by editing plone/app/relationfield/behavior.py and adding these pattern options to the related items field:
"browseableTypes": ["Plone Site", "LRF"],
"selectableTypes": ["Document"],
I wonder if someone will want the old way back, so that non-selectable/non-browsable items are not shown. If you have a folder with 5000 pages and 5 Images and you only allow selecting images, the previous behaviour is nicer. Theoretically I guess we could add a pattern option showNonMatchingItems or something like that, default True. If people prefer the old way, then they could set it to False in their pattern options. Or would that slow down the page again because filtering is needed?
If such an option is easy to add, it would be nice to have. I myself likely won't need it though.
For me this is approved. Thanks!
I won't merge though, I try not to interfere too much in the true ClassicUI parts of Plone. ;-) Best to have another approval.
f22c1af to
f297360
Compare

This tries to fix #1497
How its done:
selectableTypesis configured, only those are shown in the listis_folderish=Trueare shown and are browseable (and of course selectable too if configured)Important:
This has one downside which we have to solve: batching!
If you have a folder with 50 pages and one image at the end and you configure
selectableTypes: ["Image"]you see an empty list, because the catalog query only fetches the first 20 items.I can now remember, that this was the reason why I've implemented "browseableTypes" in order to contrain the catalog query to selectable and browseable types to fix this batching issue.
Now we have to have another strategy when you want to show only the selectable types in a large folder with many other types in it. Ideas welcome
/cc @erral @MrTango @thet @1letter @yurj