samedi 16 février 2019

How to pass user defined named parameters (kwarg) from frontend to backend in the right way

My goal is to get advice on the best way to pass user defined named parameters from front to backend.

Current state:

My frontend allows users to chose a script (by name) to run in the backend. A dropdown shows available scripts. Currently all those scripts have hardcoded parameters.

I would like to allow users to pass in parameters from the frontend as well, to allow scripts to be more generic, but am unsure which is the best way.

Ideas:

My idea was to present a table like this on the UI (like in kwargs):

  • key, value
  • maximum, 0.5
  • minimum, 0.1
  • buffer, 0.02

allowing users to input any key, value pair and add as many rows as needed. I would then pass this to the script.

However, the shortcomings are that it is susceptible to typos, and the user needs to know variable names used in the backend.

I can come up with many alternative ways, but looking for advice from someone who has practical experience with such a use case.

Aucun commentaire:

Enregistrer un commentaire