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

Parse URL query parameters to prepopulate subparser and script parameters #395

Merged
merged 3 commits into from
Dec 14, 2023

Conversation

Lioscro
Copy link
Collaborator

@Lioscro Lioscro commented Dec 9, 2023

Support prepopulating script parameters by parsing URL query parameters. This is useful in generating Wooey URLs for user-facing scripts to minimize user error in filling out info that the component generating the URL may already know about.

@codecov-commenter
Copy link

codecov-commenter commented Dec 9, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (d2f65d3) 77.33% compared to head (469c136) 77.63%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #395      +/-   ##
==========================================
+ Coverage   77.33%   77.63%   +0.29%     
==========================================
  Files         143      143              
  Lines        5022     5070      +48     
  Branches      666      668       +2     
==========================================
+ Hits         3884     3936      +52     
+ Misses        989      988       -1     
+ Partials      149      146       -3     
Flag Coverage Δ
unittests 77.57% <100.00%> (+0.29%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Lioscro Lioscro requested a review from Chris7 December 9, 2023 16:53
@Lioscro
Copy link
Collaborator Author

Lioscro commented Dec 9, 2023

@Chris7 should we also update the docs on how this works?

@Chris7
Copy link
Member

Chris7 commented Dec 11, 2023

This is awesome. Docs would be great. I generally build them locally in docs with make docs and you can check the output in build

var $initial_parser = $("a[data-parser-pk=" + $wooey_parser.val() + "]");
// Set initial subparser if present in url params.
const urlParams = new URLSearchParams(window.location.search);
const subparser = urlParams.get('__subparser');
Copy link
Member

Choose a reason for hiding this comment

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

is there a reason the param has __?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's because it is somewhat of an internal keyword that specifically controls the subparser to use, not to be confused with other URL parameters that are treated as positional or keyword arguments.

@Lioscro Lioscro requested a review from Chris7 December 13, 2023 16:44
Copy link
Member

@Chris7 Chris7 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 additional documentation, it's great! There's a little caveat in how data is being passed that could cause confusion and i don't love users having to know some internals vs. what they see on the command line (e.g. a_slug vs a-slug)

docs/wooey_ui.rst Show resolved Hide resolved
@Lioscro Lioscro merged commit dc45729 into master Dec 14, 2023
14 checks passed
@Lioscro Lioscro deleted the script-url-parameters branch December 14, 2023 15:17
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