Web UI dropdown for custom args with choices - #2372
Conversation
|
Nice! Can you add a note about this feature in the documentation (.rst files), as well as a test case (add this type of extra arg to one of the existing gui args tests. I hope such a test exists :) |
Makes sense, yeah I'll take a shot at that when I get home later. I'll see what I can do with the GUI tests... there's an existing custom args test but it doesn't test the GUI itself, it tests that parse_args works as expected and that Flask can receive those values. There are a couple others though that test the HTML results and I'll see if I can combine the custom arg test with one of those. |
|
Ok I think this works! I was able to run the test locally and confirm that it failed while in development then passed when done. I chose regex to test the generated html because it's less brittle than assertIn. I considered doing an xpath-based test which would be more robust, but would add a single-use dependency to the test suite. |
|
馃憤馃憤 |
Addresses #2371
This adds web UI support for a dropdown list in custom arguments:

Code:
argparse already checks those choices on command-line args, this PR just makes the web UI behave similarly.
The CSS width is different for select (340) vs input (set to 328, actual 340) to get them to be the same actual width. I'm not exactly sure why but it looks like it has to do with differences in how padding is handled between the two tags.
Testing
I ran locally with
scripts/run-local-web.shon OS X in a virtual env with Python 3.11.3I wasn't able to get the tox tests running locally (I tried on master before making changes but it failed). Sorry about that! Hopefully the github actions aren't too burdensome.