**Description**

Replace the Configuration JSON text-area with a form that has individual input fields for each key & value. This will remove the need for the user to provide a json object. See hashicorp vault's key-value secrets UI for an example of what this might look like:

![Screenshot 2020-09-21 at 12 06 03](https://user-images.githubusercontent.com/17148324/93759844-df04f680-fc02-11ea-8613-f3bcc0b22d09.png)
 
- If present these keys and values should be serialised as json client-side and posted to the trigger-dag API endpoint as the `conf` request-parameter.
- By default no conf request-parameter is sent. Perhaps a checkbox should be used to determine whether conf is sent at all?
- The user may want to add new keys, or remove keys & values that they have previously added.
- [PR-10839](https://github.com/apache/airflow/pull/10839) is pre-populating the form with the DAG's default params. The new form should be pre-populated with the keys & values from `DAG.params`


**Use case / motivation**

Currently when triggering a manual DAG run with user-provided runtime parameters, the user has to provide a correctly formatted JSON object. Filling in a form with keys & values will be a significantly better user experience, and will be less error prone & laborious than handling json in a free-text field.

This builds on the great work already done on enhancing the Trigger-DAG functionality

**Related Issues**

Originating PR: https://github.com/apache/airflow/pull/10839
"""
    Return a dict of the task quantity, grouped by dag id and task status.
    :param qry: The data in the format (<dag id>, <task state>, <is dag running>, <task count>),
        ordered by <dag id> and <is dag running>
    """
    data = {}
    last_dag_id = None
    has_running_dags = False
    for dag_id, state, is_dag_running, count in qry:
        if last_dag_id != dag_id:
            last_dag_id = dag_id
            has_running_dags = False
        elif not is_dag_running and has_running_dags:
            continue
        if is_dag_running:
            has_running_dags = True
        if dag_id not in data:
            data[dag_id] = {}
        data[dag_id][state] = count
    return data
def redirect_or_json(origin, msg, status="", status_code=200):