harrisjoseph commented on pull request #10839:
URL: https://github.com/apache/airflow/pull/10839#issuecomment-690114478


   Thanks a lot @kaxil. My reason for wanting to pre-populate the text area is 
for ease of use when the User wants to trigger a DAG Run which changes some but 
not all of the parameters in `DAG.params`. I'm assuming users will want to 
avoid writing out a large-ish json object manually, or copying & pasting a 
template or some default parameters from somewhere else. For example:
   ```
   # DAG params are the default values here:
   DAG.params = {
       "x_max": 200,
       "y_max": 200,
       "filter_threshold": 0.8,
       "accuracy": 1
   }
   
   # The user wants to run something custom, and override some of these defaults
   dag_run.conf = {
       "x_max": 200,
       "y_max": 200,
       "filter_threshold": 0.5,
       "accuracy": -100
   }
   ```
   
   If pre-populating the text-area with `DAG.params` is too opinionated, or 
will frustrate other users who prefer to start with an empty text-area, then I 
could add the default `DAG.params` below the form as a `<code>` block, so it 
can be easily copied and pasted.
   
   I had also considered adding a new dict attribute 
`trigger_dag_ui_default_conf` to the DAG object, which could be used to 
pre-populate the text-area, but in most cases, this will be almost identical to 
`params`.
   
   ---
   
   @casassg I totally agree, a flexible form that allows a user to edit keys & 
values would be much nicer than a freeform text-area (like the key-value secret 
editor view in H'corp Vault). 
   I've just had a quick check - HTML forms don't provide a standard way of 
accepting key-value pairs & adding them to the posted data, so some custom 
javascript would probably be needed to achieve this. I could attempt a 
js/jQuery solution, or try a hack with form-input arrays, but I doubt either of 
these approaches would pass code-review given my hilariously outdated frontend 
skills. If you had a better approach in mind, I'm happy to attempt it in this 
or another PR.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to