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

ZMI: limit number of resulted folderish objects and show SVG as FSImage #130

Merged
merged 20 commits into from
Sep 8, 2023

Conversation

drfho
Copy link
Contributor

@drfho drfho commented Aug 14, 2023

The manage_main-vIew of FSDirectoryVIew object may extremly slow down the system if the DirectoryView is next to root and the ZODB has a lot of objects. Reason is that all (!) folderish Zope objects are listed in the select-list "customize" (for selecting a copy-target).
Actually the manage_main-view ist primarily used for getting a short glance of the object's code/content (and maybe not so often for replicating its code into a ZODB object).
So I would like to suggest a max-parameter to ensure a quick response of the manage_main view. I propose a default value of 20 that can be adjusted to (50,100.200.500.1000, unlimited) on click, if the long list is really needed.

[1] Former ZMI (master branch)
zmi_cusomize_item0

[2] New ZMI status
zmi_cusomize_item3

src/Products/CMFCore/DirectoryView.py Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custdtml.dtml Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custfile.dtml Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custimage.dtml Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custpt.dtml Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custpy.dtml Outdated Show resolved Hide resolved
src/Products/CMFCore/dtml/custzsql.dtml Outdated Show resolved Hide resolved
Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

zmi_cusomize_item4_stx

@drfho
Copy link
Contributor Author

drfho commented Aug 14, 2023

Hi @dataflake ,
now my changes are considering Your kind hints. I hope the ZMI improvement meets Your expectation and the PR is ready to merge.
Many thanks
f

@drfho drfho requested a review from dataflake August 14, 2023 12:32
@dataflake
Copy link
Member

Sorry for being nitpicky. Your cleanup work is always appreciated.

Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

Sorry, count-param was not needed; it works easier with len() of the rval-list.

@dataflake
Copy link
Member

👍

Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

SVG files are considered as images now: a preview and the image dimensions are shown. The image dimensions of SVG files are provided by this Zope PR zopefoundation/Zope#1146

svg_image_fsview

@dataflake
Copy link
Member

Just make sure that this switch from FSFile to FSImage does not lead to blowups/tracebacks when used with Zope versions from before zopefoundation/Zope#1146

Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

Thanks for the hint (#130 (comment)); actually with default width/height=-1 the FSImage-preview does not work (same as FSFile).

This custimage-DTML-template change provides an image preview now, even without zopefoundation/Zope#1146.
Having no image dimensions the SVG pic is shown using the object-Tag for setting mime-type (!) and an onload-resizing for a best-guess-fit. This is not as perfect as scaling with available dimensions (zopefoundation/Zope#1146) , but it is still an UX-improvement compared to the former status of SVG as FSFile, because formerly the image-preview was not shown at all.

LEFT: without Zope-PR#1146; RIGHT: with Zope-PR#1146
FSImage_backwards

@dataflake
Copy link
Member

👍

Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

White or transparent SVG images cannot be seen on a white background. Photoshop et.al. use a checkerboard pattern in case:

checkerboard

Copy link
Contributor Author

@drfho drfho left a comment

Choose a reason for hiding this comment

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

More usertests revealed that for white+transparent images the contrasts may be improved; now onhover the checkerboard resolves into plain grey for a better visibbility of the details.

svg_trans_hover

@drfho drfho changed the title ZMI: limit number of resulted folderish objects ZMI: limit number of resulted folderish objects and show SVG as FSImage Sep 8, 2023
@drfho
Copy link
Contributor Author

drfho commented Sep 8, 2023

Hi @dataflake ,
now the PR may be mature for merging, My or your turn?
Mabe in combination with zopefoundation/Zope#1146
Many thanks
f

@dataflake
Copy link
Member

The PR author merges after approval, which you already have for both. Next time I would suggest you ask for approval at the very end. I didn't know this was going to hang around for such a long time while you were making tweaks and fixes.

@drfho drfho merged commit 33da508 into master Sep 8, 2023
14 checks passed
@drfho drfho deleted the zmi_customize_item branch September 8, 2023 15:43
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

2 participants