Skip to content

Conversation

@krvspacetime
Copy link

@krvspacetime krvspacetime commented Mar 16, 2025

Description

Added a toggle to manually input the max file size instead of using the slider.

Gitingest with manual max file size input

Major changes:

  • Files modified:

    • git_form.jinja

    • index.py

    • process_query.py

    • utils.js

  • Added three form values / new params in the POST endpoint in index.pycalled:

    • use_manual_input: bool

    • max_file_size_manual: int

    • size_unit:str

    These are also added to the context in process_query.py

  • Added three new inputs elements

    • checkbox: toggle use of slider vs. manual input

    • number: accepts manual file size in by manually inputing a value of using the increment/decrement triggers

    • radio: switch between accepted file sizes betweenkb or mb

  • Keep new form/input states after receving results and submitting form

    • Added a function in utils.js called restoreFormState to keep current input/form values after a successfull POST request

Minor changes

  • Removed console log in changePatternfunction in git_form.jinja

  • Reduced height of the absolute div (shadow effect) at large screens to 90% (lg:h-90% sm:h-fulll)) using media query in Tailwind to compensate to the slight change in dimesion of the div containg the form due to the addition of the new input element

  • Removed unused variable minp in utils.js

  • Added new context values in the home page to pass in default values called default_file_size_manual, use_manual_input and size_unit

… instead of using the slider

- Added two (2) new arguments to the POST route in 'index.py' called 'max_file_size_manual' and 'use_manual_input'
- The query_processor now directly uses the max file size value instead of using the log_slider_to_size function if the value provided is from the manual file size input
… using manual max file input

Added 'size_unit' parameter in the POST route at 'index.py'
Passed the 'use_manual input', 'max_file_size_manual' and 'size_unit' params  to the context in 'query_processor.py'
…ssible to increment the value of the file size in 'kb' on initial render if the radio input with the value 'kb' is not deselected and selected again and the current value is more than 100

- Removed the console log in the 'changePattern' function in 'git_form.jinja'
- Add 'use_manual_input' and 'size_unit' to the initial context in 'index.py' GET route
- Add a function called 'restoreFormState' to properly keep form and input values after a successful form submition
- Remove unused variable minp in 'utils.js'
- Add 'default_file_size_manual', 'use_manual_input' and 'size_unit' as
  new context values in the HTMLResponse in the home page
@cyclotruc
Copy link
Member

Hi @krvspacetime thank you for your contribution

I see some tests not passing

Regarding the changes, while I think it's a good idea to have the value editable with a text box, I think I want to keep the slider

I think the simplest way to keep both would be to make the value of the current slider editable by clicking it

what do you think?

@krvspacetime
Copy link
Author

krvspacetime commented Mar 19, 2025

Hello @cyclotruc, you're welcome and thank you for the feedback.

I see some tests not passing

I think some of it is because I have to update the test_flow_ingegration.py and include the new form data values I added where necessary.

Regarding the changes, while I think it's a good idea to have the value editable with a text box, I think I want to keep the slider

I think the simplest way to keep both would be to make the value of the current slider editable by clicking it

The slider is actually still there, it is set as the default way to input the max file size. The input I added only shows when toggled.

Slider as default to input max_file_size

Slider keeps state after results

I think the simplest way to keep both would be to make the value of the current slider editable by clicking it

It's funny because this is actually what I tried initially. I simply replaced the span with an input that can be edited when clicked and then made a function to reverse the log_slider_to_size / logSliderToSize functions so the slider position can be calculated. Is that what you meant? If this is what you prefer, I can work on it.

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.

2 participants