Configurable Forms for flows
cc @lukeolson
A form description looks like https://github.com/isuruf/relate-sample/blob/91226393241cfed6457db533addfb2da6e83f645/forms/instant.yml
There are 5 types of fields. Text, Integer, Float, Choice, Hidden.
template_in and template_out are mandatory fields and they can be either Hidden or Text. If Hidden the values are fixed, but if Text, the user who fills the form can fill them.
If template_out=flows/asd.yml then the actual output would be flows/asd_20190930_022148_311577.yml where the time is appended.
There's a type for a form which is only flow for now. If there's a announce field and set to true and the type is a flow, then an InstantFlowRequest is created.
Flow created looks like
{% with id="20190930_022148_311577",
field1="1",
field2="A",
template_in="flows/instant_flow.jinja",
template_out="flows/instant_flow.yml",
announce="True",
created_time="2019-09-30 @ 02:21" %}
{% include "flows/instant_flow.jinja" %}
{% endwith %}
The templated flow template_in can use the form variables by their id and also have access to created_time and id. created_time is useful for instant flows that @lukeolson mentioned.
Let me know what you think.
@inducer, let me know what you think. I'll add tests if you think there shouldn't be any major re-write.
Codecov Report
Merging #679 into master will decrease coverage by
0.48%. The diff coverage is74.29%.
@@ Coverage Diff @@
## master #679 +/- ##
==========================================
- Coverage 96.56% 96.08% -0.49%
==========================================
Files 45 46 +1
Lines 11215 11459 +244
Branches 2084 2137 +53
==========================================
+ Hits 10830 11010 +180
- Misses 298 361 +63
- Partials 87 88 +1
| Impacted Files | Coverage Δ | |
|---|---|---|
| course/content.py | 96.7% <100%> (ø) |
:arrow_up: |
| relate/urls.py | 100% <100%> (ø) |
:arrow_up: |
| course/constants.py | 100% <100%> (ø) |
:arrow_up: |
| course/validation.py | 99.83% <100%> (+0.01%) |
:arrow_up: |
| course/forms.py | 65.21% <65.21%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact),ø = not affected,? = missing dataPowered by Codecov. Last update 22643e6...4dafc64. Read the comment docs.