Skip to content

Conversation

@krvspacetime
Copy link

@krvspacetime krvspacetime commented Apr 6, 2025

Direct Max File Size Input Feature

Overview

This PR implements a direct file size input feature that allows user to input values for the max file size with decimal precision (e.g., "1.5kb" or "2.75mb"). The implementation changes the file size handling from integer-based to float-based throughout the application.

Direct max file size input image

Changes

1. Backend

  • Modified the max_file_size parameter type from int to float across multiple files:
    • query_parsing.py
    • ingestion_schema.py
    • entrypoint.py
    • query_processor.py

2. Frontend

  • Added a direct text input field for file size in the UI:
    • Modified git_form.jinja to include a text input that allows users to directly type file size values
    • Implemented data attribute to store exact file size values with decimal precision
    • Added support for both KB and MB units in the input field

3. Javascript Utils

  • Add/Refactor utils.js:
    • Implemented input parsing to extract numeric values and units from user input
    • Added conversion logic between KB and MB units
    • Created a formatSize function to properly display file sizes with appropriate units
    • Implemented bidirectional synchronization between the slider and direct input field
    • Made the maxp, minv, maxv variables available to the global scope they are being used in multiple areas repeatedly

NOTE: A lof of the diffs in utils.js are simply the single quotes being turned to double quotes because of my formatter.

…e max file size

Introduce a text input field for file size in the git form to allow manual entry alongside the slider. Update the slider logic to handle input changes and ensure synchronization between the slider and the input field. This improves user experience by providing more flexibility in setting file size limits.
- Add support for decimal precision in file size input by converting max_file_size from int to loat. This allows users to specify exact file sizes with decimal values, improving flexibility and accuracy.
- Update the schema, form handling, and UI elements to ensure consistent behavior and proper formatting of decimal values.
- Modify slider_position and �xact_file_size to handle float values in query processing
- Adjust slider step to �ny  in the template to allow decimal increments
- Refactor logSliderToSize and related functions in utils.js  to support decimal precision
@filipchristiansen
Copy link
Contributor

filipchristiansen commented Jun 19, 2025

Thank you for the PR @krvspacetime

What is the motivation for this? When is this useful?

@cyclotruc
Copy link
Member

@krvspacetime Hi
While I appreciate the effort, I am unsure about the relevance of floats to define the size, it's probably over complex for what it allows

I'm going to close this PR for clarity in the repo but if you have a legitimate point please tell us here and I'll be happy to reopen this
Thanks for understanding

@cyclotruc cyclotruc closed this Jun 19, 2025
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.

3 participants