Skip to content

Improvement for Incorrect file size for Category image, Download file and Sample, additional query request overhead. #7678 #7679

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

Open
wants to merge 3 commits into
base: develop
Choose a base branch
from

Conversation

jafin
Copy link
Contributor

@jafin jafin commented Apr 15, 2025

Proposal for #7678

Improvement to FileSize for Category, Download and Sample

Populate the FilePond schema for

  • Category Image
  • Download file
  • Sample File

This avoids additional queries against the respective controllers returning the HTML size to the control (which is incorrect), since the files array for FilePond is already popualted with this content.

Refactoring front end JS

  • Improved separation of backend variables and clientside JS by introducing js viewModel, and using JSON Serializing to ensure correct response.
  • Move GetAcceptedMimeTypes to MediaSettings to avoid duplicate code (in future this could be added to settings to allow user to override I guess, for now readonly.
  • Minor refactorings to JS,
    • Jquery .click -> on('click',fn()),
    • Create jquery Selectors once, and reuse.

NOTE: Depending on the configuration of the PictureService or DownloadService (via 3rd parties) the fileSize of the attachments may NOT be populated. It is not guaranteed this value is set, nor for performance should it be. See proposal in #7678 for ideas to introduce a size attribute to db to cache this information (avoiding the need to pull down large objects just to obtain filesize)

This should be a non breaking change.

jafin added 2 commits April 15, 2025 13:33
… to get binary filesize. Move AcceptedMimeTypes to Settings

- Populate filesize and mimetype on load
- this reduces excess queries to controllers for no added value.
- Better separation of JS code from backend vars, by serializing viewmodel data to json.
@jafin jafin changed the title Improvement for Incorrect file size for Category image, Download file and Sample, additional query request overhead. for #7678 Improvement for Incorrect file size for Category image, Download file and Sample, additional query request overhead. #7678 Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants